mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-25 11:41:52 +00:00
[firstpost] Modernize
This commit is contained in:
parent
bf8f082a90
commit
c0e1a415fd
1 changed files with 4 additions and 6 deletions
|
@ -1,7 +1,5 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,11 +18,10 @@ class FirstpostIE(InfoExtractor):
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
video_id = self._match_id(url)
|
||||||
video_id = mobj.group('id')
|
|
||||||
|
|
||||||
page = self._download_webpage(url, video_id)
|
page = self._download_webpage(url, video_id)
|
||||||
title = self._html_search_meta('twitter:title', page, 'title')
|
|
||||||
|
title = self._html_search_meta('twitter:title', page, 'title', fatal=True)
|
||||||
description = self._html_search_meta('twitter:description', page, 'title')
|
description = self._html_search_meta('twitter:description', page, 'title')
|
||||||
|
|
||||||
data = self._download_xml(
|
data = self._download_xml(
|
||||||
|
@ -42,6 +39,7 @@ class FirstpostIE(InfoExtractor):
|
||||||
'height': int(details.find('./height').text.strip()),
|
'height': int(details.find('./height').text.strip()),
|
||||||
} for details in item.findall('./source/file_details') if details.find('./file').text
|
} for details in item.findall('./source/file_details') if details.find('./file').text
|
||||||
]
|
]
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
|
Loading…
Reference in a new issue