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

JSON Parse error for a playlist #51

Open
vijaysattigeri opened this issue Mar 25, 2022 · 0 comments
Open

JSON Parse error for a playlist #51

vijaysattigeri opened this issue Mar 25, 2022 · 0 comments

Comments

@vijaysattigeri
Copy link

vijaysattigeri commented Mar 25, 2022

Hi,

The JSON parsing of response text fails for the following playlist:

https://www.jiosaavn.com/s/playlist/88063878238ad9a391a33c0e628d2b01/90s_Love/OykxHSA0YytFo9wdEAzFBA__

Usage: http://127.0.0.1:5000/playlist/?query=https://www.jiosaavn.com/s/playlist/88063878238ad9a391a33c0e628d2b01/90s_Love/OykxHSA0YytFo9wdEAzFBA__&lyrics=true

Stack trace:


Traceback (most recent call last):
  File "/mnt/d/vj_work/Linux/ORIG_REPO/JioSaavnAPI/jiosaavn.py", line 70, in get_playlist
    songs_json = json.loads(songs_json)
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.8/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 20 column 12851 (char 12869)
127.0.0.1 - - [26/Mar/2022 01:02:41] "GET /playlist/?query=https://www.jiosaavn.com/s/playlist/88063878238ad9a391a33c0e628d2b01/90s_Love/OykxHSA0YytFo9wdEAzFBA__&lyrics=true HTTP/1.1" 200 -

Bug:
Looks like the following data is causing the JSON parse error.
"lyrics_snippet":"कहो ना, "प्यार है," कहो ना, "प्यार है"",

Culprit code?

 jiosaavn.py:67,
 songs_json = response.text.encode().decode('unicode-escape')

Since we are doing "unicode_escape" we are losing the JSON delimiter.

Fix?
Can we just load the response data as it is and decode the value while displaying?

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

1 participant