about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2011-09-13 23:50:44 +0200
committerPhilipp Hagemeister <phihag@phihag.de>2011-09-13 23:50:44 +0200
commit50bdd8a9e7c7cf4bae49b281f5b689a1f072a858 (patch)
tree466918f110d334cdb01dab24bb500a5bb9e24d00
parent34554a7ad4186ad5f39d1b9903b8b619bd77bba1 (diff)
parent62a29bbf7bd0b0d9539aa903519f252671e4eebd (diff)
downloadyoutube-dl-50bdd8a9e7c7cf4bae49b281f5b689a1f072a858.tar.gz
youtube-dl-50bdd8a9e7c7cf4bae49b281f5b689a1f072a858.tar.xz
youtube-dl-50bdd8a9e7c7cf4bae49b281f5b689a1f072a858.zip
Merge remote-tracking branch 'knagano/master'
-rwxr-xr-xyoutube-dl15
1 files changed, 10 insertions, 5 deletions
diff --git a/youtube-dl b/youtube-dl
index 760930e44..781dff758 100755
--- a/youtube-dl
+++ b/youtube-dl
@@ -1523,6 +1523,7 @@ class DailymotionIE(InfoExtractor):
 
 		# Retrieve video webpage to extract further information
 		request = urllib2.Request(url)
+		request.add_header('Cookie', 'family_filter=off')
 		try:
 			self.report_download_webpage(video_id)
 			webpage = urllib2.urlopen(request).read()
@@ -1532,25 +1533,29 @@ class DailymotionIE(InfoExtractor):
 
 		# Extract URL, uploader and title from webpage
 		self.report_extraction(video_id)
-		mobj = re.search(r'(?i)addVariable\(\"video\"\s*,\s*\"([^\"]*)\"\)', webpage)
+		mobj = re.search(r'(?i)addVariable\(\"sequence\"\s*,\s*\"([^\"]+?)\"\)', webpage)
 		if mobj is None:
 			self._downloader.trouble(u'ERROR: unable to extract media URL')
 			return
-		mediaURL = urllib.unquote(mobj.group(1))
+		sequence = urllib.unquote(mobj.group(1))
+		mobj = re.search(r',\"sdURL\"\:\"([^\"]+?)\",', sequence)
+		if mobj is None:
+			self._downloader.trouble(u'ERROR: unable to extract media URL')
+			return
+		mediaURL = urllib.unquote(mobj.group(1)).replace('\\', '')
 
 		# if needed add http://www.dailymotion.com/ if relative URL
 
 		video_url = mediaURL
 
-		# '<meta\s+name="title"\s+content="Dailymotion\s*[:\-]\s*(.*?)"\s*\/\s*>'
-		mobj = re.search(r'(?im)<title>Dailymotion\s*[\-:]\s*(.+?)</title>', webpage)
+		mobj = re.search(r'(?im)<title>Dailymotion\s*-\s*(.+)\s*-\s*[^<]+?</title>', webpage)
 		if mobj is None:
 			self._downloader.trouble(u'ERROR: unable to extract title')
 			return
 		video_title = mobj.group(1).decode('utf-8')
 		video_title = sanitize_title(video_title)
 
-		mobj = re.search(r'(?im)<Attribute name="owner">(.+?)</Attribute>', webpage)
+		mobj = re.search(r'(?im)<span class="owner[^\"]+?">[^<]+?<a [^>]+?>([^<]+?)</a></span>', webpage)
 		if mobj is None:
 			self._downloader.trouble(u'ERROR: unable to extract uploader nickname')
 			return