diff options
| -rw-r--r-- | youtube_dl/downloader/rtmp.py | 3 | ||||
| -rw-r--r-- | youtube_dl/extractor/naver.py | 34 | ||||
| -rw-r--r-- | youtube_dl/extractor/xvideos.py | 17 | ||||
| -rw-r--r-- | youtube_dl/extractor/youtube.py | 6 | 
4 files changed, 38 insertions, 22 deletions
| diff --git a/youtube_dl/downloader/rtmp.py b/youtube_dl/downloader/rtmp.py index 78b1e7cd2..cc6a84106 100644 --- a/youtube_dl/downloader/rtmp.py +++ b/youtube_dl/downloader/rtmp.py @@ -96,6 +96,7 @@ class RtmpFD(FileDownloader):          flash_version = info_dict.get('flash_version', None)          live = info_dict.get('rtmp_live', False)          conn = info_dict.get('rtmp_conn', None) +        protocol = info_dict.get('rtmp_protocol', None)          self.report_destination(filename)          tmpfilename = self.temp_name(filename) @@ -133,6 +134,8 @@ class RtmpFD(FileDownloader):                  basic_args += ['--conn', entry]          elif isinstance(conn, compat_str):              basic_args += ['--conn', conn] +        if protocol is not None: +            basic_args += ['--protocol', protocol]          args = basic_args + [[], ['--resume', '--skip', '1']][not live and self.params.get('continuedl', False)]          if sys.platform == 'win32' and sys.version_info < (3, 0): diff --git a/youtube_dl/extractor/naver.py b/youtube_dl/extractor/naver.py index 4cab30631..c0231c197 100644 --- a/youtube_dl/extractor/naver.py +++ b/youtube_dl/extractor/naver.py @@ -1,4 +1,6 @@  # encoding: utf-8 +from __future__ import unicode_literals +  import re  from .common import InfoExtractor @@ -12,12 +14,13 @@ class NaverIE(InfoExtractor):      _VALID_URL = r'https?://(?:m\.)?tvcast\.naver\.com/v/(?P<id>\d+)'      _TEST = { -        u'url': u'http://tvcast.naver.com/v/81652', -        u'file': u'81652.mp4', -        u'info_dict': { -            u'title': u'[9월 모의고사 해설강의][수학_김상희] 수학 A형 16~20번', -            u'description': u'합격불변의 법칙 메가스터디 | 메가스터디 수학 김상희 선생님이 9월 모의고사 수학A형 16번에서 20번까지 해설강의를 공개합니다.', -            u'upload_date': u'20130903', +        'url': 'http://tvcast.naver.com/v/81652', +        'info_dict': { +            'id': '81652', +            'ext': 'mp4', +            'title': '[9월 모의고사 해설강의][수학_김상희] 수학 A형 16~20번', +            'description': '합격불변의 법칙 메가스터디 | 메가스터디 수학 김상희 선생님이 9월 모의고사 수학A형 16번에서 20번까지 해설강의를 공개합니다.', +            'upload_date': '20130903',          },      } @@ -28,7 +31,7 @@ class NaverIE(InfoExtractor):          m_id = re.search(r'var rmcPlayer = new nhn.rmcnmv.RMCVideoPlayer\("(.+?)", "(.+?)"',              webpage)          if m_id is None: -            raise ExtractorError(u'couldn\'t extract vid and key') +            raise ExtractorError('couldn\'t extract vid and key')          vid = m_id.group(1)          key = m_id.group(2)          query = compat_urllib_parse.urlencode({'vid': vid, 'inKey': key,}) @@ -39,22 +42,27 @@ class NaverIE(InfoExtractor):          })          info = self._download_xml(              'http://serviceapi.rmcnmv.naver.com/flash/videoInfo.nhn?' + query, -            video_id, u'Downloading video info') +            video_id, 'Downloading video info')          urls = self._download_xml(              'http://serviceapi.rmcnmv.naver.com/flash/playableEncodingOption.nhn?' + query_urls, -            video_id, u'Downloading video formats info') +            video_id, 'Downloading video formats info')          formats = []          for format_el in urls.findall('EncodingOptions/EncodingOption'):              domain = format_el.find('Domain').text -            if domain.startswith('rtmp'): -                continue -            formats.append({ +            f = {                  'url': domain + format_el.find('uri').text,                  'ext': 'mp4',                  'width': int(format_el.find('width').text),                  'height': int(format_el.find('height').text), -            }) +            } +            if domain.startswith('rtmp'): +                f.update({ +                    'ext': 'flv', +                    'rtmp_protocol': '1', # rtmpt +                }) +            formats.append(f) +        self._sort_formats(formats)          return {              'id': video_id, diff --git a/youtube_dl/extractor/xvideos.py b/youtube_dl/extractor/xvideos.py index 85e99e1b0..7e0044824 100644 --- a/youtube_dl/extractor/xvideos.py +++ b/youtube_dl/extractor/xvideos.py @@ -5,18 +5,21 @@ import re  from .common import InfoExtractor  from ..utils import (      compat_urllib_parse, +    ExtractorError, +    clean_html,  )  class XVideosIE(InfoExtractor):      _VALID_URL = r'^(?:https?://)?(?:www\.)?xvideos\.com/video([0-9]+)(?:.*)'      _TEST = { -        'url': 'http://www.xvideos.com/video939581/funny_porns_by_s_-1', -        'file': '939581.flv', -        'md5': '1d0c835822f0a71a7bf011855db929d0', +        'url': 'http://www.xvideos.com/video4588838/biker_takes_his_girl', +        'md5': '4b46ae6ea5e6e9086e714d883313c0c9',          'info_dict': { -            "title": "Funny Porns By >>>>S<<<<<< -1", -            "age_limit": 18, +            'id': '4588838', +            'ext': 'flv', +            'title': 'Biker Takes his Girl', +            'age_limit': 18,          }      } @@ -28,6 +31,10 @@ class XVideosIE(InfoExtractor):          self.report_extraction(video_id) +        mobj = re.search(r'<h1 class="inlineError">(.+?)</h1>', webpage) +        if mobj: +            raise ExtractorError('%s said: %s' % (self.IE_NAME, clean_html(mobj.group(1))), expected=True) +          # Extract video URL          video_url = compat_urllib_parse.unquote(              self._search_regex(r'flv_url=(.+?)&', webpage, 'video URL')) diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py index 8327fb146..2c51a0b47 100644 --- a/youtube_dl/extractor/youtube.py +++ b/youtube_dl/extractor/youtube.py @@ -1414,11 +1414,9 @@ class YoutubePlaylistIE(YoutubeBaseInfoExtractor):          title_span = (search_title('playlist-title') or              search_title('title long-title') or search_title('title'))          title = clean_html(title_span) -        video_re = r'''(?x)data-video-username="(.*?)".*? +        video_re = r'''(?x)data-video-username=".*?".*?                         href="/watch\?v=([0-9A-Za-z_-]{11})&[^"]*?list=%s''' % re.escape(playlist_id) -        matches = orderedSet(re.findall(video_re, webpage, flags=re.DOTALL)) -        # Some of the videos may have been deleted, their username field is empty -        ids = [video_id for (username, video_id) in matches if username] +        ids = orderedSet(re.findall(video_re, webpage, flags=re.DOTALL))          url_results = self._ids_to_results(ids)          return self.playlist_result(url_results, playlist_id, title) | 
