]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/vine.py
Clarify use of mplayer.
[youtubedl] / youtube_dl / extractor / vine.py
1 import re
2
3 from .common import InfoExtractor
4
5
6 class VineIE(InfoExtractor):
7 _VALID_URL = r'(?:https?://)?(?:www\.)?vine\.co/v/(?P<id>\w+)'
8
9 def _real_extract(self, url):
10 mobj = re.match(self._VALID_URL, url)
11
12 video_id = mobj.group('id')
13 webpage_url = 'https://vine.co/v/' + video_id
14 webpage = self._download_webpage(webpage_url, video_id)
15
16 self.report_extraction(video_id)
17
18 video_url = self._html_search_regex(r'<meta property="twitter:player:stream" content="(.+?)"',
19 webpage, u'video URL')
20
21 video_title = self._html_search_regex(r'<meta property="og:title" content="(.+?)"',
22 webpage, u'title')
23
24 thumbnail = self._html_search_regex(r'<meta property="og:image" content="(.+?)(\?.*?)?"',
25 webpage, u'thumbnail', fatal=False)
26
27 uploader = self._html_search_regex(r'<div class="user">.*?<h2>(.+?)</h2>',
28 webpage, u'uploader', fatal=False, flags=re.DOTALL)
29
30 return [{
31 'id': video_id,
32 'url': video_url,
33 'ext': 'mp4',
34 'title': video_title,
35 'thumbnail': thumbnail,
36 'uploader': uploader,
37 }]