Miserlou / Miserlou/SoundScrape
Exception while decoding some soundcloud urls
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.4k
- Forks
- 143
- PR merge metrics
- No merged PRs in 30d
Description
Some of the soundcloud urls generate JSON exception
I think the response code for http call is 401, and some links have additional protection
Example links:
- https://soundcloud.com/goldfishlive/ultra-miami-set-2017-live-stage-goldfish
- https://soundcloud.com/lane8music/lane-8-spring-2017-mixtape
- https://soundcloud.com/solomun/bbc-1-essential-mix-live-live-from-solomun1-at-pacha-ibiza
Traceback:
(soundscrape) ❯ soundscrape https://soundcloud.com/goldfishlive/ultra-miami-set-2017-live-stage-goldfish
Traceback (most recent call last):
File "/Users/jakubzygmunt/.virtualenvs/soundscrape/bin/soundscrape", line 11, in <module>
sys.exit(main())
File "/Users/jakubzygmunt/.virtualenvs/soundscrape/lib/python2.7/site-packages/soundscrape/soundscrape.py", line 119, in main
process_soundcloud(vargs)
File "/Users/jakubzygmunt/.virtualenvs/soundscrape/lib/python2.7/site-packages/soundscrape/soundscrape.py", line 198, in process_soundcloud
hard_track_url = get_hard_track_url(item_id)
File "/Users/jakubzygmunt/.virtualenvs/soundscrape/lib/python2.7/site-packages/soundscrape/soundscrape.py", line 518, in get_hard_track_url
json_response = response.json()
File "/Users/jakubzygmunt/.virtualenvs/soundscrape/lib/python2.7/site-packages/requests/models.py", line 866, in json
return complexjson.loads(self.text, **kwargs)
File "/Users/jakubzygmunt/.virtualenvs/soundscrape/lib/python2.7/site-packages/simplejson/__init__.py", line 516, in loads
return _default_decoder.decode(s)
File "/Users/jakubzygmunt/.virtualenvs/soundscrape/lib/python2.7/site-packages/simplejson/decoder.py", line 374, in decode
obj, end = self.raw_decode(s)
File "/Users/jakubzygmunt/.virtualenvs/soundscrape/lib/python2.7/site-packages/simplejson/decoder.py", line 404, in raw_decode
return self.scan_once(s, idx=_w(s, idx).end())
simplejson.scanner.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in soundscrape.py at process_soundcloud and get_hard_track_url, identified by the traceback. Reproduce the failure with one of the example SoundCloud URLs and inspect the HTTP response before response.json() is called. Done means these responses no longer produce an uncaught JSONDecodeError and the behavior for the affected URLs is handled appropriately.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100