1
0
Fork 0
mirror of https://gitlab.com/dstftw/youtube-dl.git synced 2020-11-16 09:42:26 +00:00

Merge pull request #195 from rbrito/xvideos

Fixes for the xvideos IE
This commit is contained in:
Philipp Hagemeister 2011-10-18 13:49:21 -07:00
commit d76736fc5e

View file

@ -3413,7 +3413,7 @@ class XVideosIE(InfoExtractor):
self.report_webpage(video_id) self.report_webpage(video_id)
request = urllib2.Request(url) request = urllib2.Request(r'http://www.xvideos.com/video' + video_id)
try: try:
webpage = urllib2.urlopen(request).read() webpage = urllib2.urlopen(request).read()
except (urllib2.URLError, httplib.HTTPException, socket.error), err: except (urllib2.URLError, httplib.HTTPException, socket.error), err:
@ -3426,13 +3426,13 @@ class XVideosIE(InfoExtractor):
# Extract video URL # Extract video URL
mobj = re.search(r'flv_url=(.+?)&', webpage) mobj = re.search(r'flv_url=(.+?)&', webpage)
if mobj is None: if mobj is None:
self._downloader.trouble(u'ERROR: unable to extract video title') self._downloader.trouble(u'ERROR: unable to extract video url')
return return
video_url = urllib2.unquote(mobj.group(1).decode('utf-8')) video_url = urllib2.unquote(mobj.group(1).decode('utf-8'))
# Extract title # Extract title
mobj = re.search(r'<title>(.*?)</title>', webpage) mobj = re.search(r'<title>(.*?)\s+-\s+XVID', webpage)
if mobj is None: if mobj is None:
self._downloader.trouble(u'ERROR: unable to extract video title') self._downloader.trouble(u'ERROR: unable to extract video title')
return return