]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/firstpost.py
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',
21 def _real_extract(self
, url
):
22 mobj
= re
.match(self
._VALID
_URL
, url
)
23 video_id
= mobj
.group('id')
25 data
= self
._download
_xml
(
26 'http://www.firstpost.com/getvideoxml-%s.xml' % video_id
, video_id
,
27 'Downloading video XML')
29 item
= data
.find('./playlist/item')
30 thumbnail
= item
.find('./image').text
31 title
= item
.find('./title').text
35 'url': details
.find('./file').text
,
36 'format_id': details
.find('./label').text
.strip(),
37 'width': int(details
.find('./width').text
.strip()),
38 'height': int(details
.find('./height').text
.strip()),
39 } for details
in item
.findall('./source/file_details') if details
.find('./file').text
45 'thumbnail': thumbnail
,