]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[firstpost] Modernize
authorPhilipp Hagemeister <phihag@phihag.de>
Tue, 10 Feb 2015 04:28:48 +0000 (05:28 +0100)
committerPhilipp Hagemeister <phihag@phihag.de>
Tue, 10 Feb 2015 04:28:48 +0000 (05:28 +0100)
youtube_dl/extractor/firstpost.py

index 0993af1c9455cf6bc2189f1a15b6fd6f0066ae36..298227d5793770c82d8868256d655fa7ea3dc31c 100644 (file)
@@ -1,7 +1,5 @@
 from __future__ import unicode_literals
 
-import re
-
 from .common import InfoExtractor
 
 
@@ -20,11 +18,10 @@ class FirstpostIE(InfoExtractor):
     }
 
     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)
-        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(
@@ -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
         ]
+        self._sort_formats(formats)
 
         return {
             'id': video_id,