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

Unable to Use Likes Argument #249

Open
wesleymartin234 opened this issue Nov 7, 2020 · 6 comments
Open

Unable to Use Likes Argument #249

wesleymartin234 opened this issue Nov 7, 2020 · 6 comments

Comments

@wesleymartin234
Copy link

soundscrape idkidc1 -l

results in:

Expecting value: line 1 column 1 (char 0) Process finished with exit code 0

I've also attempted using --likes

Note:

  • I am able to successfully get basic track downloads from this artist.

  • I am able to successfully get likes from other artists.

This artist has a high number of likes.

Could this be a problem with failure to return JSON payload from the likes page ?

How to debug?

Any response or assistance is appreciated.

@wesleymartin234
Copy link
Author

Additional Info:

`Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/simplejson/scanner.py", line 37, in _scan_once
nextchar = string[idx]
IndexError: string index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/soundscrape/soundscrape.py", line 174, in process_soundcloud
resolved2 = requests.get(next_href).json()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/requests/models.py", line 898, in json
return complexjson.loads(self.text, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/simplejson/init.py", line 525, in loads
return _default_decoder.decode(s)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/simplejson/decoder.py", line 370, in decode
obj, end = self.raw_decode(s)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/simplejson/decoder.py", line 400, in raw_decode
return self.scan_once(s, idx=_w(s, idx).end())
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/simplejson/scanner.py", line 79, in scan_once
return _scan_once(string, idx)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/simplejson/scanner.py", line 39, in _scan_once
raise JSONDecodeError(errmsg, string, idx)
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/simplejson/scanner.py", line 37, in _scan_once
nextchar = string[idx]
IndexError: string index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/bin/soundscrape", line 33, in
sys.exit(load_entry_point('soundscrape==0.30.1', 'console_scripts', 'soundscrape')())
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/soundscrape/soundscrape.py", line 119, in main
process_soundcloud(vargs)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/soundscrape/soundscrape.py", line 198, in process_soundcloud
hard_track_url = get_hard_track_url(item_id)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/soundscrape/soundscrape.py", line 519, in get_hard_track_url
json_response = response.json()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/requests/models.py", line 898, in json
return complexjson.loads(self.text, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/simplejson/init.py", line 525, in loads
return _default_decoder.decode(s)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/simplejson/decoder.py", line 370, in decode
obj, end = self.raw_decode(s)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/simplejson/decoder.py", line 400, in raw_decode
return self.scan_once(s, idx=_w(s, idx).end())
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/simplejson/scanner.py", line 79, in scan_once
return _scan_once(string, idx)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/simplejson/scanner.py", line 39, in _scan_once
raise JSONDecodeError(errmsg, string, idx)
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)`

@markddavidoff
Copy link

looks like same issue as #253

@markddavidoff
Copy link

Seems like this happens:
use requests to get the user id of the user you want likes for:
userId = str(client.get('/resolve', url=artist_url).id)
use soundclound client to get a page of the user's favorites
resolved = client.get('/users/' + userId + '/favorites', limit=200, linked_partitioning=1)
if there is a next_href to indicate there is a next page (there is in this case), get info on that page as json.
resolved2 = requests.get(next_href).json()
^ this actually fails with : 401: {'code': 401, 'message': '', 'link': 'https://developers.soundcloud.com/docs/api/explorer/open-api', 'status': '401 - Unauthorized', 'errors': [], 'error': None}
then we try to access "collection" on that dict which does not exist

@markddavidoff
Copy link

so 2 things i see wrong with this,

  1. so it seems pagination is not correctly implemented as requests does not have the permission that the soundcloud client has
  2. '/users/' + userId + '/favorites', is deprecated, (use /users/:userId/likes/tracks instead, to fetch a user's likes)

@markddavidoff
Copy link

@Miserlou potential fix: #254

@markddavidoff
Copy link

@wesleymartin234 here I've updated my pr, this should work #254, but that user has 2029 likes are you sure you want to download all that?

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