Skip to content

Instantly share code, notes, and snippets.

@XiaoGeNintendo
Created January 6, 2021 14:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save XiaoGeNintendo/aacb14d8d04feea637b8be7f6ca07b1e to your computer and use it in GitHub Desktop.
Save XiaoGeNintendo/aacb14d8d04feea637b8be7f6ca07b1e to your computer and use it in GitHub Desktop.
(TSRT) Source generator Netease
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"])
@XiaoGeNintendo
Copy link
Author

Please use with This

@XiaoGeNintendo
Copy link
Author

How to use:

  1. Fill up input.txt with this response (ZUN id 15345)

  2. 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