mirror of
https://github.com/soimort/you-get.git
synced 2025-01-23 21:45:02 +03:00
new extractor: giphy.com
This commit is contained in:
parent
cff5fb4529
commit
9e12df7807
@ -25,6 +25,7 @@ SITES = {
|
||||
'freesound' : 'freesound',
|
||||
'fun' : 'funshion',
|
||||
'google' : 'google',
|
||||
'giphy' : 'giphy',
|
||||
'heavy-music' : 'heavymusic',
|
||||
'huaban' : 'huaban',
|
||||
'huomao' : 'huomaotv',
|
||||
|
33
src/you_get/extractors/giphy.py
Normal file
33
src/you_get/extractors/giphy.py
Normal 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')
|
Loading…
Reference in New Issue
Block a user