Skip to content

Commit

Permalink
Merge pull request #12 from HisAtri/ur2853956
Browse files Browse the repository at this point in the history
更新API实现
  • Loading branch information
HisAtri authored Jan 7, 2024
2 parents 7c921ef + 0830735 commit 819a0d4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 109 deletions.
7 changes: 4 additions & 3 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from mod.auth.authentication import require_auth
from mod.args import GlobalArgs


args = GlobalArgs()
app = Flask(__name__)

Expand Down Expand Up @@ -163,8 +162,8 @@ def lrc_json():
def cover_api():
req_args = {key: request.args.get(key) for key in request.args}
# 构建目标URL
target_url = 'https://lrc.xms.mx/cover?' + '&'.join([f"{key}={req_args[key]}" for key in req_args])
# 跟踪重定向并获取最终URL
target_url = 'https://it.tho.wiki/cover?' + '&'.join([f"{key}={req_args[key]}" for key in req_args])
"""# 跟踪重定向并获取最终URL
final_url = follow_redirects(target_url)
# 获取最终URL的内容或响应
response = requests.get(final_url)
Expand All @@ -173,6 +172,8 @@ def cover_api():
return Response(response.content, content_type=content_type)
else:
abort(404)
"""
return redirect(target_url, 302)


def validate_json_structure(data):
Expand Down
105 changes: 0 additions & 105 deletions mod/api.py

This file was deleted.

2 changes: 1 addition & 1 deletion mod/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ async def api_2(title, artist, album):
headers = {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 LrcAPI/1.1',
}
url = f"https://lrc.xms.mx/lyrics?title={title}&artist={artist}&album={album}&path=None&limit=1&api=lrcapi"
url = f"https://it.tho.wiki/lyrics?title={title}&artist={artist}&album={album}&path=None&limit=1&api=lrcapi"
try:
res = requests.get(url, headers=headers, timeout=30)
if res.status_code < 300:
Expand Down

0 comments on commit 819a0d4

Please sign in to comment.