spaam / svtplay-dl

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

svtplay-dl crashes on svtplay #1169

Open EmmW opened 5 years ago

EmmW commented 5 years ago

svtplay-dl versions: 2.4

Operating system and Python version: Mac OS 10.14.6, python 2.7.16

What is the issue:

When I try to download something:

svtplay-dl https://urplay.se/program/162200-mansklighetens-sista-dagar-kollapsande-stjarnor --remux

...I get the following error:

svtplay-dl crashed

So I try with --verbose added:

DEBUG [1570560656.750704] /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/svtplay_dl/utils/getmedia.py/get_media: version: 2.4
DEBUG [1570560656.751742] /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/svtplay_dl/service/__init__.py/__init__: service: urplay
DEBUG [1570560656.751788] /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/svtplay_dl/utils/http.py/request: HTTP getting 'https://urplay.se/program/162200-mansklighetens-sista-dagar-kollapsande-stjarnor'
DEBUG [1570560656.759232] /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py/_new_conn: Starting new HTTPS connection (1): urplay.se
DEBUG [1570560656.898335] /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py/_make_request: https://urplay.se:443 "GET /program/162200-mansklighetens-sista-dagar-kollapsande-stjarnor HTTP/1.1" 200 21479
DEBUG [1570560656.903645] /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/svtplay_dl/utils/http.py/request: HTTP getting 'https://streaming-loadbalancer.ur.se/loadbalancer.json'
DEBUG [1570560656.905032] /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py/_new_conn: Starting new HTTPS connection (1): streaming-loadbalancer.ur.se
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 345, in _make_request
    self._validate_conn(conn)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 844, in _validate_conn
    conn.connect()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/packages/urllib3/connection.py", line 326, in connect
    ssl_context=context)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/packages/urllib3/util/ssl_.py", line 324, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 376, in wrap_socket
    _context=self)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 747, in __init__
    self.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 983, in do_handshake
    self._sslobj.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 628, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:645)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/adapters.py", line 423, in send
    timeout=timeout
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 630, in urlopen
    raise SSLError(e)
requests.packages.urllib3.exceptions.SSLError: [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:645)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.5/bin/svtplay-dl", line 7, in <module>
    svtplay_dl.main()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/svtplay_dl/__init__.py", line 69, in main
    get_media(urls[0], config, __version__)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/svtplay_dl/utils/getmedia.py", line 61, in get_media
    get_one_media(stream)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/svtplay_dl/utils/getmedia.py", line 111, in get_one_media
    for i in streams:
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/svtplay_dl/service/urplay.py", line 50, in get
    lbjson = self.http.request("get", url).text
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/svtplay_dl/utils/http.py", line 39, in request
    res = Session.request(self, method, url, verify=self.verify, proxies=self.proxy, *args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/sessions.py", line 488, in request
    resp = self.send(prep, **send_kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/sessions.py", line 609, in send
    r = adapter.send(request, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/adapters.py", line 497, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:645)

And when I try to upgrade svtplay-dl (assuming my version might be too old):

brew upgrade svtplay-dl

...I get the following error:

Error: svtplay-dl not installed

...which sounds very weird since I do have svtplay-dl installed (I actually used it successfully just a couple of days ago):

svtplay-dl --version svtplay-dl 2.4

Also, I in the long error message above, there are several references to Python 3.5, but when I check the version on my installed Python, I get the following:

python --version Python 2.7.16

Has something happened to svtplay-dl (new site update by svtplay?), or could there be something wrong on my side (I have no idea what though, since I used svtplay-dl recently without any problems)?

/Mark

SYSophie commented 5 years ago

If you still are running the installation that you seemingly have preformed here #1070 then you don't have an installation thru brew so it isn't that surprising that brew tells you that it isn't installed. If you wanna run it from source then you need to follow those instructions instead of using brew.

You would have to

cd svtplay-dl (or where you placed it) git pull make sudo make install

EmmW commented 5 years ago

Thanks for input SYSophie!

I tried what you recommended, but still got the same result (svtplay-dl crashed):

[iMac-2019:~] mark% cd svtplay-dl [iMac-2019:~/svtplay-dl] mark% git pull remote: Enumerating objects: 174, done. remote: Counting objects: 100% (174/174), done. remote: Compressing objects: 100% (100/100), done. remote: Total 174 (delta 94), reused 145 (delta 67), pack-reused 0 Tar emot objekt: 100% (174/174), 30,03 KiB | 10,01 MiB/s, klart. Analyserar delta: 100% (94/94), slutfördes med 8 lokala objekt. Från https://github.com/spaam/svtplay-dl 5466853..5dcc899 master -> origin/master

Any idea what else could be causing svtplay-dl to crash? I tried a reboot, but that had no effect. The svtplay-dl folder is in my user folder, and it worked fine when I used it just a week or so ago.

/Mark

EmmW commented 5 years ago

(Sorry about the big size "Add git..." and the crossed-over text above, don't know why that happened).

Sopor commented 5 years ago

@EmmW When you past text that you want to be as it is you need to start with three backticks ``` and the same at the end.

Like this:

sed -i -e 's/^version = (.)$/version = "2.4-26-g5dcc899"/'
.build/svtplay_dl/init.py
find .build/ -exec touch -m -t 198001010000 {} ;
(cd .build && zip -X --quiet svtplay-dl svtplay_dl/.py svtplay_dl/fetcher/.py svtplay_dl/postprocess/.py svtplay_dl/service/.py svtplay_dl/subtitle/.py svtplay_dl/utils/*.py)
(cd .build && zip -X --quiet --junk-paths svtplay-dl svtplay_dl/main.py)
echo '#!/usr/bin/env python3' > svtplay-dl
cat .build/svtplay-dl.zip >> svtplay-dl
rm -rf .build
chmod a+x svtplay-dl
mv -f lib/svtplay-dl .
install -d /usr/local/bin
install -m 755 svtplay-dl /usr/local/bin
[iMac-2019:/svtplay-dl] mark%
[iMac-2019:/svtplay-dl] mark% svtplay-dl --version
svtplay-dl 2.4 <-- still reports the latest version, just like before the above procedure
[iMac-2019:/svtplay-dl] mark% svtplay-dl https://urplay.se/program/162200-mansklighetens-sista-dagar-kollapsande-stjarnor --remux
ERROR: svtplay-dl crashed <-- still crashes after the above procedure...
ERROR: Run again and add --verbose as an argument, to get more information
ERROR: If the error persists, you can report it at https://github.com/spaam/svtplay-dl/issues
ERROR: Include the URL used, the stack trace and the output of svtplay-dl --version in the issue
[iMac-2019:/svtplay-dl] mark%
Sopor commented 5 years ago

I don't have any problems to download with version svtplay-dl 2.4-26-g5dcc899

svtplay-dl.exe https://urplay.se/program/162200-mansklighetens-sista-dagar-kollapsande-stjarnor
INFO: Outfile: mansklighetens.sista.dagar.kollapsande.stjarnor-ur.play-urplay.srt
INFO: Selected to download hls, bitrate: 1175
INFO: Outfile: mansklighetens.sista.dagar.kollapsande.stjarnor-ur.play-urplay.ts
[13/57][==================..............................................................] ETA: 0:00:05
Sopor commented 5 years ago

Try which svtplay-dl to see if you have two versions of svtplay-dl installed and when you run it, it will run the wrong version.

EmmW commented 5 years ago

Thanks for responding!

I have version 2.4 -- how can I upgrade to version 2.4-26-g5dcc899?

I've tried with:

brew upgrade svtplay-dl

...but only get the following result:

Error: svtplay-dl not installed

...which is weird since I DO have svtplay-dl installed (see my initial post above)...

I also tried:

cd svtplay-dl git pull make sudo make install

...but that didn't work either. Any ideas?

/Mark

Sopor commented 5 years ago

As i wrote here try to see if you have more than one version of svtplay-dl installed...

Sopor commented 5 years ago

Try to uninstall and see if you still can run svtplay-dl

  1. cd svtplay-dl
  2. sudo make uninstall
  3. svtplay-dl --version

if it still shows 2.4 you have another svtplay-dl in your path and you need to remove it. When that is removed you should be able to install svtplay-dl again with sudo make install

EmmW commented 5 years ago

Sorry, I missed your second post :-).

Anyways, I tried "whereis svtplay-dl", but got literally nothing back (just an empty line).

When I search for the folder "svtplay-dl" in Finder, I do actually find three different instances:

1) In my user folder (which is the one I assume I have been using the whole time)

2) In my Utilities folder within the Applications folder (which I have no idea how it got there :-)

3) In my Downloads folder (which I don't think is relevant, so I have now deleted it)

Could there be some sort of conflict between the svtplay-dl folder in my user folder and the one in my Utilities folder? If so, can I simply remove the latter and then somehow make sure the former is the only active version?

/Mark

spaam commented 5 years ago

you can find the latest "binary" from https://svtplay-dl.se/download/snapshots/ and the latest you can find at https://svtplay-dl.se/download/snapshots/20190930_193549/svtplay-dl . there is no need to run the whole make thing if you dont know how to do it..

but using this "binary" have some issues. you need to install dependencies yourself. for example requests, PySocks, cryptography and pyyaml.

how to find where you have svtplay-dl installed you can use which svtplay-dl to find it. if you dont know how you installed it. you can write head -c 30 /path/to/the/file/svtplay-dl does the output look like

#!/usr/bin/env python3
PK

if so you can just remove it with rm /path/to/the/file/svtplay-dl does it look like or similar

#!/usr/local/bin/python3
# EAS

you need to write pip3 uninstall svtplay-dl

Sopor commented 5 years ago

@spaam I believe he has installed it from master before so he should already have all the dependencies installed.

Sopor commented 5 years ago

@spaam If i type which svtplay-dl it will show /usr/local/bin/svtplay-dl but that file is not the binary file...

#!/usr/bin/python3
# EASY-INSTALL-SCRIPT: 'svtplay-dl==2.4+26.g5dcc899','svtplay-dl'
__requires__ = 'svtplay-dl==2.4+26.g5dcc899'
__import__('pkg_resources').run_script('svtplay-dl==2.4+26.g5dcc899', 'svtplay-dl')

So where should i put the https://svtplay-dl.se/download/snapshots/20190930_193549/svtplay-dl and where do i have the binary file?

spaam commented 5 years ago

@Sopor it show that because you used the python3 setup.py install method. that file you can put wherever you want to. you can just have it in your download folder. but you need to chmod +x svtplay-dl the file first. then just ./svtplay-dl to run it.. or you can put it in /usr/local/bin folder or ~/bin/ folder depending how your $PATH looks like, if you do that you can just type svtplay-dl to run it without the ./ infront of it.

Sopor commented 5 years ago

@spaam Yes, i run python3 setup.py install when i install it. So i don't have any binary to run now?

Yeah, it is much easier to just grab the binary as you explained and put it in the path. That must be the easiest method for @EmmW too.

EmmW commented 5 years ago

Sorry guys, you're talking over my head here... :-)

When I type "which svtplay-dl" I get the following (unexpected) result:

/Library/Frameworks/Python.framework/Versions/3.5/bin/svtplay-dl

How can I have version 3.5 of Python when I'm told I have version 2.7.16 when asking (i.e. "python --version")? Is it somehow installed but not activated? Andy why is the active svtplay-dl file located in the Python 3.5 folder when I have a complete svtplay-dl folder in my user folder (and another one in my Utilities folder, which I would like to remove as I have no idea how it ended up in there)?

What command should I use in Terminal to clean out all svtplay-dl installations, and how do I then install a completely fresh setup that ends up in my user folder? And should I do it through brew ("brew install svtplay-dl"), or with Python ("pip install svtplay-dl")? Or is there another better way? Thanks!

EmmW commented 5 years ago

Brasklapp: When I wrote "head -c 30 /Library/Frameworks/Python.framework/Versions/3.5/bin/svtplay-dl" I got the following line back: #!/Library/Frameworks/Python.f[iMac-2019:~] mark% ...which doesn't seem to look like any of the two alternative results you mentioned?

Sopor commented 5 years ago

Run python3 --version

Download the binary put it in a folder and set the X attribute chmod +x svtplay-dl. Next time you run svtplay-dl you need to run it from this folder by typing full path to the file. That is the best solution if you don't manage to remove the other svtplay-dl versions you have in your system.

/path/to/svtplay-dl https://urplay.se/program/162200-mansklighetens-sista-dagar-kollapsande-stjarnor
Sopor commented 5 years ago

@spaam but it still doesn't explains where i have the svtplay-dl. The /usr/local/bin/svtplay-dl is only a text file. There must be some file it can run or how does it work?

In macOS i have /usr/local/bin/svtplay-dl as a binary file at 91 KB, but here i run sudo make install

Sopor commented 5 years ago

What is this mark% i can see in your pasted text? I started my Mac emulator and i don't have it. I did a search for it and i did find a few hits but i couldn't figuring out what it was.

I have sopor$ at my prompt

Sopor commented 5 years ago

I downloaded the svtplay-dl file and it seems to change name to svtplay-dl.dms in MacOS, so it must be easy to separate the versions if one of them is called svtplay-dl and the other is called svtplay-dl.dms :)

EmmW commented 5 years ago

I ran "python3 --version" and got back "Python 3.5.1", so I guess I somehow have both Python 2.7.16 and 3.5.1 installed simultaneously -- is this correct, or is there something wrong with this?

"mark%" is my prompt in Terminal -- every new line (before I have typed anything myself) begins with "[iMac-2019:~] mark%" (where iMac-2019 is my drive name and mark is my user name).

The .dms extension (an old Amiga format!) I believe is actually a bug in Safari, where it adds .dms instead of the proper/original extension to downloaded files -- just an hour ago I downloaded a .vtt file that was saved as .dms, so I just changed it to .vtt instead and could then open it properly in Subtitle Studio 1.2.5 :-).

You wrote that you only have a text file at /usr/local/bin/svtplay-dl, but at my corresponding location (i.e. my user folder), I have an "svtplay-dl" folder, and then within that folder an "svtplay-dl" text file (along with a bunch of other files and folders), and this is the version I thought was the active one, until I wrote "which svtplay-dl" and got the unexpected link to /Library/Frameworks/Python.framework/Versions/3.5/bin/svtplay-dl...

However, without having changed anything, my setup worked fine until recently, that's why I thought perhaps svt had changed the svtplay site.

What I would really appreciate at this time is if someone could advice what to type in Terminal to remove/uninstall all my different svtplay-dl instances, and then what to type to re-install the most recent version 2.4-26-g5dcc899 (since I now have just 2.4), given I have both brew and python up-to-date...

Sopor commented 5 years ago

Yes, two python versions is correct.

Try to remove all svtplay-dl. I believe @spaam told you how to do it, but you should be able to do as i told you. Download the binary from https://svtplay-dl.se/download/snapshots/20190930_193549/svtplay-dl and put it in a folder and set the X attribute chmod +x svtplay-dl and you will have the latest version. It is quite easy to type the whole path to svtplay-dl or just run it from the folder but you need to run it like this ./svtplay-dl or else it won't find the file.

Btw, yes i'm an old Amiga user... I started with C=64 1986 :)