mirror of
https://github.com/l1ving/youtube-dl
synced 2024-11-21 00:33:01 +08:00
[firstpost] Fix extraction
This commit is contained in:
parent
0d3070d364
commit
6a4f3528c8
@ -6,7 +6,6 @@ from .common import InfoExtractor
|
|||||||
|
|
||||||
|
|
||||||
class FirstpostIE(InfoExtractor):
|
class FirstpostIE(InfoExtractor):
|
||||||
IE_NAME = 'Firstpost.com'
|
|
||||||
_VALID_URL = r'http://(?:www\.)?firstpost\.com/[^/]+/.*-(?P<id>[0-9]+)\.html'
|
_VALID_URL = r'http://(?:www\.)?firstpost\.com/[^/]+/.*-(?P<id>[0-9]+)\.html'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
@ -16,7 +15,6 @@ class FirstpostIE(InfoExtractor):
|
|||||||
'id': '1025403',
|
'id': '1025403',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'India to launch indigenous aircraft carrier INS Vikrant today',
|
'title': 'India to launch indigenous aircraft carrier INS Vikrant today',
|
||||||
'description': 'Its flight deck is over twice the size of a football field, its power unit can light up the entire Kochi city and the cabling is enough to cover the distance between here to Delhi.',
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,15 +22,26 @@ class FirstpostIE(InfoExtractor):
|
|||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
video_id = mobj.group('id')
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
webpage = self._download_webpage(url, video_id)
|
data = self._download_xml(
|
||||||
video_url = self._html_search_regex(
|
'http://www.firstpost.com/getvideoxml-%s.xml' % video_id, video_id,
|
||||||
r'<div.*?name="div_video".*?flashvars="([^"]+)">',
|
'Downloading video XML')
|
||||||
webpage, 'video URL')
|
|
||||||
|
item = data.find('./playlist/item')
|
||||||
|
thumbnail = item.find('./image').text
|
||||||
|
title = item.find('./title').text
|
||||||
|
|
||||||
|
formats = [
|
||||||
|
{
|
||||||
|
'url': details.find('./file').text,
|
||||||
|
'format_id': details.find('./label').text.strip(),
|
||||||
|
'width': int(details.find('./width').text.strip()),
|
||||||
|
'height': int(details.find('./height').text.strip()),
|
||||||
|
} for details in item.findall('./source/file_details') if details.find('./file').text
|
||||||
|
]
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'url': video_url,
|
'title': title,
|
||||||
'title': self._og_search_title(webpage),
|
'thumbnail': thumbnail,
|
||||||
'description': self._og_search_description(webpage),
|
'formats': formats,
|
||||||
'thumbnail': self._og_search_thumbnail(webpage),
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user