Skip to content

Commit

Permalink
Merge branch 'improve/radio-paginate' of https://github.com/StdioA/yo…
Browse files Browse the repository at this point in the history
…u-get into StdioA-improve/radio-paginate
  • Loading branch information
soimort committed Oct 8, 2022
2 parents 568ee3e + 023d12f commit 472afef
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/you_get/extractors/netease.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,14 @@ def netease_cloud_music_download(url, output_dir='.', merge=True, info_only=Fals
netease_song_download(j["program"]["mainSong"], output_dir=output_dir, info_only=info_only)

elif "radio" in url:
j = loads(get_content("http://music.163.com/api/dj/program/byradio/?radioId=%s&ids=[%s]&csrf_token=" % (rid, rid), headers={"Referer": "http://music.163.com/"}))
for i in j['programs']:
netease_song_download(i["mainSong"],output_dir=output_dir, info_only=info_only)
offset = 0
while True:
j = loads(get_content("http://music.163.com/api/dj/program/byradio/?radioId=%s&ids=[%s]&csrf_token=&offset=%d" % (rid, rid, offset), headers={"Referer": "http://music.163.com/"}))
for i in j['programs']:
netease_song_download(i["mainSong"], output_dir=output_dir, info_only=info_only)
if not j['more']:
break
offset += len(j['programs'])

elif "mv" in url:
j = loads(get_content("http://music.163.com/api/mv/detail/?id=%s&ids=[%s]&csrf_token=" % (rid, rid), headers={"Referer": "http://music.163.com/"}))
Expand Down

0 comments on commit 472afef

Please sign in to comment.