1 from __future__ import unicode_literals
5 from .common import InfoExtractor
17 class AdobeTVIE(InfoExtractor):
18 _VALID_URL = r'https?://tv\.adobe\.com/(?:(?P<language>fr|de|es|jp)/)?watch/(?P<show_urlname>[^/]+)/(?P<id>[^/]+)'
21 'url': 'http://tv.adobe.com/watch/the-complete-picture-with-julieanne-kost/quick-tip-how-to-draw-a-circle-around-an-object-in-photoshop/',
22 'md5': '9bc5727bcdd55251f35ad311ca74fa1e',
26 'title': 'Quick Tip - How to Draw a Circle Around an Object in Photoshop',
27 'description': 'md5:99ec318dc909d7ba2a1f2b038f7d2311',
28 'thumbnail': 're:https?://.*\.jpg$',
29 'upload_date': '20110914',
35 def _real_extract(self, url):
36 language, show_urlname, urlname = re.match(self._VALID_URL, url).groups()
40 video_data = self._download_json(
41 'http://tv.adobe.com/api/v4/episode/get/?language=%s&show_urlname=%s&urlname=%s&disclosure=standard' % (language, show_urlname, urlname),
46 'format_id': source.get('quality_level') or source['url'].split('-')[-1].split('.')[0] or None,
47 'width': int_or_none(source.get('width')),
48 'height': int_or_none(source.get('height')),
49 'tbr': int_or_none(source.get('video_data_rate')),
50 } for source in video_data['videos']]
51 self._sort_formats(formats)
54 'id': str(video_data['id']),
55 'title': video_data['title'],
56 'description': video_data.get('description'),
57 'thumbnail': video_data.get('thumbnail'),
58 'upload_date': unified_strdate(video_data.get('start_date')),
59 'duration': parse_duration(video_data.get('duration')),
60 'view_count': str_to_int(video_data.get('playcount')),
65 class AdobeTVVideoIE(InfoExtractor):
66 _VALID_URL = r'https?://video\.tv\.adobe\.com/v/(?P<id>\d+)'
69 # From https://helpx.adobe.com/acrobat/how-to/new-experience-acrobat-dc.html?set=acrobat--get-started--essential-beginners
70 'url': 'https://video.tv.adobe.com/v/2456/',
71 'md5': '43662b577c018ad707a63766462b1e87',
75 'title': 'New experience with Acrobat DC',
76 'description': 'New experience with Acrobat DC',
81 def _real_extract(self, url):
82 video_id = self._match_id(url)
83 video_data = self._download_json(url + '?format=json', video_id)
86 'format_id': '%s-%s' % (determine_ext(source['src']), source.get('height')),
88 'width': int_or_none(source.get('width')),
89 'height': int_or_none(source.get('height')),
90 'tbr': int_or_none(source.get('bitrate')),
91 } for source in video_data['sources']]
92 self._sort_formats(formats)
94 # For both metadata and downloaded files the duration varies among
95 # formats. I just pick the max one
96 duration = max(filter(None, [
97 float_or_none(source.get('duration'), scale=1000)
98 for source in video_data['sources']]))
101 for translation in video_data.get('translations', []):
102 lang_id = translation.get('language_w3c') or ISO639Utils.long2short(translation['language_medium'])
103 if lang_id not in subtitles:
104 subtitles[lang_id] = []
105 subtitles[lang_id].append({
106 'url': translation['vttPath'],
113 'title': video_data['title'],
114 'description': video_data.get('description'),
115 'thumbnail': video_data['video'].get('poster'),
116 'duration': duration,
117 'subtitles': subtitles,