]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/firstpost.py
0993af1c9455cf6bc2189f1a15b6fd6f0066ae36
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
8 class FirstpostIE(InfoExtractor
):
9 _VALID_URL
= r
'http://(?:www\.)?firstpost\.com/[^/]+/.*-(?P<id>[0-9]+)\.html'
12 'url': 'http://www.firstpost.com/india/india-to-launch-indigenous-aircraft-carrier-monday-1025403.html',
13 'md5': 'ee9114957692f01fb1263ed87039112a',
17 'title': 'India to launch indigenous aircraft carrier INS Vikrant today',
18 'description': 'md5:feef3041cb09724e0bdc02843348f5f4',
22 def _real_extract(self
, url
):
23 mobj
= re
.match(self
._VALID
_URL
, url
)
24 video_id
= mobj
.group('id')
26 page
= self
._download
_webpage
(url
, video_id
)
27 title
= self
._html
_search
_meta
('twitter:title', page
, 'title')
28 description
= self
._html
_search
_meta
('twitter:description', page
, 'title')
30 data
= self
._download
_xml
(
31 'http://www.firstpost.com/getvideoxml-%s.xml' % video_id
, video_id
,
32 'Downloading video XML')
34 item
= data
.find('./playlist/item')
35 thumbnail
= item
.find('./image').text
39 'url': details
.find('./file').text
,
40 'format_id': details
.find('./label').text
.strip(),
41 'width': int(details
.find('./width').text
.strip()),
42 'height': int(details
.find('./height').text
.strip()),
43 } for details
in item
.findall('./source/file_details') if details
.find('./file').text
49 'description': description
,
50 'thumbnail': thumbnail
,