summary refs log tree commit diff
diff options
context:
space:
mode:
authorAnna Bernardi <anna.bernardi.9@gmail.com>2013-05-20 00:25:26 +0200
committerFilippo Valsorda <filippo.valsorda@gmail.com>2013-05-20 00:33:14 +0200
commit5b0d3cc0cd10c737df20d87aa5842d18549c3c4c (patch)
tree2f33570b2ccd36dda1fbee4e3810c6e90e8e0c51
parentd4f76f1674c5fd6d5714a7500bc119b4b230f2b2 (diff)
downloadyoutube-dl-5b0d3cc0cd10c737df20d87aa5842d18549c3c4c.tar.gz
youtube-dl-5b0d3cc0cd10c737df20d87aa5842d18549c3c4c.tar.xz
youtube-dl-5b0d3cc0cd10c737df20d87aa5842d18549c3c4c.zip
Add support for Vine - closes #845
-rw-r--r--test/tests.json9
-rwxr-xr-xyoutube_dl/InfoExtractors.py34
2 files changed, 41 insertions, 2 deletions
diff --git a/test/tests.json b/test/tests.json
index 740f7756c..195051556 100644
--- a/test/tests.json
+++ b/test/tests.json
@@ -451,5 +451,14 @@
       "title":"How to Tie a Square Knot Properly",
       "description":"The square knot, also known as the reef knot, is one of the oldest, most basic knots to tie, and can be used in many different ways. Here's the proper way to tie a square knot."
     }
+  },
+  {
+    "name": "Vine",
+    "url": "https://vine.co/v/b9KOOWX7HUx",
+    "file": "b9KOOWX7HUx.mp4",
+    "md5": "2f36fed6235b16da96ce9b4dc890940d",
+    "info_dict":{
+      "title":"Chicken."
+    }
   }
 ]
diff --git a/youtube_dl/InfoExtractors.py b/youtube_dl/InfoExtractors.py
index 938d2d805..551969a2e 100755
--- a/youtube_dl/InfoExtractors.py
+++ b/youtube_dl/InfoExtractors.py
@@ -4069,8 +4069,8 @@ class InaIE(InfoExtractor):
         }]
 
 class HowcastIE(InfoExtractor):
-    """Information Extractor for Ina.fr"""
-    _VALID_URL = r'(?:https?://)?(?:www\.)?howcast\.com/videos/(?P<id>[\d]+)'
+    """Information Extractor for Howcast.com"""
+    _VALID_URL = r'(?:https?://)?(?:www\.)?howcast\.com/videos/(?P<id>\d+)'
 
     def _real_extract(self, url):
         mobj = re.match(self._VALID_URL, url)
@@ -4104,6 +4104,35 @@ class HowcastIE(InfoExtractor):
             'description': video_description,
         }]
 
+class VineIE(InfoExtractor):
+    """Information Extractor for Vine.co"""
+    _VALID_URL = r'(?:https?://)?(?:www\.)?vine\.co/v/(?P<id>\w+)'
+
+    def _real_extract(self, url):
+
+        mobj = re.match(self._VALID_URL, url)
+
+        video_id = mobj.group('id')
+        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)
+        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)
+        if mobj is None:
+            raise ExtractorError(u'Unable to extract title')
+        video_title = mobj.group(1)
+
+        return [{
+            'id':       video_id,
+            'url':      video_url,
+            'ext':      'mp4',
+            'title':    video_title,
+        }]
+
 def gen_extractors():
     """ Return a list of an instance of every supported extractor.
     The order does matter; the first extractor matched is the one handling the URL.
@@ -4162,6 +4191,7 @@ def gen_extractors():
         RedTubeIE(),
         InaIE(),
         HowcastIE(),
+        VineIE(),
         GenericIE()
     ]