new extractor: giphy.com

This commit is contained in:
Rafael Slonik 2017-09-16 17:01:13 -03:00
parent cff5fb4529
commit 9e12df7807
2 changed files with 34 additions and 0 deletions

View File

@ -25,6 +25,7 @@ SITES = {
'freesound' : 'freesound',
'fun' : 'funshion',
'google' : 'google',
'giphy' : 'giphy',
'heavy-music' : 'heavymusic',
'huaban' : 'huaban',
'huomao' : 'huomaotv',

View File

@ -0,0 +1,33 @@
#!/usr/bin/env python
__all__ = ['giphy_download']
from ..common import *
import json
def giphy_download(url, output_dir='.', merge=True, info_only=False, **kwargs):
html = get_html(url)
url = list(set([
unicodize(str.replace(i, '\\/', '/'))
for i in re.findall(r'<meta property="og:video:secure_url" content="(.*?)">', html)
]))
title = r1(r'<meta property="og:title" content="(.*?)">', html)
if title is None:
title = url[0]
type, ext, size = url_info(url[0], True)
size = urls_size(url)
type = "video/mp4"
ext = "mp4"
print_info(site_info, title, type, size)
if not info_only:
download_urls(url, title, ext, size, output_dir, merge=False)
site_info = "Giphy.com"
download = giphy_download
download_playlist = playlist_not_supported('giphy')