mirror of
https://github.com/soimort/you-get.git
synced 2025-01-23 13:35:16 +03:00
add support for 56
This commit is contained in:
parent
cde776335f
commit
ba9b14752f
@ -4,6 +4,7 @@ from .cntv import *
|
||||
from .ku6 import *
|
||||
from .sohu import *
|
||||
from .tudou import *
|
||||
from .w56 import *
|
||||
from .yinyuetai import *
|
||||
from .youku import *
|
||||
from .youtube import *
|
||||
|
33
you_get/downloader/w56.py
Normal file
33
you_get/downloader/w56.py
Normal file
@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
__all__ = ['w56_download', 'w56_download_by_id']
|
||||
|
||||
from ..common import *
|
||||
|
||||
import json
|
||||
|
||||
def w56_download_by_id(id, title = None, output_dir = '.', merge = True, info_only = False):
|
||||
info = json.loads(get_html('http://vxml.56.com/json/%s/?src=site'%id))['info']
|
||||
title = title or info['Subject']
|
||||
assert title
|
||||
hd = info['hd']
|
||||
assert hd in (0, 1, 2)
|
||||
type = ['normal', 'clear', 'super'][hd]
|
||||
files = [x for x in info['rfiles'] if x['type'] == type]
|
||||
assert len(files) == 1
|
||||
size = int(files[0]['filesize'])
|
||||
url = files[0]['url']
|
||||
ext = r1(r'\.([^.]+)$', url)
|
||||
assert ext in ('flv', 'mp4')
|
||||
|
||||
print_info(site_info, title, ext, size)
|
||||
if not info_only:
|
||||
download_urls([url], title, ext, size, output_dir = output_dir, merge = merge)
|
||||
|
||||
def w56_download(url, output_dir = '.', merge = True, info_only = False):
|
||||
id = r1(r'http://www.56.com/u\d+/v_(\w+).html', url)
|
||||
w56_download_by_id(id, output_dir = output_dir, merge = merge, info_only = info_only)
|
||||
|
||||
site_info = "56.com"
|
||||
download = w56_download
|
||||
download_playlist = playlist_not_supported('56')
|
@ -16,6 +16,7 @@ def url_to_module(url):
|
||||
|
||||
k = r1(r'([^.]+)', domain)
|
||||
downloads = {
|
||||
'56': w56,
|
||||
'cntv': cntv,
|
||||
'ku6': ku6,
|
||||
'sohu': sohu,
|
||||
@ -31,7 +32,6 @@ def url_to_module(url):
|
||||
# 'sina': iask,
|
||||
# 'pptv': pptv,
|
||||
# 'iqiyi': iqiyi,
|
||||
# '56': w56,
|
||||
}
|
||||
if k in downloads:
|
||||
return downloads[k]
|
||||
|
Loading…
Reference in New Issue
Block a user