mirror of
https://github.com/soimort/you-get.git
synced 2025-02-11 20:52:31 +03:00
Merge branch 'develop' into develop
This commit is contained in:
commit
8b9cf16a1e
@ -127,7 +127,8 @@ def bilibili_download(url, output_dir='.', merge=True, info_only=False, **kwargs
|
|||||||
if re.match(r'https?://live\.bilibili\.com/', url):
|
if re.match(r'https?://live\.bilibili\.com/', url):
|
||||||
title = r1(r'<title>([^<>]+)</title>', html)
|
title = r1(r'<title>([^<>]+)</title>', html)
|
||||||
bilibili_live_download_by_cid(cid, title, output_dir=output_dir, merge=merge, info_only=info_only)
|
bilibili_live_download_by_cid(cid, title, output_dir=output_dir, merge=merge, info_only=info_only)
|
||||||
elif 'playlist' in kwargs and kwargs['playlist']:
|
|
||||||
|
else:
|
||||||
# multi-P
|
# multi-P
|
||||||
cids = []
|
cids = []
|
||||||
pages = re.findall('<option value=\'([^\']*)\'', html)
|
pages = re.findall('<option value=\'([^\']*)\'', html)
|
||||||
@ -140,15 +141,18 @@ def bilibili_download(url, output_dir='.', merge=True, info_only=False, **kwargs
|
|||||||
if flashvars:
|
if flashvars:
|
||||||
t, cid = flashvars.split('=', 1)
|
t, cid = flashvars.split('=', 1)
|
||||||
cids.append(cid.split('&')[0])
|
cids.append(cid.split('&')[0])
|
||||||
|
|
||||||
|
# no multi-P
|
||||||
|
if not pages:
|
||||||
|
cids = [cid]
|
||||||
|
titles = [r1(r'<option value=.* selected>(.+)</option>', html) or title]
|
||||||
|
|
||||||
for i in range(len(cids)):
|
for i in range(len(cids)):
|
||||||
bilibili_download_by_cid(cids[i],
|
bilibili_download_by_cid(cids[i],
|
||||||
titles[i],
|
titles[i],
|
||||||
output_dir=output_dir,
|
output_dir=output_dir,
|
||||||
merge=merge,
|
merge=merge,
|
||||||
info_only=info_only)
|
info_only=info_only)
|
||||||
else:
|
|
||||||
title = r1(r'<option value=.* selected>(.+)</option>', html) or title
|
|
||||||
bilibili_download_by_cid(cid, title, output_dir=output_dir, merge=merge, info_only=info_only)
|
|
||||||
|
|
||||||
elif t == 'vid':
|
elif t == 'vid':
|
||||||
sina_download_by_vid(cid, title=title, output_dir=output_dir, merge=merge, info_only=info_only)
|
sina_download_by_vid(cid, title=title, output_dir=output_dir, merge=merge, info_only=info_only)
|
||||||
@ -169,14 +173,6 @@ def bilibili_download(url, output_dir='.', merge=True, info_only=False, **kwargs
|
|||||||
with open(os.path.join(output_dir, title + '.cmt.xml'), 'w', encoding='utf-8') as x:
|
with open(os.path.join(output_dir, title + '.cmt.xml'), 'w', encoding='utf-8') as x:
|
||||||
x.write(xml)
|
x.write(xml)
|
||||||
|
|
||||||
def bilibili_download_playlist(url, output_dir='.', merge=True, info_only=False, **kwargs):
|
|
||||||
bilibili_download(url,
|
|
||||||
output_dir=output_dir,
|
|
||||||
merge=merge,
|
|
||||||
info_only=info_only,
|
|
||||||
playlist=True,
|
|
||||||
**kwargs)
|
|
||||||
|
|
||||||
site_info = "bilibili.com"
|
site_info = "bilibili.com"
|
||||||
download = bilibili_download
|
download = bilibili_download
|
||||||
download_playlist = bilibili_download_playlist
|
download_playlist = bilibili_download
|
||||||
|
@ -4,6 +4,7 @@ from ..common import *
|
|||||||
|
|
||||||
from .iqiyi import iqiyi_download_by_vid
|
from .iqiyi import iqiyi_download_by_vid
|
||||||
from .le import letvcloud_download_by_vu
|
from .le import letvcloud_download_by_vu
|
||||||
|
from .netease import netease_download
|
||||||
from .qq import qq_download_by_vid
|
from .qq import qq_download_by_vid
|
||||||
from .sina import sina_download_by_vid
|
from .sina import sina_download_by_vid
|
||||||
from .tudou import tudou_download_by_id
|
from .tudou import tudou_download_by_id
|
||||||
@ -36,10 +37,13 @@ yinyuetai_embed_patterns = [ 'player\.yinyuetai\.com/video/swf/(\d+)' ]
|
|||||||
|
|
||||||
iqiyi_embed_patterns = [ 'player\.video\.qiyi\.com/([^/]+)/[^/]+/[^/]+/[^/]+\.swf[^"]+tvId=(\d+)' ]
|
iqiyi_embed_patterns = [ 'player\.video\.qiyi\.com/([^/]+)/[^/]+/[^/]+/[^/]+\.swf[^"]+tvId=(\d+)' ]
|
||||||
|
|
||||||
|
netease_embed_patterns = [ '(http://\w+\.163\.com/movie/[^\'"]+)' ]
|
||||||
|
|
||||||
def embed_download(url, output_dir = '.', merge = True, info_only = False ,**kwargs):
|
def embed_download(url, output_dir = '.', merge = True, info_only = False ,**kwargs):
|
||||||
content = get_content(url)
|
content = get_content(url, headers=fake_headers)
|
||||||
found = False
|
found = False
|
||||||
title = match1(content, '<title>([^<>]+)</title>')
|
title = match1(content, '<title>([^<>]+)</title>')
|
||||||
|
|
||||||
vids = matchall(content, youku_embed_patterns)
|
vids = matchall(content, youku_embed_patterns)
|
||||||
for vid in set(vids):
|
for vid in set(vids):
|
||||||
found = True
|
found = True
|
||||||
@ -60,6 +64,11 @@ def embed_download(url, output_dir = '.', merge = True, info_only = False ,**kwa
|
|||||||
found = True
|
found = True
|
||||||
iqiyi_download_by_vid((vid[1], vid[0]), title=title, output_dir=output_dir, merge=merge, info_only=info_only)
|
iqiyi_download_by_vid((vid[1], vid[0]), title=title, output_dir=output_dir, merge=merge, info_only=info_only)
|
||||||
|
|
||||||
|
urls = matchall(content, netease_embed_patterns)
|
||||||
|
for url in urls:
|
||||||
|
found = True
|
||||||
|
netease_download(url, title=title, output_dir=output_dir, merge=merge, info_only=info_only)
|
||||||
|
|
||||||
if not found:
|
if not found:
|
||||||
raise NotImplementedError(url)
|
raise NotImplementedError(url)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user