X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Fxtube.py;h=982619922d8ef5fdd0f260902b0253f5dce024dd;hb=70cb73922b532c20925e725aa0243305c4caaac6;hp=483fb0791247c10d02410ac9a6f1d2551e859cc0;hpb=fa5d47af4b82356c39c1e8d7b2ada9b539371735;p=youtube-dl diff --git a/youtube_dl/extractor/xtube.py b/youtube_dl/extractor/xtube.py index 483fb0791..982619922 100644 --- a/youtube_dl/extractor/xtube.py +++ b/youtube_dl/extractor/xtube.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + import os import re @@ -5,20 +7,19 @@ from .common import InfoExtractor from ..utils import ( compat_urllib_parse_urlparse, compat_urllib_request, - compat_urllib_parse, ) class XTubeIE(InfoExtractor): _VALID_URL = r'^(?:https?://)?(?:www\.)?(?Pxtube\.com/watch\.php\?v=(?P[^/?&]+))' _TEST = { - u'url': u'http://www.xtube.com/watch.php?v=kVTUy_G222_', - u'file': u'kVTUy_G222_.mp4', - u'md5': u'092fbdd3cbe292c920ef6fc6a8a9cdab', - u'info_dict': { - u"title": u"strange erotica", - u"description": u"surreal gay themed erotica...almost an ET kind of thing", - u"uploader": u"greenshowers", - u"age_limit": 18, + 'url': 'http://www.xtube.com/watch.php?v=kVTUy_G222_', + 'file': 'kVTUy_G222_.mp4', + 'md5': '092fbdd3cbe292c920ef6fc6a8a9cdab', + 'info_dict': { + "title": "strange erotica", + "description": "surreal gay themed erotica...almost an ET kind of thing", + "uploader": "greenshowers", + "age_limit": 18, } } @@ -31,16 +32,16 @@ class XTubeIE(InfoExtractor): req.add_header('Cookie', 'age_verified=1') webpage = self._download_webpage(req, video_id) - video_title = self._html_search_regex(r'
([^<]+)', webpage, u'description', default=None) - video_url= self._html_search_regex(r'var videoMp4 = "([^"]+)', webpage, u'video_url').replace('\\/', '/') - path = compat_urllib_parse_urlparse( video_url ).path - extension = os.path.splitext( path )[1][1:] + video_title = self._html_search_regex(r'
([^<]+)', webpage, 'description', fatal=False) + video_url= self._html_search_regex(r'var videoMp4 = "([^"]+)', webpage, 'video_url').replace('\\/', '/') + path = compat_urllib_parse_urlparse(video_url).path + extension = os.path.splitext(path)[1][1:] format = path.split('/')[5].split('_')[:2] format[0] += 'p' format[1] += 'k' - format = "-".join( format ) + format = "-".join(format) return { 'id': video_id,