]> git.bitcoin.ninja Git - youtube-dl/commitdiff
VineIE: extract more information and minor style changes
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Mon, 20 May 2013 06:31:03 +0000 (08:31 +0200)
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Mon, 20 May 2013 06:31:03 +0000 (08:31 +0200)
test/tests.json
youtube_dl/InfoExtractors.py

index 19505155637adf9080815c54030b2212f55266ac..1ff9ad7ee00a267076cd939dd1de4cfd59cc6be7 100644 (file)
     "file": "b9KOOWX7HUx.mp4",
     "md5": "2f36fed6235b16da96ce9b4dc890940d",
     "info_dict":{
-      "title":"Chicken."
+      "title": "Chicken.",
+      "uploader": "Jack Dorsey"
     }
   }
 ]
index 551969a2e75f5aa3f56a2a2db963dea9f25a17cd..64726e698e9d6762e4452577e435ea4ac569eb50 100755 (executable)
@@ -4116,21 +4116,35 @@ class VineIE(InfoExtractor):
         webpage_url = 'https://vine.co/v/' + video_id
         webpage = self._download_webpage(webpage_url, video_id)
 
-        mobj = re.search(r'<meta property="twitter:player:stream" content="([^"]+)"', webpage)
+        self.report_extraction(video_id)
+
+        mobj = re.search(r'<meta property="twitter:player:stream" content="(.+?)"', webpage)
         if mobj is None:
             raise ExtractorError(u'Unable to extract video URL')
         video_url = mobj.group(1)
 
-        mobj = re.search(r'<meta property="og:title" content="([^"]+)"', webpage)
+        mobj = re.search(r'<meta property="og:title" content="(.+?)"', webpage)
         if mobj is None:
             raise ExtractorError(u'Unable to extract title')
         video_title = mobj.group(1)
 
+        mobj = re.search(r'<meta property="og:image" content="(.+?)(\?.*?)?"', webpage)
+        if mobj is None:
+            raise ExtractorError(u'Unable to extract thumbnail')
+        thumbnail = mobj.group(1)
+
+        mobj = re.search(r'<div class="user">.*?<h2>(.+?)</h2>', webpage, re.DOTALL)
+        if mobj is None:
+            raise ExtractorError(u'Unable to extract uploader')
+        uploader = mobj.group(1)
+
         return [{
-            'id':       video_id,
-            'url':      video_url,
-            'ext':      'mp4',
-            'title':    video_title,
+            'id':        video_id,
+            'url':       video_url,
+            'ext':       'mp4',
+            'title':     video_title,
+            'thumbnail': thumbnail,
+            'uploader':  uploader,
         }]
 
 def gen_extractors():