]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/adobetv.py
5e43adc51f98c2f22e728c49150b84ae64f704e3
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 # From https://helpx.adobe.com/acrobat/how-to/new-experience-acrobat-dc.html?set=acrobat--get-started--essential-beginners
81 'url': 'https://video.tv.adobe.com/v/2456/',
82 'md5': '43662b577c018ad707a63766462b1e87',
86 'title': 'New experience with Acrobat DC',
87 'description': 'New experience with Acrobat DC',
92 def _real_extract(self
, url
):
93 video_id
= self
._match
_id
(url
)
95 webpage
= self
._download
_webpage
(url
, video_id
)
97 player_params
= self
._parse
_json
(self
._search
_regex
(
98 r
'var\s+bridge\s*=\s*([^;]+);', webpage
, 'player parameters'),
102 'url': source
['src'],
103 'width': source
.get('width'),
104 'height': source
.get('height'),
105 'tbr': source
.get('bitrate'),
106 } for source
in player_params
['sources']]
108 # For both metadata and downloaded files the duration varies among
109 # formats. I just pick the max one
110 duration
= max(filter(None, [
111 float_or_none(source
.get('duration'), scale
=1000)
112 for source
in player_params
['sources']]))
115 for translation
in player_params
.get('translations', []):
116 lang_id
= translation
.get('language_w3c') or ISO639Utils
.long2short(translation
['language_medium'])
117 if lang_id
not in subtitles
:
118 subtitles
[lang_id
] = []
119 subtitles
[lang_id
].append({
120 'url': translation
['vttPath'],
127 'title': player_params
['title'],
128 'description': self
._og
_search
_description
(webpage
),
129 'duration': duration
,
130 'subtitles': subtitles
,