Some tracks (for example 'https://open.spotify.com/track/1Gkuz8ggxpZmfm7HSAc2qI' and the following ) are causing the following issue.
spotdl 'https://open.spotify.com/track/1Gkuz8ggxpZmfm7HSAc2qI' fails due to
pytube.exceptions.RegexMatchError: get_ytplayer_config: could not find match for config_patterns
The exact Stack Trace is the following
Click to Expand !
Fetching Song...
0%| |ETA: ?, ~min/songTraceback (most recent call last):
File "/mnt/c/Users/bills/Desktop/Dotify/backend/.env/bin/spotdl", line 8, in
sys.exit(console_entry_point())
File "/mnt/c/Users/bills/Desktop/Dotify/backend/.env/lib/python3.8/site-packages/spotdl/__main__.py", line 100, in console_entry_point
downloader.download_single_song(song)
File "/mnt/c/Users/bills/Desktop/Dotify/backend/.env/lib/python3.8/site-packages/spotdl/download/downloader.py", line 274, in download_single_song
download_song(songObj, self.displayManager, self.downloadTracker)
File "/mnt/c/Users/bills/Desktop/Dotify/backend/.env/lib/python3.8/site-packages/spotdl/download/downloader.py", line 102, in download_song
youtubeHandler = YouTube(
File "/mnt/c/Users/bills/Desktop/Dotify/backend/.env/lib/python3.8/site-packages/pytube/__main__.py", line 91, in __init__
self.prefetch()
File "/mnt/c/Users/bills/Desktop/Dotify/backend/.env/lib/python3.8/site-packages/pytube/__main__.py", line 183, in prefetch
self.js_url = extract.js_url(self.watch_html)
File "/mnt/c/Users/bills/Desktop/Dotify/backend/.env/lib/python3.8/site-packages/pytube/extract.py", line 143, in js_url
base_js = get_ytplayer_config(html)["assets"]["js"]
File "/mnt/c/Users/bills/Desktop/Dotify/backend/.env/lib/python3.8/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
I was able to trace the problem back to the pytube.__main__.prefetch method, when called through the YouTube class constructor.
_Attaching code snippet along with some values_
def prefetch(self) -> None:
"""Eagerly download all necessary data.
Eagerly executes all necessary network requests so all other
operations don't does need to make calls outside of the interpreter
which blocks for long periods of time.
:rtype: None
"""
self.watch_html = request.get(url=self.watch_url) # self.watch_url == 'https://youtube.com/watch?v=KerML5uHywU'
if self.watch_html is None:
raise VideoUnavailable(video_id=self.video_id)
self.age_restricted = extract.is_age_restricted(self.watch_html)
if not self.age_restricted and "This video is private" in self.watch_html:
raise VideoUnavailable(video_id=self.video_id)
if self.age_restricted:
if not self.embed_html:
self.embed_html = request.get(url=self.embed_url)
self.vid_info_url = extract.video_info_url_age_restricted(
self.video_id, self.watch_url
)
else:
self.vid_info_url = extract.video_info_url(
video_id=self.video_id, watch_url=self.watch_url
) # self.vid_info_url == 'https://youtube.com/get_video_info?video_id=KerML5uHywU&el=%24el&ps=default&eurl=https%253A%2F%2Fyoutube.com%2Fwatch%253Fv%253DKerML5uHywU&hl=en_US'
self.vid_info_raw = request.get(self.vid_info_url) # self.vid_info_raw == 'status=fail&reason=Invalid+parameters.&errorcode=2'
if not self.age_restricted:
self.js_url = extract.js_url(self.watch_html)
self.js = request.get(self.js_url)
As you can see the GET request returns an invalid response of status=fail&reason=Invalid+parameters.&errorcode=2, in this case.
P.S. After reading through other issues I have already given single and double quotes a try as well as installing pytube3 and/or force upgrading pytube and spotdl, with no result whatsoever
Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.98. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!
Links: app homepage, dashboard and code for this bot.
Having the same issue, already re-installed through AUR (cleanbuilt) and with pip without success
Can reproduce on Ubuntu 20.04 and Linux Mint 20
plus one
Ubuntu 20.04
File "/usr/local/lib/python3.8/dist-packages/pytube/extract.py", line 205, in get_ytplayer_config
raise RegexMatchError(
pytube.exceptions.RegexMatchError: get_ytplayer_config: could not find match for config_patterns
Try installing spotdl manually from the master branch
Try installing spotdl manually from the master branch
Directly installing from the master (pip install git+https://github.com/spotDL/spotify-downloader.git@master btw), resolved the issue on the command line level !
Any ideas, regarding why this occured in the first place, maybe ? As I'm trying to use spotdl as a library for a project of mine
Thanks in advance
I have no idea why but when installing via pip install pytube=10.0.0 and pip install pytube, while stating the same version when I pip freeze, the code is different and more specifically in pytube.__main__.
Anyways, that fixed the problem (at least for me). To be more specific, pip install pytube did !
Cool
Most helpful comment
Issue-Label Bot is automatically applying the label
bugto this issue, with a confidence of 0.98. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!Links: app homepage, dashboard and code for this bot.