-
-
Save XiaoGeNintendo/aacb14d8d04feea637b8be7f6ca07b1e to your computer and use it in GitHub Desktop.
(TSRT) Source generator Netease
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import urllib.request | |
import io | |
import sys | |
def getURL(url): | |
# print("访问开始:"+url) | |
request=urllib.request.Request(url) | |
response=urllib.request.urlopen(request) | |
html=response.read() | |
return html.decode('utf-8') | |
def runAlbum(album,f): | |
s=getURL("http://localhost:3000/album?id=%d"%album["id"]) | |
obj=json.loads(s) | |
for i in obj["songs"]: | |
f.write(i["name"].replace("!","!").replace("'","’")+"!!!"+album["name"].split(" ")[0].split(" ")[0]+"!!!"+"https://v1.hitokoto.cn/nm/redirect/music/%d"%i["id"]+"\n") | |
print(i["name"]) | |
with open("input.txt",mode="r",encoding="utf-8") as f: | |
with open("out.txt",mode="w",encoding="utf-8") as f2: | |
s=f.read() | |
obj=json.loads(s) | |
for i in obj["hotAlbums"]: | |
runAlbum(i,f2) | |
print(i["id"],i["name"]) |
How to use:
-
Fill up
input.txt
with this response (ZUN id 15345) -
run and find your results at out.txt
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please use with This