[vine] Modernize

This commit is contained in:
Philipp Hagemeister 2014-12-12 02:59:52 +01:00
parent 42bdd9d051
commit 63e0f29564

View File

@ -25,26 +25,21 @@ class VineIE(InfoExtractor):
} }
def _real_extract(self, url): def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url) video_id = self._match_id(url)
video_id = mobj.group('id')
webpage = self._download_webpage('https://vine.co/v/' + video_id, video_id) webpage = self._download_webpage('https://vine.co/v/' + video_id, video_id)
data = json.loads(self._html_search_regex( data = json.loads(self._html_search_regex(
r'window\.POST_DATA = { %s: ({.+?}) }' % video_id, webpage, 'vine data')) r'window\.POST_DATA = { %s: ({.+?}) }' % video_id, webpage, 'vine data'))
formats = [ formats = [{
{ 'url': data['videoLowURL'],
'url': data['videoLowURL'], 'ext': 'mp4',
'ext': 'mp4', 'format_id': 'low',
'format_id': 'low', }, {
}, 'url': data['videoUrl'],
{ 'ext': 'mp4',
'url': data['videoUrl'], 'format_id': 'standard',
'ext': 'mp4', }]
'format_id': 'standard',
}
]
return { return {
'id': video_id, 'id': video_id,