mirror of
https://github.com/soimort/you-get.git
synced 2025-02-02 16:24:00 +03:00
Xiami: enable metadata fetching
This commit is contained in:
parent
a2e38f999a
commit
7c5f267e2a
@ -30,7 +30,7 @@ Fork me on GitHub: <https://github.com/soimort/you-get>
|
||||
* Sina (新浪视频) <http://video.sina.com.cn>
|
||||
* Sohu (搜狐视频) <http://tv.sohu.com>
|
||||
* 56 (56网) <http://www.56.com>
|
||||
* Xiam (虾米) <http://www.xiami.com>
|
||||
* Xiami (虾米) <http://www.xiami.com>
|
||||
|
||||
## Dependencies
|
||||
|
||||
|
@ -33,7 +33,7 @@ Supported Sites (As of Now)
|
||||
* Sina (新浪视频) http://video.sina.com.cn
|
||||
* Sohu (搜狐视频) http://tv.sohu.com
|
||||
* 56 (56网) http://www.56.com
|
||||
* Xiam (虾米) http://www.xiami.com
|
||||
* Xiami (虾米) http://www.xiami.com
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
@ -13,7 +13,7 @@ def location_dec(str):
|
||||
str = str[1:]
|
||||
rows = head
|
||||
cols = int(len(str)/rows) + 1
|
||||
|
||||
|
||||
out = ""
|
||||
full_row = len(str) % head
|
||||
for c in range(cols):
|
||||
@ -35,8 +35,11 @@ def xiami_download_song(sid, output_dir = '.', merge = True, info_only = False):
|
||||
album_name = i.getElementsByTagName("album_name")[0].firstChild.nodeValue
|
||||
song_title = i.getElementsByTagName("title")[0].firstChild.nodeValue
|
||||
url = location_dec(i.getElementsByTagName("location")[0].firstChild.nodeValue)
|
||||
type, ext, size = url_info(url)
|
||||
download_urls([url], "%s - %s - %s" % (song_title, artist, album_name), ext, size, output_dir, merge = merge)
|
||||
type, ext, size = url_info(url, faker = True)
|
||||
|
||||
print_info(site_info, song_title, type, size)
|
||||
if not info_only:
|
||||
download_urls([url], "%s - %s - %s" % (song_title, artist, album_name), ext, size, output_dir, merge = merge, faker = True)
|
||||
|
||||
def xiami_download_showcollect(sid, output_dir = '.', merge = True, info_only = False):
|
||||
xml = get_html('http://www.xiami.com/song/playlist/id/%s/type/3' % sid)
|
||||
@ -48,8 +51,12 @@ def xiami_download_showcollect(sid, output_dir = '.', merge = True, info_only =
|
||||
album_name = i.getElementsByTagName("album_name")[0].firstChild.nodeValue
|
||||
song_title = i.getElementsByTagName("title")[0].firstChild.nodeValue
|
||||
url = location_dec(i.getElementsByTagName("location")[0].firstChild.nodeValue)
|
||||
type, ext, size = url_info(url)
|
||||
download_urls([url], "%02d.%s - %s - %s" % (track_nr, song_title, artist, album_name), ext, size, output_dir, merge = merge)
|
||||
type, ext, size = url_info(url, faker = True)
|
||||
|
||||
print_info(site_info, song_title, type, size)
|
||||
if not info_only:
|
||||
download_urls([url], "%02d.%s - %s - %s" % (track_nr, song_title, artist, album_name), ext, size, output_dir, merge = merge, faker = True)
|
||||
|
||||
track_nr += 1
|
||||
|
||||
def xiami_download_album(sid, output_dir = '.', merge = True, info_only = False):
|
||||
@ -61,25 +68,26 @@ def xiami_download_album(sid, output_dir = '.', merge = True, info_only = False)
|
||||
for i in tracks:
|
||||
song_title = i.getElementsByTagName("title")[0].firstChild.nodeValue
|
||||
url = location_dec(i.getElementsByTagName("location")[0].firstChild.nodeValue)
|
||||
type, ext, size = url_info(url)
|
||||
download_urls([url], "%s - %02d.%s" % (album_name, track_nr, song_title), ext, size, output_dir, merge = merge)
|
||||
type, ext, size = url_info(url, faker = True)
|
||||
|
||||
print_info(site_info, song_title, type, size)
|
||||
if not info_only:
|
||||
download_urls([url], "%s - %02d.%s" % (album_name, track_nr, song_title), ext, size, output_dir, merge = merge, faker = True)
|
||||
|
||||
track_nr += 1
|
||||
|
||||
def xiami_download(url, output_dir = '.', stream_type = None, merge = True, info_only = False):
|
||||
|
||||
if re.match(r'http://www.xiami.com/album/\d+', url):
|
||||
id = r1(r'http://www.xiami.com/album/(\d+)', url)
|
||||
return xiami_download_album(id, output_dir, merge, info_only)
|
||||
|
||||
xiami_download_album(id, output_dir, merge, info_only)
|
||||
|
||||
if re.match(r'http://www.xiami.com/song/showcollect/id/\d+', url):
|
||||
id = r1(r'http://www.xiami.com/song/showcollect/id/(\d+)', url)
|
||||
return xiami_download_showcollect(id, output_dir, merge, info_only)
|
||||
|
||||
xiami_download_showcollect(id, output_dir, merge, info_only)
|
||||
|
||||
if re.match('http://www.xiami.com/song/\d+', url):
|
||||
id = r1(r'http://www.xiami.com/song/(\d+)', url)
|
||||
return xiami_download_song(id)
|
||||
|
||||
return None
|
||||
xiami_download_song(id, output_dir, merge, info_only)
|
||||
|
||||
site_info = "Xiami.com"
|
||||
download = xiami_download
|
||||
|
Loading…
Reference in New Issue
Block a user