You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yt-dlc/youtube_dl/extractor/vine.py

44 lines
1.2 KiB
Python

11 years ago
from __future__ import unicode_literals
import re
from .common import InfoExtractor
class VineIE(InfoExtractor):
11 years ago
_VALID_URL = r'https?://(?:www\.)?vine\.co/v/(?P<id>\w+)'
_TEST = {
11 years ago
'url': 'https://vine.co/v/b9KOOWX7HUx',
'md5': '2f36fed6235b16da96ce9b4dc890940d',
'info_dict': {
'id': 'b9KOOWX7HUx',
'ext': 'mp4',
'uploader': 'Jack Dorsey',
'title': 'Chicken.',
},
}
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)
self.report_extraction(video_id)
11 years ago
video_url = self._html_search_meta('twitter:player:stream', webpage,
'video URL')
uploader = self._html_search_regex(r'<p class="username">(.*?)</p>',
11 years ago
webpage, 'uploader', fatal=False, flags=re.DOTALL)
11 years ago
return {
'id': video_id,
'url': video_url,
'ext': 'mp4',
'title': self._og_search_title(webpage),
'thumbnail': self._og_search_thumbnail(webpage),
11 years ago
'uploader': uploader,
}