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.

45 lines
1.2 KiB
Python

10 years ago
from __future__ import unicode_literals
import re
from .common import InfoExtractor
class VineIE(InfoExtractor):
10 years ago
_VALID_URL = r'https?://(?:www\.)?vine\.co/v/(?P<id>\w+)'
_TEST = {
10 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)
10 years ago
video_url = self._html_search_meta('twitter:player:stream', webpage,
'video URL')
twitter_title = self._html_search_meta('twitter:title', webpage,
'twitter title')
uploader = re.sub('\'s post on Vine', '', twitter_title)
10 years ago
return {
'id': video_id,
'url': video_url,
'ext': 'mp4',
'title': self._og_search_title(webpage),
'thumbnail': self._og_search_thumbnail(webpage),
10 years ago
'uploader': uploader,
}