aajanki / yle-dl

Download videos from Yle servers
https://aajanki.github.io/yle-dl/index-en.html
GNU General Public License v3.0
302 stars 52 forks source link

Failed to parse link ? #288

Closed Tontze closed 2 years ago

Tontze commented 2 years ago

`@T610:~$ yle-dl https://areena.yle.fi/1-50645771 yle-dl 20210704: Download media files from Yle Areena and Elävä Arkisto Copyright (C) 2009-2021 Antti Ajanki antti.ajanki@iki.fi, license: GPLv3

Traceback (most recent call last): File "/usr/lib/python3/dist-packages/requests/models.py", line 382, in prepare_url scheme, auth, host, port, path, query, fragment = parse_url(url) File "/usr/lib/python3/dist-packages/urllib3/util/url.py", line 392, in parse_url return six.raise_from(LocationParseError(source_url), None) File "", line 3, in raise_from urllib3.exceptions.LocationParseError: Failed to parse: https://areena.yle.fi/1-50645771

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/tontze/.local/bin/yle-dl", line 8, in sys.exit(main()) File "/home/tontze/.local/lib/python3.9/site-packages/yledl/yledl.py", line 461, in main res = execute_action(url, action, io, httpclient, title_formatter, File "/home/tontze/.local/lib/python3.9/site-packages/yledl/yledl.py", line 287, in execute_action return download_clips(clips(), dl, io, title_formatter, stream_filters) File "/home/tontze/.local/lib/python3.9/site-packages/yledl/yledl.py", line 269, in clips return extractor.extract(url, stream_filters.latest_only, File "/home/tontze/.local/lib/python3.9/site-packages/yledl/extractors.py", line 211, in extract playlist = self.get_playlist(url) File "/home/tontze/.local/lib/python3.9/site-packages/yledl/extractors.py", line 231, in get_playlist playlist = self.get_playlist_old_style_url(url, series_id) File "/home/tontze/.local/lib/python3.9/site-packages/yledl/extractors.py", line 258, in get_playlist_old_style_url html = self.httpclient.download_html_tree(url) File "/home/tontze/.local/lib/python3.9/site-packages/yledl/http.py", line 49, in download_html_tree response = self.get(url, extra_headers) File "/home/tontze/.local/lib/python3.9/site-packages/yledl/http.py", line 86, in get r = self._session.get(url, headers=headers) File "/usr/lib/python3/dist-packages/requests/sessions.py", line 555, in get return self.request('GET', url, *kwargs) File "/usr/lib/python3/dist-packages/requests/sessions.py", line 528, in request prep = self.prepare_request(req) File "/usr/lib/python3/dist-packages/requests/sessions.py", line 456, in prepare_request p.prepare( File "/usr/lib/python3/dist-packages/requests/models.py", line 316, in prepare self.prepare_url(url, params) File "/usr/lib/python3/dist-packages/requests/models.py", line 384, in prepare_url raise InvalidURL(e.args) requests.exceptions.InvalidURL: Failed to parse: https://areena.yle.fi/1-50645771

aajanki commented 2 years ago

This is quite mysterious error because obviously the URL is valid! Googling doesn't reveal any clear solution but does give two leads.

The first possible explanation is that this error often seems to occur in connection with invalid proxy settings. Do you have a proxy defined either in ~/.yledl.conf or as HTTPS_PROXY environment variable?

One bug report that I found indicates that this error can be caused by an incompatibility between an older version of "six" and "request" libraries. Can you check which version of the two libraries do you have using the pip3 freeze command? According to the bug report six version 1.15.0 or later should have the fix for this bug.

Tontze commented 2 years ago

i dont have proxy defined.

pip freeze :

android-backup==0.2.0 appdirs==1.4.4 attrs==20.3.0 bcrypt==3.2.0 bluepy==1.3.0 CacheControl==0.12.6 cachy==0.3.0 certifi==2020.6.20 cffi==1.14.5 chardet==4.0.0 cleo==0.8.1 click==7.1.2 clikit==0.6.2 ConfigArgParse==1.5.1 construct==2.10.61 crashtest==0.3.1 croniter==0.3.37 cryptography==3.4.6 defusedxml==0.6.0 distlib==0.3.1 dnspython==2.0.0 enum-compat==0.0.2 filelock==3.0.12 gpg===1.14.0-unknown gyp==0.1 html5lib==1.1 httplib2==0.18.1 idna==2.6 ifaddr==0.1.7 jeepney==0.6.0 keyring==21.8.0 lockfile==0.12.2 lxml==4.6.3 Markdown==3.3.4 msgpack==1.0.2 natsort==7.1.1 netifaces==0.10.6 packaging==20.9 paramiko==2.7.2 pastel==0.2.1 pexpect==4.8.0 pkginfo==1.7.0 poetry-core==1.0.2 ptyprocess==0.7.0 pycparser==2.18 pycurl==7.43.0.6 Pygments==2.7.1 pylev==1.3.0 PyNaCl==1.4.0 pyparsing==2.4.7 PySimpleSOAP==1.16.2 python-apt==2.1.7 python-dateutil==2.8.1 python-debian==0.1.39 python-debianbts==3.1.0 python-miio==0.5.5.1 pytz==2021.1 PyYAML==5.4.1 reportbug==7.10.3 requests==2.25.1 requests-toolbelt==0.9.1 SecretStorage==3.3.1 shellingham==1.4.0 six==1.11.0 tomlkit==0.7.0 tqdm==4.59.0 tuyaha==0.0.10 urllib3==1.26.2 virtualenv==20.4.2 webencodings==0.5.1 yle-dl==20210704 zeroconf==0.28.8

aajanki commented 2 years ago

The output shows that you have six version 1.11.0 which is older than the version where the bug was fixed. Try updating six and see if that fixes the problem.

You can update it with pip3 install --user --upgrade six. Note however that if your current six package is installed from your distros repository, you should try to install a more recent six from the same source to avoid messing up other Python software from installed from distro's repository.

aajanki commented 2 years ago

I'm closing this issue because I assume it got fixed by updating the package. Please reopen if that is not the case.