]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/vine.py
Update changelog.
[youtubedl] / youtube_dl / extractor / vine.py
1 from __future__ import unicode_literals
2
3 import re
4
5 from .common import InfoExtractor
6
7
8 class VineIE(InfoExtractor):
9 _VALID_URL = r'https?://(?:www\.)?vine\.co/v/(?P<id>\w+)'
10 _TEST = {
11 'url': 'https://vine.co/v/b9KOOWX7HUx',
12 'md5': '2f36fed6235b16da96ce9b4dc890940d',
13 'info_dict': {
14 'id': 'b9KOOWX7HUx',
15 'ext': 'mp4',
16 'uploader': 'Jack Dorsey',
17 'title': 'Chicken.',
18 },
19 }
20
21 def _real_extract(self, url):
22 mobj = re.match(self._VALID_URL, url)
23
24 video_id = mobj.group('id')
25 webpage_url = 'https://vine.co/v/' + video_id
26 webpage = self._download_webpage(webpage_url, video_id)
27
28 self.report_extraction(video_id)
29
30 video_url = self._html_search_meta('twitter:player:stream', webpage,
31 'video URL')
32
33 uploader = self._html_search_regex(r'<p class="username">(.*?)</p>',
34 webpage, 'uploader', fatal=False, flags=re.DOTALL)
35
36 return {
37 'id': video_id,
38 'url': video_url,
39 'ext': 'mp4',
40 'title': self._og_search_title(webpage),
41 'thumbnail': self._og_search_thumbnail(webpage),
42 'uploader': uploader,
43 }