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

JSONDecodeError #8

Open
Jeyamir opened this issue Oct 9, 2024 · 6 comments
Open

JSONDecodeError #8

Jeyamir opened this issue Oct 9, 2024 · 6 comments

Comments

@Jeyamir
Copy link

Jeyamir commented Oct 9, 2024

Today, I was trying to download the following course: https://www.wingfox.com/p/8328/159176 and I'm getting following error:

....:~/wingfox-downloader$ python main.py --id 159176 --cookie cookies.json --subtitles --debug
[DEBUG]: Starting new HTTPS connection (1): api.wingfox.com:443
[DEBUG]: https://api.wingfox.com:443 "GET /api/album/get_video_url?play_video_id=159176 HTTP/1.1" 200 None
[DEBUG]: Starting new HTTPS connection (1): player.polyv.net:443
[DEBUG]: https://player.polyv.net:443 "GET /secure/9215d65496a063cad141a8f46b0891e3_9.json HTTP/1.1" 200 None
seed_const => 26
hlsLevel => web
hlsPrivate => None
[DEBUG]: Starting new HTTPS connection (1): hls.videocc.net:443
[DEBUG]: https://hls.videocc.net:443 "GET /9215d65496/3/9215d65496a063cad141a8f46b0891e3_1.m3u8?device=desktop HTTP/1.1" 200 1642
Traceback (most recent call last):
File ".../lib/python3.10/site-packages/requests/models.py", line 963, in json
return complexjson.loads(self.content.decode(encoding), **kwargs)
File ".../lib/python3.10/json/init.py", line 346, in loads
return _default_decoder.decode(s)
File ".../lib/python3.10/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File ".../lib/python3.10/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/jeyamir/wingfox-downloader/main.py", line 344, in
manifest_data = dl.get_m3u8(decrypted_body)
File "/home/jeyamir/wingfox-downloader/main.py", line 110, in get_m3u8
enc_m3u8 = hls_request.json()['body']
File ".../lib/python3.10/site-packages/requests/models.py", line 971, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

@DevLARLEY
Copy link
Owner

Don't specify some json file as the cookie. Use the cookie value itself

@Jeyamir
Copy link
Author

Jeyamir commented Oct 9, 2024

Hi, I'm not very sure if I'm using the correct cookie values. Please find the attached and kindly verify if I'm using the correct one.
cookies.txt

Initially, the cookie parameter never worked for me. So, what I did was to hard code the "yiihuu_s_c_d" value in main.py. After doing this only I was able to download my other courses that start with 20XXXX without any issue, except for fragment issue in few videos.

But, this course I noticed that it start with 15XXXX and I'm getting errors.

@waz1500
Copy link

waz1500 commented Oct 9, 2024

Your cookie is the value for PHPSESSID or the yiihuu_s_c_d as it's the same value.
Your command is going to be python main.py --id 159131 --cookie 1vgxxxxxxxxxxxxx --subtitles This will download the first lesson on your course called 1. Theory.

Remember the command isn't going to automatically download all videos in a playlist. You'll need to provide and replace the video_id for each video in the playlist.

You shouldn't need to modify main.py or any other files. Make sure you are using Python 3.12 and not any other version.

@DevLARLEY
Copy link
Owner

You're getting the error because they're responding with an unencrypted manifest, which can be easily implemented. The hard part is that they're also encrypting the MPEGTS header differently than before, which I haven't solved yet.

@Jeyamir
Copy link
Author

Jeyamir commented Oct 9, 2024

@DevLARLEY, noted on the unencrypted manifest and encrypting the MPEGTS header differently.
Thank you for the support.

Anyway, I'm getting the following error in python 3.12.

(wingfox) jeyamir@WIN-J03RE1NFNF3:~/wingfox-downloader$ python main.py --id 159176 --cookie hbrub4oofksd35d50v64reob0m --subtitles --debug
[DEBUG]: Starting new HTTPS connection (1): api.wingfox.com:443
[DEBUG]: https://api.wingfox.com:443 "GET /api/album/get_video_url?play_video_id=159176 HTTP/11" 200 None
[DEBUG]: Starting new HTTPS connection (1): player.polyv.net:443
[DEBUG]: https://player.polyv.net:443 "GET /secure/9215d65496a063cad141a8f46b0891e3_9.json HTTP/11" 200 None
seed_const => 26
hlsLevel => web
hlsPrivate => None
[DEBUG]: Starting new HTTPS connection (1): hls.videocc.net:443
[DEBUG]: https://hls.videocc.net:443 "GET /9215d65496/3/9215d65496a063cad141a8f46b0891e3_1.m3u8?device=desktop HTTP/11" 200 1642
Traceback (most recent call last):
File "/home/jeyamir/miniconda3/envs/wingfox/lib/python3.12/site-packages/requests/models.py", line 963, in json
return complexjson.loads(self.content.decode(encoding), **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jeyamir/miniconda3/envs/wingfox/lib/python3.12/json/init.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jeyamir/miniconda3/envs/wingfox/lib/python3.12/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jeyamir/miniconda3/envs/wingfox/lib/python3.12/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/jeyamir/wingfox-downloader/main.py", line 345, in
manifest_data = dl.get_m3u8(decrypted_body)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jeyamir/wingfox-downloader/main.py", line 111, in get_m3u8
enc_m3u8 = hls_request.json()['body']
^^^^^^^^^^^^^^^^^^
File "/home/jeyamir/miniconda3/envs/wingfox/lib/python3.12/site-packages/requests/models.py", line 971, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

@DevLARLEY
Copy link
Owner

I've added support for unencrypted manifests in this commit: 314e025
This will "successfully" download the video but the header will still be encrypted

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

3 participants