Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NETEASE API post do not return the expected data #4

Closed
y9c opened this issue Jan 20, 2019 · 5 comments
Closed

NETEASE API post do not return the expected data #4

y9c opened this issue Jan 20, 2019 · 5 comments

Comments

@y9c
Copy link

y9c commented Jan 20, 2019

The url in r.json() is None, and it will cause error in music_download command.

{'data': [{'id': 28850659, 'url': None, 'br': 0, 'size': 0, 'md5': None, 'code': 404, 'expi': 1200, 'type': None, 'gain': 0.0, 'fee': 0, 'uf': None, 'payed': 0, 'flag': 4, 'canExtend': False, 'freeTrialInfo': None}], 'code': 200}
    music_download(music)
  File "/home/yc/Tools/music-dl/core/common.py", line 23, in music_download
    wget.download(music['url'], out=outfile)
  File "/usr/lib/python3.7/site-packages/wget.py", line 526, in download
    (tmpfile, headers) = ulib.urlretrieve(binurl, tmpfile, callback)
  File "/usr/lib/python3.7/urllib/request.py", line 245, in urlretrieve
    url_type, path = splittype(url)
  File "/usr/lib/python3.7/urllib/parse.py", line 956, in splittype
    match = _typeprog.match(url)
TypeError: cannot use a string pattern on a bytes-like object
@0xHJK
Copy link
Owner

0xHJK commented Jan 20, 2019

Which song do you want to download? Could you please tell me the keyword?
It would be better if there were detailed screenshots.

@y9c
Copy link
Author

y9c commented Jan 20, 2019

@0xHJK

It seems that the error is not specific to any song. I tried several keywords and the same error occur.

 $ python main.py -k "red"
 [  0 ]      QQ | 0:03:43 -  3.41MB - Red - Taylor Swift - Red
 [  1 ]      QQ | 0:04:14 -  3.88MB - Walk Away - Dia Frampton - Red
 [  2 ]      QQ | 0:02:48 -  2.57MB - Red - 王嘉尔、ICE - Red
 [  3 ]      QQ | 0:03:41 -  3.38MB - Red (In the Style of Taylor Swift) - Ameritz Top Tracks - Red
 [  4 ]      QQ | 0:08:27 -  7.75MB - Red (DJ Vivona Remix) - Mephia、Bobby Starrr - Red
 [  5 ] NETEASE | 0:03:21 -  3.07MB - 빨개요 - 泫雅 - A Talk
请输入要下载的歌曲序号,多个序号用空格隔开:5
Traceback (most recent call last):
  File "main.py", line 111, in <module>
    main()
  File "main.py", line 100, in main
    downloadByIndexList(choices.split(),music_list)
  File "main.py", line 46, in downloadByIndexList
    addons.get(music['source']).download(music)
  File "/home/test/Tools/music-dl/core/extractors/netease.py", line 110, in netease_download
    music_download(music)
  File "/home/test/Tools/music-dl/core/common.py", line 23, in music_download
    wget.download(music['url'], out=outfile)
  File "/usr/lib/python3.7/site-packages/wget.py", line 526, in download
    (tmpfile, headers) = ulib.urlretrieve(binurl, tmpfile, callback)
  File "/usr/lib/python3.7/urllib/request.py", line 245, in urlretrieve
    url_type, path = splittype(url)
  File "/usr/lib/python3.7/urllib/parse.py", line 956, in splittype
    match = _typeprog.match(url)
TypeError: cannot use a string pattern on a bytes-like object

@0xHJK
Copy link
Owner

0xHJK commented Jan 20, 2019

Sorry, this error did not occur on my computer.
Where are you from?I suspect that NetEase may have blocked the IP of your country or area.

$ python main.py -k red
 [  0 ]      QQ | 0:03:43 -  3.41MB - Red - Taylor Swift - Red
 [  1 ]      QQ | 0:04:14 -  3.88MB - Walk Away - Dia Frampton - Red
 [  2 ]      QQ | 0:02:48 -  2.57MB - Red - 王嘉尔、ICE - Red
 [  3 ]      QQ | 0:03:41 -  3.38MB - Red (In the Style of Taylor Swift) - Ameritz Top Tracks - Red
 [  4 ]      QQ | 0:08:27 -  7.75MB - Red (DJ Vivona Remix) - Mephia、Bobby Starrr - Red
 [  5 ] NETEASE | 0:02:48 -  2.57MB - Red - 王嘉尔、ICE - Red
 [  6 ] NETEASE | 0:03:21 -  3.07MB - 빨개요 - 泫雅 - A Talk
 [  7 ] NETEASE | 0:03:42 -  3.39MB - Red - T. Swift、Rina Johnson - Tribute to Taylor Swift
 [  8 ]   KUGOU | 0:02:48 -  2.57MB - Red - 王嘉尔、ICE - Red
 [  9 ]   KUGOU | 0:03:55 -  3.59MB - Red (Live) - Taylor Swift -
 [ 10 ]   KUGOU | 0:03:43 -  3.41MB - Red - Taylor Swift - Red (Deluxe Version)
 [ 11 ]   KUGOU | 0:03:19 -  3.05MB - 빨개요 (红) - 泫雅 - A Talk
 [ 12 ]   KUGOU | 0:03:49 -   3.5MB - Red (Instrumental With Background Vocals) - Taylor Swift -
 [ 13 ]   BAIDU | 0:02:24 -   2.2MB - Red - Eva O - Red
 [ 14 ]   BAIDU | 0:03:27 -  3.16MB - Red - Rafi Sanu, Kavita Krishnamurthy - Red
 [ 15 ]   BAIDU | 0:07:19 -  6.71MB - Red - Nadjiwan - Brother
 [ 16 ]   BAIDU | 0:02:27 -  2.26MB - Red - Federico Ferrandina - Federico Ferrandina-What We Are
 [ 17 ]   BAIDU | 0:03:12 -  2.94MB - Red - 스크류그래프트(ScrewGraft) - TotalMentalectomy
请输入要下载的歌曲序号,多个序号用空格隔开:6
100% [......................................................] 3218423 / 3218423
已保存到:/Users/hjk/workspace/music-dl/泫雅 - 빨개요.mp3

@0xHJK
Copy link
Owner

0xHJK commented Jan 20, 2019

Could you access this url
http://music.163.com/song/media/outer/url?id=28850659

@y9c
Copy link
Author

y9c commented Jan 20, 2019

Oops... 404

Seems my IP address is blocked by netease.

@y9c y9c closed this as completed Jan 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants