diff options
| -rw-r--r-- | AUTHORS | 1 | ||||
| -rw-r--r-- | youtube_dl/__init__.py | 4 | ||||
| -rw-r--r-- | youtube_dl/extractor/__init__.py | 1 | ||||
| -rw-r--r-- | youtube_dl/extractor/bloomberg.py | 25 | ||||
| -rw-r--r-- | youtube_dl/extractor/miomio.py | 2 | ||||
| -rw-r--r-- | youtube_dl/extractor/mixcloud.py | 2 | ||||
| -rw-r--r-- | youtube_dl/extractor/prosiebensat1.py | 6 | ||||
| -rw-r--r-- | youtube_dl/extractor/radiojavan.py | 66 | ||||
| -rw-r--r-- | youtube_dl/options.py | 3 | ||||
| -rw-r--r-- | youtube_dl/postprocessor/ffmpeg.py | 6 | 
10 files changed, 98 insertions, 18 deletions
| @@ -120,3 +120,4 @@ Jeff Buchbinder  Amish Bhadeshia  Joram Schrijver  Will W. +Mohammad Teimori Pabandi diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py index 852b2fc3d..1c8b411b7 100644 --- a/youtube_dl/__init__.py +++ b/youtube_dl/__init__.py @@ -189,10 +189,6 @@ def _real_main(argv=None):      if opts.allsubtitles and not opts.writeautomaticsub:          opts.writesubtitles = True -    if sys.version_info < (3,): -        # In Python 2, sys.argv is a bytestring (also note http://bugs.python.org/issue2128 for Windows systems) -        if opts.outtmpl is not None: -            opts.outtmpl = opts.outtmpl.decode(preferredencoding())      outtmpl = ((opts.outtmpl is not None and opts.outtmpl) or                 (opts.format == '-1' and opts.usetitle and '%(title)s-%(id)s-%(format)s.%(ext)s') or                 (opts.format == '-1' and '%(id)s-%(format)s.%(ext)s') or diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index 2935d5b33..c05a43641 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -397,6 +397,7 @@ from .pyvideo import PyvideoIE  from .quickvid import QuickVidIE  from .r7 import R7IE  from .radiode import RadioDeIE +from .radiojavan import RadioJavanIE  from .radiobremen import RadioBremenIE  from .radiofrance import RadioFranceIE  from .rai import RaiIE diff --git a/youtube_dl/extractor/bloomberg.py b/youtube_dl/extractor/bloomberg.py index 4a88ccd13..0dca29b71 100644 --- a/youtube_dl/extractor/bloomberg.py +++ b/youtube_dl/extractor/bloomberg.py @@ -6,32 +6,39 @@ from .common import InfoExtractor  class BloombergIE(InfoExtractor): -    _VALID_URL = r'https?://www\.bloomberg\.com/video/(?P<id>.+?)\.html' +    _VALID_URL = r'https?://www\.bloomberg\.com/news/videos/[^/]+/(?P<id>[^/?#]+)'      _TEST = { -        'url': 'http://www.bloomberg.com/video/shah-s-presentation-on-foreign-exchange-strategies-qurhIVlJSB6hzkVi229d8g.html', +        'url': 'http://www.bloomberg.com/news/videos/b/aaeae121-5949-481e-a1ce-4562db6f5df2',          # The md5 checksum changes          'info_dict': {              'id': 'qurhIVlJSB6hzkVi229d8g',              'ext': 'flv',              'title': 'Shah\'s Presentation on Foreign-Exchange Strategies', -            'description': 'md5:0681e0d30dcdfc6abf34594961d8ea88', +            'description': 'md5:a8ba0302912d03d246979735c17d2761',          },      }      def _real_extract(self, url):          name = self._match_id(url)          webpage = self._download_webpage(url, name) - -        f4m_url = self._search_regex( -            r'<source src="(https?://[^"]+\.f4m.*?)"', webpage, -            'f4m url') +        video_id = self._search_regex(r'"bmmrId":"(.+?)"', webpage, 'id')          title = re.sub(': Video$', '', self._og_search_title(webpage)) +        embed_info = self._download_json( +            'http://www.bloomberg.com/api/embed?id=%s' % video_id, video_id) +        formats = [] +        for stream in embed_info['streams']: +            if stream["muxing_format"] == "TS": +                formats.extend(self._extract_m3u8_formats(stream['url'], video_id)) +            else: +                formats.extend(self._extract_f4m_formats(stream['url'], video_id)) +        self._sort_formats(formats) +          return { -            'id': name.split('-')[-1], +            'id': video_id,              'title': title, -            'formats': self._extract_f4m_formats(f4m_url, name), +            'formats': formats,              'description': self._og_search_description(webpage),              'thumbnail': self._og_search_thumbnail(webpage),          } diff --git a/youtube_dl/extractor/miomio.py b/youtube_dl/extractor/miomio.py index 11608f730..cc3f27194 100644 --- a/youtube_dl/extractor/miomio.py +++ b/youtube_dl/extractor/miomio.py @@ -44,7 +44,7 @@ class MioMioIE(InfoExtractor):          xml_config = self._search_regex(              r'flashvars="type=sina&(.+?)&',              webpage, 'xml config') -         +          # skipping the following page causes lags and eventually connection drop-outs          self._request_webpage(              'http://www.miomio.tv/mioplayer/mioplayerconfigfiles/xml.php?id=%s&r=%s' % (id, random.randint(100, 999)), diff --git a/youtube_dl/extractor/mixcloud.py b/youtube_dl/extractor/mixcloud.py index 21aea0c55..84f291558 100644 --- a/youtube_dl/extractor/mixcloud.py +++ b/youtube_dl/extractor/mixcloud.py @@ -97,7 +97,7 @@ class MixcloudIE(InfoExtractor):              r'\s+"profile": "([^"]+)",', webpage, 'uploader id', fatal=False)          description = self._og_search_description(webpage)          like_count = str_to_int(self._search_regex( -            r'\bbutton-favorite\b.+m-ajax-toggle-count="([^"]+)"', +            r'\bbutton-favorite\b[^>]+m-ajax-toggle-count="([^"]+)"',              webpage, 'like count', fatal=False))          view_count = str_to_int(self._search_regex(              [r'<meta itemprop="interactionCount" content="UserPlays:([0-9]+)"', diff --git a/youtube_dl/extractor/prosiebensat1.py b/youtube_dl/extractor/prosiebensat1.py index 385681d06..7cc799664 100644 --- a/youtube_dl/extractor/prosiebensat1.py +++ b/youtube_dl/extractor/prosiebensat1.py @@ -10,6 +10,7 @@ from ..compat import (  )  from ..utils import (      unified_strdate, +    int_or_none,  ) @@ -24,7 +25,7 @@ class ProSiebenSat1IE(InfoExtractor):              'info_dict': {                  'id': '2104602',                  'ext': 'mp4', -                'title': 'Staffel 2, Episode 18 - Jahresrückblick', +                'title': 'Episode 18 - Staffel 2',                  'description': 'md5:8733c81b702ea472e069bc48bb658fc1',                  'upload_date': '20131231',                  'duration': 5845.04, @@ -266,6 +267,9 @@ class ProSiebenSat1IE(InfoExtractor):              urls_sources = urls_sources.values()          def fix_bitrate(bitrate): +            bitrate = int_or_none(bitrate) +            if not bitrate: +                return None              return (bitrate // 1000) if bitrate % 1000 == 0 else bitrate          for source in urls_sources: diff --git a/youtube_dl/extractor/radiojavan.py b/youtube_dl/extractor/radiojavan.py new file mode 100644 index 000000000..73ab78d6d --- /dev/null +++ b/youtube_dl/extractor/radiojavan.py @@ -0,0 +1,66 @@ +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from ..utils import( +    unified_strdate, +    str_to_int, +) + + +class RadioJavanIE(InfoExtractor): +    _VALID_URL = r'https?://(?:www\.)?radiojavan\.com/videos/video/(?P<id>[^/]+)/?' +    _TEST = { +        'url': 'http://www.radiojavan.com/videos/video/chaartaar-ashoobam', +        'md5': 'e85208ffa3ca8b83534fca9fe19af95b', +        'info_dict': { +            'id': 'chaartaar-ashoobam', +            'ext': 'mp4', +            'title': 'Chaartaar - Ashoobam', +            'thumbnail': 're:^https?://.*\.jpe?g$', +            'upload_date': '20150215', +            'view_count': int, +            'like_count': int, +            'dislike_count': int, +        } +    } + +    def _real_extract(self, url): +        video_id = self._match_id(url) + +        webpage = self._download_webpage(url, video_id) + +        formats = [{ +            'url': 'https://media.rdjavan.com/media/music_video/%s' % video_path, +            'format_id': '%sp' % height, +            'height': height, +        } for height, video_path in re.findall(r"RJ\.video(\d+)p\s*=\s*'/?([^']+)'", webpage)] + +        title = self._og_search_title(webpage) +        thumbnail = self._og_search_thumbnail(webpage) + +        upload_date = unified_strdate(self._search_regex( +            r'class="date_added">Date added: ([^<]+)<', +            webpage, 'upload date', fatal=False)) + +        view_count = str_to_int(self._search_regex( +            r'class="views">Plays: ([\d,]+)', +            webpage, 'view count', fatal=False)) +        like_count = str_to_int(self._search_regex( +            r'class="rating">([\d,]+) likes', +            webpage, 'like count', fatal=False)) +        dislike_count = str_to_int(self._search_regex( +            r'class="rating">([\d,]+) dislikes', +            webpage, 'dislike count', fatal=False)) + +        return { +            'id': video_id, +            'title': title, +            'thumbnail': thumbnail, +            'upload_date': upload_date, +            'view_count': view_count, +            'like_count': like_count, +            'dislike_count': dislike_count, +            'formats': formats, +        } diff --git a/youtube_dl/options.py b/youtube_dl/options.py index 35c7e5fb3..8e80e3759 100644 --- a/youtube_dl/options.py +++ b/youtube_dl/options.py @@ -13,6 +13,7 @@ from .compat import (      compat_kwargs,  )  from .utils import ( +    preferredencoding,      write_string,  )  from .version import __version__ @@ -797,7 +798,7 @@ def parseOpts(overrideArguments=None):          # Workaround for Python 2.x, where argv is a byte list          if sys.version_info < (3,):              command_line_conf = [ -                a.decode('utf-8', 'replace') for a in command_line_conf] +                a.decode(preferredencoding(), 'replace') for a in command_line_conf]          if '--ignore-config' in command_line_conf:              system_conf = [] diff --git a/youtube_dl/postprocessor/ffmpeg.py b/youtube_dl/postprocessor/ffmpeg.py index 55adf9685..0b60ac7e7 100644 --- a/youtube_dl/postprocessor/ffmpeg.py +++ b/youtube_dl/postprocessor/ffmpeg.py @@ -117,6 +117,10 @@ class FFmpegPostProcessor(PostProcessor):          return self._paths[self.basename]      @property +    def probe_available(self): +        return self.probe_basename is not None + +    @property      def probe_executable(self):          return self._paths[self.probe_basename] @@ -168,7 +172,7 @@ class FFmpegExtractAudioPP(FFmpegPostProcessor):      def get_audio_codec(self, path): -        if not self.probe_executable: +        if not self.probe_available:              raise PostProcessingError('ffprobe or avprobe not found. Please install one.')          try:              cmd = [ | 
