X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Fadobetv.py;h=008c98e51ead3ffcad7bb350fcf928a945b91e35;hb=ec85ded83cbfa652ba94cb080aab52d8b270212a;hp=d0bfafa454f4c117daf8e96e8eefc2045b7ebbbe;hpb=9a605c8859e5ecf164719b890ea62b76afb0b874;p=youtube-dl diff --git a/youtube_dl/extractor/adobetv.py b/youtube_dl/extractor/adobetv.py index d0bfafa45..008c98e51 100644 --- a/youtube_dl/extractor/adobetv.py +++ b/youtube_dl/extractor/adobetv.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals import re from .common import InfoExtractor +from ..compat import compat_str from ..utils import ( parse_duration, unified_strdate, @@ -14,7 +15,11 @@ from ..utils import ( ) -class AdobeTVIE(InfoExtractor): +class AdobeTVBaseIE(InfoExtractor): + _API_BASE_URL = 'http://tv.adobe.com/api/v4/' + + +class AdobeTVIE(AdobeTVBaseIE): _VALID_URL = r'https?://tv\.adobe\.com/(?:(?Pfr|de|es|jp)/)?watch/(?P[^/]+)/(?P[^/]+)' _TEST = { @@ -25,7 +30,7 @@ class AdobeTVIE(InfoExtractor): 'ext': 'mp4', 'title': 'Quick Tip - How to Draw a Circle Around an Object in Photoshop', 'description': 'md5:99ec318dc909d7ba2a1f2b038f7d2311', - 'thumbnail': 're:https?://.*\.jpg$', + 'thumbnail': r're:https?://.*\.jpg$', 'upload_date': '20110914', 'duration': 60, 'view_count': int, @@ -38,7 +43,7 @@ class AdobeTVIE(InfoExtractor): language = 'en' video_data = self._download_json( - 'http://tv.adobe.com/api/v4/episode/get/?language=%s&show_urlname=%s&urlname=%s&disclosure=standard' % (language, show_urlname, urlname), + self._API_BASE_URL + 'episode/get/?language=%s&show_urlname=%s&urlname=%s&disclosure=standard' % (language, show_urlname, urlname), urlname)['data'][0] formats = [{ @@ -51,7 +56,7 @@ class AdobeTVIE(InfoExtractor): self._sort_formats(formats) return { - 'id': str(video_data['id']), + 'id': compat_str(video_data['id']), 'title': video_data['title'], 'description': video_data.get('description'), 'thumbnail': video_data.get('thumbnail'), @@ -62,7 +67,7 @@ class AdobeTVIE(InfoExtractor): } -class AdobeTVPlaylistBaseIE(InfoExtractor): +class AdobeTVPlaylistBaseIE(AdobeTVBaseIE): def _parse_page_data(self, page_data): return [self.url_result(self._get_element_url(element_data)) for element_data in page_data] @@ -97,12 +102,11 @@ class AdobeTVShowIE(AdobeTVPlaylistBaseIE): language = 'en' query = 'language=%s&show_urlname=%s' % (language, show_urlname) - show_data = self._download_json( - 'http://tv.adobe.com/api/v4/show/get/?%s' % query, show_urlname)['data'][0] + show_data = self._download_json(self._API_BASE_URL + 'show/get/?%s' % query, show_urlname)['data'][0] return self.playlist_result( - self._extract_playlist_entries('http://tv.adobe.com/api/v4/episode/?%s' % query, show_urlname), - str(show_data['id']), + self._extract_playlist_entries(self._API_BASE_URL + 'episode/?%s' % query, show_urlname), + compat_str(show_data['id']), show_data['show_name'], show_data['show_description']) @@ -130,7 +134,7 @@ class AdobeTVChannelIE(AdobeTVPlaylistBaseIE): query += '&category_urlname=%s' % category_urlname return self.playlist_result( - self._extract_playlist_entries('http://tv.adobe.com/api/v4/show/?%s' % query, channel_urlname), + self._extract_playlist_entries(self._API_BASE_URL + 'show/?%s' % query, channel_urlname), channel_urlname) @@ -152,7 +156,10 @@ class AdobeTVVideoIE(InfoExtractor): def _real_extract(self, url): video_id = self._match_id(url) - video_data = self._download_json(url + '?format=json', video_id) + webpage = self._download_webpage(url, video_id) + + video_data = self._parse_json(self._search_regex( + r'var\s+bridge\s*=\s*([^;]+);', webpage, 'bridged data'), video_id) formats = [{ 'format_id': '%s-%s' % (determine_ext(source['src']), source.get('height')),