mirror of
https://github.com/soimort/you-get.git
synced 2025-02-02 16:24:00 +03:00
revert xiami.py to soimort version,fix replace ? to - in lyric file name
This commit is contained in:
parent
62a4f6cd4c
commit
736436a9c9
@ -7,7 +7,6 @@ from ..common import *
|
||||
|
||||
from xml.dom.minidom import parseString
|
||||
from urllib import parse
|
||||
from urllib.error import HTTPError
|
||||
|
||||
def location_dec(str):
|
||||
head = int(str[0])
|
||||
@ -29,18 +28,7 @@ def location_dec(str):
|
||||
return parse.unquote(out).replace("^", "0")
|
||||
|
||||
def xiami_download_lyric(lrc_url, file_name, output_dir):
|
||||
lrc = ''
|
||||
for i in range(10):
|
||||
try:
|
||||
lrc = get_html(lrc_url, faker = True)
|
||||
except HTTPError as e:
|
||||
if e.code == 404 or e.code == 416 or e.code == 504:
|
||||
print(e.msg)
|
||||
break
|
||||
else:
|
||||
raise e
|
||||
break
|
||||
|
||||
lrc = get_html(lrc_url, faker = True)
|
||||
if len(lrc) > 0:
|
||||
with open(output_dir + "/" + file_name.replace('/', '-').replace('?', '-') + '.lrc', 'w', encoding='utf-8') as x:
|
||||
x.write(lrc)
|
||||
|
Loading…
Reference in New Issue
Block a user