about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2015-02-10 05:28:48 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2015-02-10 05:28:48 +0100
commitc0e1a415fdcd8d36d98a9fb6ff5bf9146004ddd3 (patch)
treed700ad97e271293c199617ef7d3c3978e432c7c3
parentbf8f082a90f4396a0a70464b55bf5c11fdb36c47 (diff)
downloadyoutube-dl-c0e1a415fdcd8d36d98a9fb6ff5bf9146004ddd3.tar.gz
youtube-dl-c0e1a415fdcd8d36d98a9fb6ff5bf9146004ddd3.tar.xz
youtube-dl-c0e1a415fdcd8d36d98a9fb6ff5bf9146004ddd3.zip
[firstpost] Modernize
-rw-r--r--youtube_dl/extractor/firstpost.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/youtube_dl/extractor/firstpost.py b/youtube_dl/extractor/firstpost.py
index 0993af1c9..298227d57 100644
--- a/youtube_dl/extractor/firstpost.py
+++ b/youtube_dl/extractor/firstpost.py
@@ -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,