forked from hjdhnx/dr_py
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkugou.py
27 lines (22 loc) · 833 Bytes
/
kugou.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import requests
class KuGou:
def __init__(self, url):
self.url = url
self.headers = {
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36¬"
}
self.base = url.split("#")[-1].split("&")
self.hash = self.base[0].split("=")[-1]
self.album_id = self.base[1].split("=")[-1]
def start(self):
params = {
"r": "play/getdata",
"hash": self.hash,
"album_id": self.album_id,
"mid": "ABCDEFGHIJKLMNOPQRSTUVWXYZ123456"
}
res = requests.get("https://wwwapi.kugou.com/yy/index.php?", params=params, headers=self.headers)
print(res.json())
return res.json()
if __name__ == '__main__':
KuGou().start()