projects
/
youtube-dl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[README.md] Make download URLs consistent
[youtube-dl]
/
youtube_dl
/
extractor
/
firstpost.py
diff --git
a/youtube_dl/extractor/firstpost.py
b/youtube_dl/extractor/firstpost.py
index 0993af1c9455cf6bc2189f1a15b6fd6f0066ae36..e8936cb2468f78bd2c1b59008a13e9411204380e 100644
(file)
--- a/
youtube_dl/extractor/firstpost.py
+++ b/
youtube_dl/extractor/firstpost.py
@@
-1,12
+1,10
@@
from __future__ import unicode_literals
from __future__ import unicode_literals
-import re
-
from .common import InfoExtractor
class FirstpostIE(InfoExtractor):
from .common import InfoExtractor
class FirstpostIE(InfoExtractor):
- _VALID_URL = r'http://(?:www\.)?firstpost\.com/[^/]+/.*-(?P<id>[0-9]+)\.html'
+ _VALID_URL = r'http
s?
://(?:www\.)?firstpost\.com/[^/]+/.*-(?P<id>[0-9]+)\.html'
_TEST = {
'url': 'http://www.firstpost.com/india/india-to-launch-indigenous-aircraft-carrier-monday-1025403.html',
_TEST = {
'url': 'http://www.firstpost.com/india/india-to-launch-indigenous-aircraft-carrier-monday-1025403.html',
@@
-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 = mobj.group('id')
-
+ video_id = self._match_id(url)
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')
data = self._download_xml(
description = self._html_search_meta('twitter:description', page, 'title')
data = self._download_xml(
@@
-42,6
+39,7
@@
class FirstpostIE(InfoExtractor):
'height': int(details.find('./height').text.strip()),
} for details in item.findall('./source/file_details') if details.find('./file').text
]
'height': int(details.find('./height').text.strip()),
} for details in item.findall('./source/file_details') if details.find('./file').text
]
+ self._sort_formats(formats)
return {
'id': video_id,
return {
'id': video_id,