Miserlou / Miserlou/SoundScrape

Exception while decoding some soundcloud urls

Open
#169 7 comments 0 reactions 0 assignees View on GitHub

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:

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.