]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/usatoday.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
6 get_element_by_attribute
,
11 from ..compat
import compat_str
14 class USATodayIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://(?:www\.)?usatoday\.com/(?:[^/]+/)*(?P<id>[^?/#]+)'
17 'url': 'http://www.usatoday.com/media/cinematic/video/81729424/us-france-warn-syrian-regime-ahead-of-new-peace-talks/',
18 'md5': '4d40974481fa3475f8bccfd20c5361f8',
22 'title': 'US, France warn Syrian regime ahead of new peace talks',
23 'timestamp': 1457891045,
24 'description': 'md5:7e50464fdf2126b0f533748d3c78d58f',
25 'uploader_id': '29906170001',
26 'upload_date': '20160313',
29 BRIGHTCOVE_URL_TEMPLATE
= 'http://players.brightcove.net/29906170001/38a9eecc-bdd8-42a3-ba14-95397e48b3f8_default/index.html?videoId=%s'
31 def _real_extract(self
, url
):
32 display_id
= self
._match
_id
(url
)
33 webpage
= self
._download
_webpage
(update_url_query(url
, {'ajax': 'true'}), display_id
)
34 ui_video_data
= get_element_by_attribute('class', 'ui-video-data', webpage
)
36 raise ExtractorError('no video on the webpage', expected
=True)
37 video_data
= self
._parse
_json
(ui_video_data
, display_id
)
40 '_type': 'url_transparent',
41 'url': self
.BRIGHTCOVE_URL_TEMPLATE
% video_data
['brightcove_id'],
42 'id': compat_str(video_data
['id']),
43 'title': video_data
['title'],
44 'thumbnail': video_data
.get('thumbnail'),
45 'description': video_data
.get('description'),
46 'duration': parse_duration(video_data
.get('length')),
47 'ie_key': 'BrightcoveNew',