Fix for magisto

This commit is contained in:
Valdemar Erk 2016-12-16 09:36:29 +01:00
parent 61d9bf124e
commit 9905620b52

View File

@ -3,15 +3,19 @@
__all__ = ['magisto_download'] __all__ = ['magisto_download']
from ..common import * from ..common import *
import json
def magisto_download(url, output_dir='.', merge=True, info_only=False, **kwargs): def magisto_download(url, output_dir='.', merge=True, info_only=False, **kwargs):
html = get_html(url) html = get_html(url)
title1 = r1(r'<meta name="twitter:title" content="([^"]*)"', html) video_hash = r1(r'video\/([a-zA-Z0-9]+)', url)
title2 = r1(r'<meta name="twitter:description" content="([^"]*)"', html) api_url = 'https://www.magisto.com/api/video/{}'.format(video_hash)
video_hash = r1(r'http://www.magisto.com/video/([^/]+)', url) content = get_html(api_url)
title = "%s %s - %s" % (title1, title2, video_hash) data = json.loads(content)
url = r1(r'<source type="[^"]+" src="([^"]*)"', html) title1 = data['title']
title2 = data['creator']
title = "%s - %s" % (title1, title2)
url = data['video_direct_url']
type, ext, size = url_info(url) type, ext, size = url_info(url)
print_info(site_info, title, type, size) print_info(site_info, title, type, size)