mirror of
https://github.com/soimort/you-get.git
synced 2025-01-23 13:35:16 +03:00
add support for Sina
This commit is contained in:
parent
d0d7419983
commit
b75bfca149
@ -4,6 +4,7 @@ from .cntv import *
|
||||
from .iqiyi import *
|
||||
from .ku6 import *
|
||||
from .pptv import *
|
||||
from .sina import *
|
||||
from .sohu import *
|
||||
from .tudou import *
|
||||
from .w56 import *
|
||||
|
35
you_get/downloader/sina.py
Normal file
35
you_get/downloader/sina.py
Normal file
@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
__all__ = ['sina_download', 'sina_download_by_id']
|
||||
|
||||
from ..common import *
|
||||
|
||||
import re
|
||||
|
||||
def video_info(id):
|
||||
xml = get_decoded_html('http://v.iask.com/v_play.php?vid=%s' % id)
|
||||
urls = re.findall(r'<url>(?:<!\[CDATA\[)?(.*?)(?:\]\]>)?</url>', xml)
|
||||
name = r1(r'<vname>(?:<!\[CDATA\[)?(.+?)(?:\]\]>)?</vname>', xml)
|
||||
vstr = r1(r'<vstr>(?:<!\[CDATA\[)?(.+?)(?:\]\]>)?</vstr>', xml)
|
||||
return urls, name, vstr
|
||||
|
||||
def sina_download_by_id(id, title = None, output_dir = '.', merge = True, info_only = False):
|
||||
urls, name, vstr = video_info(id)
|
||||
title = title or name
|
||||
assert title
|
||||
size = 0
|
||||
for url in urls:
|
||||
_, _, temp = url_info(url)
|
||||
size += temp
|
||||
|
||||
print_info(site_info, title, 'flv', size)
|
||||
if not info_only:
|
||||
download_urls(urls, title, 'flv', size, output_dir = output_dir, merge = merge)
|
||||
|
||||
def sina_download(url, output_dir = '.', merge = True, info_only = False):
|
||||
id = r1(r'ipad_vid:\'(\d+)\',', get_html(url))
|
||||
sina_download_by_id(id, output_dir = output_dir, merge = merge, info_only = info_only)
|
||||
|
||||
site_info = "Sina.com"
|
||||
download = sina_download
|
||||
download_playlist = playlist_not_supported('sina')
|
@ -18,9 +18,11 @@ def url_to_module(url):
|
||||
downloads = {
|
||||
'56': w56,
|
||||
'cntv': cntv,
|
||||
'iask': sina,
|
||||
'iqiyi': iqiyi,
|
||||
'ku6': ku6,
|
||||
'pptv': pptv,
|
||||
'sina': sina,
|
||||
'sohu': sohu,
|
||||
'tudou': tudou,
|
||||
'yinyuetai': yinyuetai,
|
||||
@ -30,8 +32,6 @@ def url_to_module(url):
|
||||
# 'acfun': acfun,
|
||||
# 'bilibili': bilibili,
|
||||
# 'kankanews': bilibili,
|
||||
# 'iask': iask,
|
||||
# 'sina': iask,
|
||||
}
|
||||
if k in downloads:
|
||||
return downloads[k]
|
||||
|
Loading…
Reference in New Issue
Block a user