diff options
| author | Sergey M․ <dstftw@gmail.com> | 2016-06-30 23:20:44 +0700 | 
|---|---|---|
| committer | Sergey M․ <dstftw@gmail.com> | 2016-06-30 23:20:44 +0700 | 
| commit | fd94e2671a8b2174d38f9e81b0956e31f90df326 (patch) | |
| tree | 93fd3833e57cf2f5c4e8543325d721a5e7657312 /youtube_dl/extractor/meta.py | |
| parent | 8ff6697861b918ff9221c7dd46a6e1109ad0ef34 (diff) | |
[meta] Add support for pladform embeds
Diffstat (limited to 'youtube_dl/extractor/meta.py')
| -rw-r--r-- | youtube_dl/extractor/meta.py | 62 | 
1 files changed, 37 insertions, 25 deletions
| diff --git a/youtube_dl/extractor/meta.py b/youtube_dl/extractor/meta.py index 2e2db5620..42bedc48f 100644 --- a/youtube_dl/extractor/meta.py +++ b/youtube_dl/extractor/meta.py @@ -2,6 +2,7 @@  from __future__ import unicode_literals  from .common import InfoExtractor +from .pladform import PladformIE  from ..utils import (      unescapeHTML,      int_or_none, @@ -27,34 +28,45 @@ class METAIE(InfoExtractor):      }, {          'url': 'http://video.meta.ua/iframe/5502115',          'only_matching': True, +    }, { +        # pladform embed +        'url': 'http://video.meta.ua/7121015.video', +        'only_matching': True,      }]      def _real_extract(self, url):          video_id = self._match_id(url)          webpage = self._download_webpage(url, video_id) -        st_html5 = self._search_regex(r"st_html5\s*=\s*'#([^']+)'", webpage, 'uppod html5 st') -        json_str = '' -        for i in range(0, len(st_html5), 3): -            json_str += '�%s;' % st_html5[i:i + 3] -        uppod_data = self._parse_json(unescapeHTML(json_str), video_id) -        error = uppod_data.get('customnotfound') -        if error: -            raise ExtractorError('%s said: %s' % (self.IE_NAME, error), expected=True) - -        video_url = uppod_data['file'] -        info = { -            'id': video_id, -            'url': video_url, -            'title': uppod_data.get('comment') or self._og_search_title(webpage), -            'description': self._og_search_description(webpage, default=None), -            'thumbnail': uppod_data.get('poster') or self._og_search_thumbnail(webpage), -            'duration': int_or_none(self._og_search_property( -                'video:duration', webpage, default=None)), -        } -        if 'youtube.com/' in video_url: -            info.update({ -                '_type': 'url_transparent', -                'ie_key': 'Youtube', -            }) -        return info +        st_html5 = self._search_regex( +            r"st_html5\s*=\s*'#([^']+)'", webpage, 'uppod html5 st', default=None) + +        if st_html5: +            json_str = '' +            for i in range(0, len(st_html5), 3): +                json_str += '�%s;' % st_html5[i:i + 3] +            uppod_data = self._parse_json(unescapeHTML(json_str), video_id) +            error = uppod_data.get('customnotfound') +            if error: +                raise ExtractorError('%s said: %s' % (self.IE_NAME, error), expected=True) + +            video_url = uppod_data['file'] +            info = { +                'id': video_id, +                'url': video_url, +                'title': uppod_data.get('comment') or self._og_search_title(webpage), +                'description': self._og_search_description(webpage, default=None), +                'thumbnail': uppod_data.get('poster') or self._og_search_thumbnail(webpage), +                'duration': int_or_none(self._og_search_property( +                    'video:duration', webpage, default=None)), +            } +            if 'youtube.com/' in video_url: +                info.update({ +                    '_type': 'url_transparent', +                    'ie_key': 'Youtube', +                }) +            return info + +        pladform_url = PladformIE._extract_url(webpage) +        if pladform_url: +            return self.url_result(pladform_url) | 
