spaam / svtplay-dl

Small command-line program to download videos from some streaming sites.
https://svtplay-dl.se
MIT License
731 stars 124 forks source link

Can't download from discoveryplus.se with -A #1372

Closed hereinmyhead closed 3 years ago

hereinmyhead commented 3 years ago

svtplay-dl versions:

svtplay-dl 3.6

Operating system and Python version:

Microsoft Windows 10 Pro x64 Python 3.9.0

What is the issue:

When I try to download "Vägens hjältar" from discoveryplus.se I get this error message:

C:\Stream>svtplay-dl -S -A -u USERNAME -p PASSWORD --cookies st=COOKIE --verbose https://www.discoveryplus.se/program/vagens-hjaltar DEBUG [1619439576.8179834] D:\a\svtplay-dl\svtplay-dl\lib\svtplay_dl\utils\getmedia.py/get_media: version: 3.6 Traceback (most recent call last): File "C:\hostedtoolcache\windows\Python\3.8.9\x64\lib\site-packages\cx_Freeze\initscripts__startup.py", line 81, in run File "C:\hostedtoolcache\windows\Python\3.8.9\x64\lib\site-packages\cx_Freeze\initscripts\Console.py", line 36, in run File "bin/svtplay-dl", line 7, in File "D:\a\svtplay-dl\svtplay-dl\lib\svtplay_dl__init__.py", line 69, in main File "D:\a\svtplay-dl\svtplay-dl\lib\svtplay_dl\utils\getmedia.py", line 47, in get_media File "D:\a\svtplay-dl\svtplay-dl\lib\svtplay_dl\service__init.py", line 220, in service_handler File "D:\a\svtplay-dl\svtplay-dl\lib\svtplay_dl\service\init.py", line 52, in init__ File "D:\a\svtplay-dl\svtplay-dl\lib\svtplay_dl\utils\http.py", line 29, in init__ File "D:\a\svtplay-dl\svtplay-dl\lib\svtplay_dl\utils\http.py", line 45, in split_header ValueError: dictionary update sequence element #0 has length 3; 2 is required

To get the cookie line I use the instructions from spaam in post: https://github.com/spaam/svtplay-dl/issues/1239#issuecomment-693010838

Am I doing something wrong?

Thanks!

spaam commented 3 years ago

you dont need -u and -p for this site, it only need the st cookie. to the issue try adding " around the st=COOKIE like --cookies "st=COOKIE"

spaam commented 3 years ago

when i reproduce this issue. it seems like you have a ; to much in the st thing. it starts with ey and a long text and end by a ;. skip that ; character and the end.

hereinmyhead commented 3 years ago

Thank you for the response and suggestion!

I'm not so familir with programming but a strange thing (for me) is that the st cookie you refering to do not start with "ey". My cookie starts with "_glc_au=" and a lot of numbers after that before the first ; . Am I doing something wrong? I am using Chrome.

When I try: svtplay-dl -S -A --cookies "st=_gcl_au=XXXXXXXXXXXXXXXXX" https://www.discoveryplus.se/program/vagens-hjaltar

I get the same error

C:\Stream>svtplay-dl -S -A --cookies "st=_gcl_au=XXXXXXXXXXXXX" https://www.discoveryplus.se/program/vagens-hjaltar Traceback (most recent call last): File "C:\hostedtoolcache\windows\Python\3.8.9\x64\lib\site-packages\cx_Freeze\initscripts__startup.py", line 81, in run File "C:\hostedtoolcache\windows\Python\3.8.9\x64\lib\site-packages\cx_Freeze\initscripts\Console.py", line 36, in run File "bin/svtplay-dl", line 7, in File "D:\a\svtplay-dl\svtplay-dl\lib\svtplay_dl__init__.py", line 69, in main File "D:\a\svtplay-dl\svtplay-dl\lib\svtplay_dl\utils\getmedia.py", line 47, in get_media File "D:\a\svtplay-dl\svtplay-dl\lib\svtplay_dl\service__init.py", line 220, in service_handler File "D:\a\svtplay-dl\svtplay-dl\lib\svtplay_dl\service\init.py", line 52, in init__ File "D:\a\svtplay-dl\svtplay-dl\lib\svtplay_dl\utils\http.py", line 29, in init__ File "D:\a\svtplay-dl\svtplay-dl\lib\svtplay_dl\utils\http.py", line 45, in split_header ValueError: dictionary update sequence element #0 has length 3; 2 is required

Thank you for your patience!

spaam commented 3 years ago

i have never seen that before.

spaam commented 3 years ago

that is the issue, we sperate cookies with = into key and value.

hereinmyhead commented 3 years ago

I think I found the issue with the cookie value from my Chrome browser.

The segment that starts with "st=" is in the middle of the cookie value (not in the beginnning of the cookie value that you screenshot from 2020 shows). When I just grabbed the "st=" segment of the cookie value the download works!

So the lession to my self (and maybe others): if the cookie value don't start with "st=", search for it in the whole cookie value and grab the segment when you find it! :)

The command line now works with: svtplay-dl -S -A --cookies "st=XXXXXXXXXXXXXXXXXXXX" https://www.discoveryplus.se/program/vagens-hjaltar

Thank you!