Skip to content
This repository has been archived by the owner on Oct 31, 2022. It is now read-only.

Execption on downloading #4

Open
1 of 4 tasks
heinovski opened this issue Feb 11, 2021 · 8 comments
Open
1 of 4 tasks

Execption on downloading #4

heinovski opened this issue Feb 11, 2021 · 8 comments

Comments

@heinovski
Copy link

heinovski commented Feb 11, 2021

What is the purpose of your issue?

  • Bug
  • Feature Request
  • Question
  • Other

Description

I made sure to uninstall all other version of spotdl and installed the script directly from the master

pip3 install git+https://github.com/ritiek/spotify-downloader.git   

The script nicely matched a song from YouTube but fails to download it after reading its metadata (see below).

Log

spotdl -s https://open.spotify.com/track/6NvEiMGiidYHDN3BQKG8XT -ll DEBUG                                                                                                                  281ms < Thu 10:20
DEBUG:spotdl.command_line.__main__:24:
spotdl 2.2.2

DEBUG:spotdl.authorize.services.spotify:71:
Setting master Spotify credentials.

DEBUG:spotdl.command_line.core:130:
Received arguments:
{'manual': False, 'no_metadata': False, 'no_encode': False, 'overwrite': 'prompt', 'quality': 'best', 'input_ext': 'automatic', 'output_ext': 'mp3', 'write_to': None, 'trim_silence': False, 'search_format': '{artist} - {track-name} lyrics', 'dry_run': False, 'no_spaces': False, 'output_file': '{artist} - {track-name}.{output-ext}', 'skip_file': None, 'write_successful_file': None, 'spotify_client_id': 'XXX', 'spotify_client_secret': 'XXX', 'log_level': 'DEBUG', 'song': ['https://open.spotify.com/track/6NvEiMGiidYHDN3BQKG8XT'], 'list': None, 'playlist': None, 'album': None, 'all_albums': None, 'username': None, 'write_m3u': False, 'processor': 'synchronous', 'remove_config': False}

DEBUG:spotdl.authorize.services.spotify:66:
Reading cached master Spotify credentials.

INFO:spotdl.command_line.core:140:
Downloading "https://open.spotify.com/track/6NvEiMGiidYHDN3BQKG8XT"

DEBUG:spotdl.authorize.services.spotify:66:
Reading cached master Spotify credentials.

DEBUG:spotdl.metadata_search:283:
Extracting YouTube and Spotify metadata for input Spotify URI.

DEBUG:spotdl.metadata_search:346:
Extracting Spotify metadata for input Spotify URI.

DEBUG:spotdl.metadata.providers.spotify:77:
Fetching Spotify metadata for "https://open.spotify.com/track/6NvEiMGiidYHDN3BQKG8XT".

DEBUG:spotdl.metadata.providers.youtube:229:
Fetching YouTube results for "Dima Sick - Fat lyrics" at "https://www.youtube.com/results?sp=EgIQAQ%253D%253D&q=Dima%20Sick%20-%20Fat%20lyrics".

DEBUG:spotdl.metadata.providers.youtube:186:
YouTube returned malformed HTML. Attempting to parse possible JSON data.

DEBUG:spotdl.metadata.providers.youtube:59:
Matched with: Dima Sick - Fat (https://www.youtube.com/watch?v=W__WYY1OA7Y) [2:33]

DEBUG:spotdl.metadata.providers.youtube:417:
Fetching YouTube metadata for "https://www.youtube.com/watch?v=W__WYY1OA7Y".

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/home/XXX/.local/lib/python3.6/site-packages/spotdl/util.py", line 39, in run
    **self._kwargs
  File "/home/XXX/.local/lib/python3.6/site-packages/spotdl/command_line/core.py", line 349, in threaded_metadata
    metadata = search_metadata.on_youtube_and_spotify()
  File "/home/XXX/.local/lib/python3.6/site-packages/spotdl/metadata_search.py", line 159, in on_youtube_and_spotify
    metadata = caller(self.track)
  File "/home/XXX/.local/lib/python3.6/site-packages/spotdl/metadata_search.py", line 287, in _on_youtube_and_spotify_for_type_spotify
    youtube_metadata = self.providers["youtube"].from_url(youtube_video["url"])
  File "/home/XXX/.local/lib/python3.6/site-packages/spotdl/metadata/providers/youtube.py", line 419, in from_url
    content = pytube.YouTube(url)
  File "/home/XXX/.local/lib/python3.6/site-packages/pytube/__main__.py", line 91, in __init__
    self.prefetch()
  File "/home/XXX/.local/lib/python3.6/site-packages/pytube/__main__.py", line 183, in prefetch
    self.js_url = extract.js_url(self.watch_html)
  File "/home/XXX/.local/lib/python3.6/site-packages/pytube/extract.py", line 143, in js_url
    base_js = get_ytplayer_config(html)["assets"]["js"]
  File "/home/XXX/.local/lib/python3.6/site-packages/pytube/extract.py", line 202, in get_ytplayer_config
    raise RegexMatchError(caller="get_ytplayer_config", pattern="config_patterns")
pytube.exceptions.RegexMatchError: get_ytplayer_config: could not find match for config_patterns
@ritiek
Copy link
Owner

ritiek commented Feb 12, 2021

Make sure you have the latest pytube installed from git source:

$ pip3 install git+https://github.com/pytube/pytube

and spotdl should probably work now.

@heinovski
Copy link
Author

Indeed that solved the problem. Please note that I had to install pytube after installing spotdl, since spotdl also installs pytube3, which does not work and gives the above error.

@long-blade
Copy link

Problem on downloading

INFO: 42. Downloading "https://open.spotify.com/track/0Ef2p9uLJoKRIzq6khz70s"
Exception in thread Thread-42:
Traceback (most recent call last):
  File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner
    self.run()
  File "/home/michael/.local/lib/python3.9/site-packages/spotdl/util.py", line 37, in run
    self._return = self._target(
  File "/home/michael/.local/lib/python3.9/site-packages/spotdl/command_line/core.py", line 349, in threaded_metadata
    metadata = search_metadata.on_youtube_and_spotify()
  File "/home/michael/.local/lib/python3.9/site-packages/spotdl/metadata_search.py", line 159, in on_youtube_and_spotify
    metadata = caller(self.track)
  File "/home/michael/.local/lib/python3.9/site-packages/spotdl/metadata_search.py", line 287, in _on_youtube_and_spotify_for_type_spotify
    youtube_metadata = self.providers["youtube"].from_url(youtube_video["url"])
  File "/home/michael/.local/lib/python3.9/site-packages/spotdl/metadata/providers/youtube.py", line 419, in from_url
    content = pytube.YouTube(url)
  File "/home/michael/.local/lib/python3.9/site-packages/pytube/__main__.py", line 91, in __init__
    self.prefetch()
  File "/home/michael/.local/lib/python3.9/site-packages/pytube/__main__.py", line 181, in prefetch
    self.vid_info_raw = request.get(self.vid_info_url)
  File "/home/michael/.local/lib/python3.9/site-packages/pytube/request.py", line 36, in get
    return _execute_request(url).read().decode("utf-8")
  File "/home/michael/.local/lib/python3.9/site-packages/pytube/request.py", line 24, in _execute_request
    return urlopen(request)  # nosec
  File "/usr/lib/python3.9/urllib/request.py", line 214, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.9/urllib/request.py", line 523, in open
    response = meth(req, response)
  File "/usr/lib/python3.9/urllib/request.py", line 632, in http_response
    response = self.parent.error(
  File "/usr/lib/python3.9/urllib/request.py", line 555, in error
    result = self._call_chain(*args)
  File "/usr/lib/python3.9/urllib/request.py", line 494, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.9/urllib/request.py", line 747, in http_error_302
    return self.parent.open(new, timeout=req.timeout)
  File "/usr/lib/python3.9/urllib/request.py", line 523, in open
    response = meth(req, response)
  File "/usr/lib/python3.9/urllib/request.py", line 632, in http_response
    response = self.parent.error(
  File "/usr/lib/python3.9/urllib/request.py", line 561, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.9/urllib/request.py", line 494, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.9/urllib/request.py", line 641, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found

@Explosion-Scratch
Copy link

Problem on downloading

INFO: 42. Downloading "https://open.spotify.com/track/0Ef2p9uLJoKRIzq6khz70s"
Exception in thread Thread-42:
Traceback (most recent call last):
  File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner
    self.run()
  File "/home/michael/.local/lib/python3.9/site-packages/spotdl/util.py", line 37, in run
    self._return = self._target(
  File "/home/michael/.local/lib/python3.9/site-packages/spotdl/command_line/core.py", line 349, in threaded_metadata
    metadata = search_metadata.on_youtube_and_spotify()
  File "/home/michael/.local/lib/python3.9/site-packages/spotdl/metadata_search.py", line 159, in on_youtube_and_spotify
    metadata = caller(self.track)
  File "/home/michael/.local/lib/python3.9/site-packages/spotdl/metadata_search.py", line 287, in _on_youtube_and_spotify_for_type_spotify
    youtube_metadata = self.providers["youtube"].from_url(youtube_video["url"])
  File "/home/michael/.local/lib/python3.9/site-packages/spotdl/metadata/providers/youtube.py", line 419, in from_url
    content = pytube.YouTube(url)
  File "/home/michael/.local/lib/python3.9/site-packages/pytube/__main__.py", line 91, in __init__
    self.prefetch()
  File "/home/michael/.local/lib/python3.9/site-packages/pytube/__main__.py", line 181, in prefetch
    self.vid_info_raw = request.get(self.vid_info_url)
  File "/home/michael/.local/lib/python3.9/site-packages/pytube/request.py", line 36, in get
    return _execute_request(url).read().decode("utf-8")
  File "/home/michael/.local/lib/python3.9/site-packages/pytube/request.py", line 24, in _execute_request
    return urlopen(request)  # nosec
  File "/usr/lib/python3.9/urllib/request.py", line 214, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.9/urllib/request.py", line 523, in open
    response = meth(req, response)
  File "/usr/lib/python3.9/urllib/request.py", line 632, in http_response
    response = self.parent.error(
  File "/usr/lib/python3.9/urllib/request.py", line 555, in error
    result = self._call_chain(*args)
  File "/usr/lib/python3.9/urllib/request.py", line 494, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.9/urllib/request.py", line 747, in http_error_302
    return self.parent.open(new, timeout=req.timeout)
  File "/usr/lib/python3.9/urllib/request.py", line 523, in open
    response = meth(req, response)
  File "/usr/lib/python3.9/urllib/request.py", line 632, in http_response
    response = self.parent.error(
  File "/usr/lib/python3.9/urllib/request.py", line 561, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.9/urllib/request.py", line 494, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.9/urllib/request.py", line 641, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found

Same here

@paulheg
Copy link

paulheg commented Jul 5, 2021

I had the same issue, try installing pytube as @ritiek suggested, worked for me.

pip install pytube

or

pip install --upgrade pytube

@1amsv
Copy link

1amsv commented Jul 6, 2021 via email

@sideslip-it
Copy link

sideslip-it commented Jul 30, 2021

I have tried this but still get the error

urllib.error.HTTPError: HTTP Error 404: Not Found

$ spotdl -V
spotdl 2.2.2

$ pytube --version
pytube 10.9.3

5.8.0-63-generic spotDL#71~20.04.1-Ubuntu SMP Thu Jul 15 17:46:08 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Similar errors with latest project

https://githubmemory.com/repo/spotDL/spotify-downloader/issues/1342?page=2

@paulheg
Copy link

paulheg commented Jan 22, 2022

As of right now there is an issue with pytube again
pytube.exceptions.RegexMatchError: __init__: could not find match for ^\w+\W
see pytube/pytube#1199 how to fix it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants