1 from __future__ import unicode_literals
3 from .common import InfoExtractor
13 class AdobeTVIE(InfoExtractor):
14 _VALID_URL = r'https?://tv\.adobe\.com/watch/[^/]+/(?P<id>[^/]+)'
17 'url': 'http://tv.adobe.com/watch/the-complete-picture-with-julieanne-kost/quick-tip-how-to-draw-a-circle-around-an-object-in-photoshop/',
18 'md5': '9bc5727bcdd55251f35ad311ca74fa1e',
20 'id': 'quick-tip-how-to-draw-a-circle-around-an-object-in-photoshop',
22 'title': 'Quick Tip - How to Draw a Circle Around an Object in Photoshop',
23 'description': 'md5:99ec318dc909d7ba2a1f2b038f7d2311',
24 'thumbnail': 're:https?://.*\.jpg$',
25 'upload_date': '20110914',
31 def _real_extract(self, url):
32 video_id = self._match_id(url)
33 webpage = self._download_webpage(url, video_id)
35 player = self._parse_json(
36 self._search_regex(r'html5player:\s*({.+?})\s*\n', webpage, 'player'),
39 title = player.get('title') or self._search_regex(
40 r'data-title="([^"]+)"', webpage, 'title')
41 description = self._og_search_description(webpage)
42 thumbnail = self._og_search_thumbnail(webpage)
44 upload_date = unified_strdate(
45 self._html_search_meta('datepublished', webpage, 'upload date'))
47 duration = parse_duration(
48 self._html_search_meta('duration', webpage, 'duration') or
50 r'Runtime:\s*(\d{2}:\d{2}:\d{2})',
51 webpage, 'duration', fatal=False))
53 view_count = str_to_int(self._search_regex(
54 r'<div class="views">\s*Views?:\s*([\d,.]+)\s*</div>',
55 webpage, 'view count'))
59 'format_id': source.get('quality') or source['src'].split('-')[-1].split('.')[0] or None,
60 'tbr': source.get('bitrate'),
61 } for source in player['sources']]
62 self._sort_formats(formats)
67 'description': description,
68 'thumbnail': thumbnail,
69 'upload_date': upload_date,
71 'view_count': view_count,
76 class AdobeTVVideoIE(InfoExtractor):
77 _VALID_URL = r'https?://video\.tv\.adobe\.com/v/(?P<id>\d+)'
80 'url': 'https://video.tv.adobe.com/v/2456/',
81 'md5': '43662b577c018ad707a63766462b1e87',
85 'title': 'New experience with Acrobat DC',
86 'description': 'New experience with Acrobat DC',
91 def _real_extract(self, url):
92 video_id = self._match_id(url)
94 webpage = self._download_webpage(url, video_id)
96 player_params = self._parse_json(self._search_regex(
97 r'var\s+bridge\s*=\s*([^;]+);', webpage, 'player parameters'),
101 'url': source['src'],
102 'width': source.get('width'),
103 'height': source.get('height'),
104 'tbr': source.get('bitrate'),
105 } for source in player_params['sources']]
107 # For both metadata and downloaded files the duration varies among
108 # formats. I just pick the max one
109 duration = max(filter(None, [
110 float_or_none(source.get('duration'), scale=1000)
111 for source in player_params['sources']]))
114 for translation in player_params.get('translations', []):
115 lang_id = translation.get('language_w3c') or ISO639Utils.long2short(translation['language_medium'])
116 if lang_id not in subtitles:
117 subtitles[lang_id] = []
118 subtitles[lang_id].append({
119 'url': translation['vttPath'],
126 'title': player_params['title'],
127 'description': self._og_search_description(webpage),
128 'duration': duration,
129 'subtitles': subtitles,