]> Raphaƫl G. Git Repositories - youtubedl/blobdiff - youtube_dl/extractor/firstpost.py
debian/changelog: Annotate bugs to close.
[youtubedl] / youtube_dl / extractor / firstpost.py
index eccd8dde9e007583b9f73f63df45a38b89c21286..298227d5793770c82d8868256d655fa7ea3dc31c 100644 (file)
@@ -1,7 +1,5 @@
 from __future__ import unicode_literals
 
 from __future__ import unicode_literals
 
-import re
-
 from .common import InfoExtractor
 
 
 from .common import InfoExtractor
 
 
@@ -15,12 +13,16 @@ class FirstpostIE(InfoExtractor):
             'id': '1025403',
             'ext': 'mp4',
             'title': 'India to launch indigenous aircraft carrier INS Vikrant today',
             'id': '1025403',
             'ext': 'mp4',
             'title': 'India to launch indigenous aircraft carrier INS Vikrant today',
+            'description': 'md5:feef3041cb09724e0bdc02843348f5f4',
         }
     }
 
     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)
+
+        title = self._html_search_meta('twitter:title', page, 'title', fatal=True)
+        description = self._html_search_meta('twitter:description', page, 'title')
 
         data = self._download_xml(
             'http://www.firstpost.com/getvideoxml-%s.xml' % video_id, video_id,
 
         data = self._download_xml(
             'http://www.firstpost.com/getvideoxml-%s.xml' % video_id, video_id,
@@ -28,7 +30,6 @@ class FirstpostIE(InfoExtractor):
 
         item = data.find('./playlist/item')
         thumbnail = item.find('./image').text
 
         item = data.find('./playlist/item')
         thumbnail = item.find('./image').text
-        title = item.find('./title').text
 
         formats = [
             {
 
         formats = [
             {
@@ -38,10 +39,12 @@ 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,
             'title': title,
 
         return {
             'id': video_id,
             'title': title,
+            'description': description,
             'thumbnail': thumbnail,
             'formats': formats,
         }
             'thumbnail': thumbnail,
             'formats': formats,
         }