mirror of
https://github.com/soimort/you-get.git
synced 2025-02-03 08:43:58 +03:00
Merge branch 'jackyzy823-develop' into develop
This commit is contained in:
commit
4c1853a857
@ -21,6 +21,7 @@ from .joy import *
|
|||||||
from .jpopsuki import *
|
from .jpopsuki import *
|
||||||
from .ku6 import *
|
from .ku6 import *
|
||||||
from .kugou import *
|
from .kugou import *
|
||||||
|
from .kuwo import *
|
||||||
from .letv import *
|
from .letv import *
|
||||||
from .magisto import *
|
from .magisto import *
|
||||||
from .miomio import *
|
from .miomio import *
|
||||||
|
@ -41,6 +41,7 @@ def url_to_module(url):
|
|||||||
'kankanews': bilibili,
|
'kankanews': bilibili,
|
||||||
'ku6': ku6,
|
'ku6': ku6,
|
||||||
'kugou':kugou,
|
'kugou':kugou,
|
||||||
|
'kuwo':kuwo,
|
||||||
'letv': letv,
|
'letv': letv,
|
||||||
'magisto': magisto,
|
'magisto': magisto,
|
||||||
'miomio': miomio,
|
'miomio': miomio,
|
||||||
|
38
src/you_get/extractor/kuwo.py
Normal file
38
src/you_get/extractor/kuwo.py
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
__all__ = ['kuwo_download']
|
||||||
|
|
||||||
|
from ..common import *
|
||||||
|
import re
|
||||||
|
|
||||||
|
def kuwo_download_by_rid(rid, output_dir = '.', merge = True, info_only = False):
|
||||||
|
html=get_content("http://player.kuwo.cn/webmusic/st/getNewMuiseByRid?rid=MUSIC_%s"%rid)
|
||||||
|
title=match1(html,r"<name>(.*)</name>")
|
||||||
|
#to get title
|
||||||
|
#format =aac|mp3 ->to get aac format=mp3 ->to get mp3
|
||||||
|
url=get_content("http://antiserver.kuwo.cn/anti.s?format=mp3&rid=MUSIC_%s&type=convert_url&response=url"%rid)
|
||||||
|
songtype, ext, size = url_info(url)
|
||||||
|
print_info(site_info, title, songtype, size)
|
||||||
|
if not info_only:
|
||||||
|
download_urls([url], title, ext, size, output_dir)
|
||||||
|
|
||||||
|
def kuwo_playlist_download(url, output_dir = '.', merge = True, info_only = False):
|
||||||
|
html=get_content(url)
|
||||||
|
matched=set(re.compile("yinyue/(\d+)").findall(html))#reduce duplicated
|
||||||
|
for rid in matched:
|
||||||
|
kuwo_download_by_rid(rid,output_dir,merge,info_only)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def kuwo_download(url, output_dir = '.', merge = True, info_only = False):
|
||||||
|
if "www.kuwo.cn/yinyue" in url:
|
||||||
|
rid=match1(url,'yinyue/(\d+)')
|
||||||
|
kuwo_download_by_rid(rid,output_dir, merge, info_only)
|
||||||
|
else:
|
||||||
|
kuwo_playlist_download(url,output_dir,merge,info_only)
|
||||||
|
|
||||||
|
site_info = "kuwo.cn"
|
||||||
|
download = kuwo_download
|
||||||
|
# download_playlist = playlist_not_supported("kugou")
|
||||||
|
# download_playlist=playlist_not_supported("kuwo")
|
||||||
|
download_playlist=kuwo_playlist_download
|
@ -3,38 +3,65 @@
|
|||||||
__all__ = ['netease_download']
|
__all__ = ['netease_download']
|
||||||
|
|
||||||
from ..common import *
|
from ..common import *
|
||||||
|
from json import loads
|
||||||
|
|
||||||
|
def netease_cloud_music_download(url, output_dir = '.', merge = True, info_only = False):
|
||||||
|
rid=match1(url,r'id=(.*)')
|
||||||
|
if "album" in url:
|
||||||
|
j=loads(get_content("http://music.163.com/api/album/%s?id=%s&csrf_token="%(rid,rid),headers={"Referer":"http://music.163.com/"}))
|
||||||
|
for i in j['album']['songs']:
|
||||||
|
title=i['name']
|
||||||
|
url=i['mp3Url']
|
||||||
|
songtype, ext, size = url_info(url)
|
||||||
|
print_info(site_info, title, songtype, size)
|
||||||
|
if not info_only:
|
||||||
|
download_urls([url], title, ext, size, output_dir)
|
||||||
|
|
||||||
|
elif "song" in url:
|
||||||
|
j=loads(get_content("http://music.163.com/api/song/detail/?id=%s&ids=[%s]&csrf_token="%(rid,rid),headers={"Referer":"http://music.163.com/"}))
|
||||||
|
title=j["songs"][0]['name']
|
||||||
|
url=j["songs"][0]['mp3Url']
|
||||||
|
songtype, ext, size = url_info(url)
|
||||||
|
print_info(site_info, title, songtype, size)
|
||||||
|
if not info_only:
|
||||||
|
download_urls([url], title, ext, size, output_dir)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def netease_download(url, output_dir = '.', merge = True, info_only = False):
|
def netease_download(url, output_dir = '.', merge = True, info_only = False):
|
||||||
html = get_decoded_html(url)
|
if "music.163.com" in url:
|
||||||
|
netease_cloud_music_download(url,output_dir,merge,info_only)
|
||||||
title = r1('movieDescription=\'([^\']+)\'', html) or r1('<title>(.+)</title>', html)
|
|
||||||
|
|
||||||
if title[0] == ' ':
|
|
||||||
title = title[1:]
|
|
||||||
|
|
||||||
src = r1(r'<source src="([^"]+)"', html) or r1(r'<source type="[^"]+" src="([^"]+)"', html)
|
|
||||||
|
|
||||||
if src:
|
|
||||||
sd_url = r1(r'(.+)-mobile.mp4', src) + ".flv"
|
|
||||||
_, _, sd_size = url_info(sd_url)
|
|
||||||
|
|
||||||
hd_url = re.sub('/SD/', '/HD/', sd_url)
|
|
||||||
_, _, hd_size = url_info(hd_url)
|
|
||||||
|
|
||||||
if hd_size > sd_size:
|
|
||||||
url, size = hd_url, hd_size
|
|
||||||
else:
|
|
||||||
url, size = sd_url, sd_size
|
|
||||||
ext = 'flv'
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
url = (r1(r'["\'](.+)-list.m3u8["\']', html) or r1(r'["\'](.+).m3u8["\']', html)) + ".mp4"
|
html = get_decoded_html(url)
|
||||||
_, _, size = url_info(url)
|
|
||||||
ext = 'mp4'
|
|
||||||
|
|
||||||
print_info(site_info, title, ext, size)
|
title = r1('movieDescription=\'([^\']+)\'', html) or r1('<title>(.+)</title>', html)
|
||||||
if not info_only:
|
|
||||||
download_urls([url], title, ext, size, output_dir = output_dir, merge = merge)
|
if title[0] == ' ':
|
||||||
|
title = title[1:]
|
||||||
|
|
||||||
|
src = r1(r'<source src="([^"]+)"', html) or r1(r'<source type="[^"]+" src="([^"]+)"', html)
|
||||||
|
|
||||||
|
if src:
|
||||||
|
sd_url = r1(r'(.+)-mobile.mp4', src) + ".flv"
|
||||||
|
_, _, sd_size = url_info(sd_url)
|
||||||
|
|
||||||
|
hd_url = re.sub('/SD/', '/HD/', sd_url)
|
||||||
|
_, _, hd_size = url_info(hd_url)
|
||||||
|
|
||||||
|
if hd_size > sd_size:
|
||||||
|
url, size = hd_url, hd_size
|
||||||
|
else:
|
||||||
|
url, size = sd_url, sd_size
|
||||||
|
ext = 'flv'
|
||||||
|
|
||||||
|
else:
|
||||||
|
url = (r1(r'["\'](.+)-list.m3u8["\']', html) or r1(r'["\'](.+).m3u8["\']', html)) + ".mp4"
|
||||||
|
_, _, size = url_info(url)
|
||||||
|
ext = 'mp4'
|
||||||
|
|
||||||
|
print_info(site_info, title, ext, size)
|
||||||
|
if not info_only:
|
||||||
|
download_urls([url], title, ext, size, output_dir = output_dir, merge = merge)
|
||||||
|
|
||||||
site_info = "163.com"
|
site_info = "163.com"
|
||||||
download = netease_download
|
download = netease_download
|
||||||
|
Loading…
Reference in New Issue
Block a user