spotDL / spotify-downloader

Download your Spotify playlists and songs along with album art and metadata (from YouTube if a match is found).
https://spotdl.readthedocs.io/en/latest/
MIT License
17k stars 1.56k forks source link

pytube.exceptions.RegexMatchError: get_ytplayer_config: could not find match for config_patterns #1106

Closed dylan-chong closed 3 years ago

dylan-chong commented 3 years ago

Environment

pip3 install spotdl

Name: spotdl
Version: 3.2.1
Summary: Downloads Spotify music from Youtube with metadata and album art
Home-page: https://github.com/spotDL/spotify-downloader
Author: spotDL Team
Author-email: unrealengin71+PyPi@gmail.com
License: MIT
Location: /usr/local/lib/python3.9/site-packages
Requires: tqdm, requests, ytmusicapi, rapidfuzz, spotipy, mutagen, pytube
Required-by:

Expected Behaviour

Download the playlist

Actual Behaviour

Crash

Steps to Reproduce

> spotdl-playlist https://open.spotify.com/playlist/7DGsqj2eu89Sstc5XZng5q
Fetching Playlist...
Searching for: Bobby Darin - Softly, As I Leave You - Remastered
Searching for: The Manhattan Transfer - I Know Why (And So Do You)
Searching for: Frank Sinatra, Count Basie - The Best Is Yet To Come
Searching for: Benny Goodman - Down South Camp Meetin' - Live
Searching for: Nat King Cole - Sweet Lorraine
Searching for: Coldplay - Swallowed in the Sea
Searching for: Coldplay - Square One
Searching for: Coldplay - Everything's Not Lost - Includes Hidden Track 'Life Is For Living'
Searching for: Coldplay - God Put a Smile upon Your Face
Searching for: Frankie Valli - My Eyes Adored You
Searching for: Paul Anka - Put Your Head On My Shoulder (Remastered)
Searching for: Michael Bublé - Put Your Head on My Shoulder
Searching for: Dianne Reeves, Lou Rawls - Fine Brown Frame
Searching for: Mel Tormé - Don't Get Around Much Anymore
Searching for: Bobby Darin - Hello, Dolly! - 2001 Digital Remaster
Searching for: Jazz Superstars - How High The Moon
Searching for: Jazz Superstars - The Great Lie
Searching for: Jazz Superstars - Buzzy
Searching for: Michael Bublé - Save the Last Dance for Me
Searching for: Harry Connick, Jr. - Save The Last Dance For Me
Searching for: The Drifters - Save the Last Dance for Me
Searching for: Bill Elliott Swing Orchestra - Hep Hop
Searching for: Bill Elliott Swing Orchestra - The Best Things Happen When You're Dancing (Live)
Searching for: Anita Kerr Singers - Welcome to My World
Searching for: Lynn Anderson - You Don't Have to Say You Love Me - Remastered
Searching for: Faye Wong - 曖昧
Searching for: Chiang Yu-Heng - 再回首
Searching for: The Beatles - Hey Jude
Searching for: Stevie Wonder - Superstition - Single Version
Searching for: The Walker Brothers - The Sun Ain't Gonna Shine Anymore
Searching for: Joni Mitchell - Both Sides Now
Searching for: Roberta Flack - The First Time Ever I Saw Your Face
Searching for: Hot Little Mama - Postman
Searching for: Stevie Wonder - I Just Called To Say I Love You
Searching for: Lou Rawls - Scotch & Soda
Searching for: Lou Rawls, Dianne Reeves - At Last
Searching for: Teresa Teng - 一個小心願
Searching for: Teresa Teng - 千言萬語
Searching for: Teresa Teng - 在水一方
Searching for: David Choi - That Girl
Searching for: The Police - Every Breath You Take
Searching for: Dusty Springfield - You Don't Have To Say You Love Me
Searching for: Todd Rhodes - Good Man (05-24-51)
Searching for: Teresa Teng - You Don't Have To Say You Love Me
Searching for: Teresa Teng - My Way
Searching for: Teresa Teng - 心裡夢裏
Searching for: Teresa Teng - 月亮代表我的心
Searching for: Teresa Teng - 再見!我的愛人
Searching for: Teresa Teng - 甜蜜蜜
Searching for: Teresa Teng - Ni Zenme Shoo
Searching for: Teresa Teng - 我只在乎你
Searching for: Julie London - I'm In The Mood For Love
Searching for: Doris Day, The Mellomen - If I Give My Heart to You (with The Mellomen)
Searching for: Count Basie - Blue Skies - 78rpm Version
Searching for: George Gershwin, Zubin Mehta, New York Philharmonic - Love Is Here To Stay
Searching for: Glenn Miller Orchestra - I Know Why
Searching for: Jerry Goldsmith - A New Friend
Searching for: Jerry Goldsmith - A New Ending
Searching for: Jerry Goldsmith - Remus
Searching for: The Ronettes - Baby, I Love You
Searching for: Frankie Valli & The Four Seasons - Stay
Searching for: Sam Cooke - Blue Moon - Mono
Searching for: Gordon Webster - Georgia On My Mind
Searching for: Pentatonix - Hallelujah
Searching for: Doris Day, The Mellomen - Again (with The Mellomen)
  0%|                                                                                                                                                                                                                                                                                                        |ETA: ?, ~min/songTraceback (most recent call last):
  File "/usr/local/bin/spotdl", line 8, in <module>
    sys.exit(console_entry_point())
  File "/usr/local/lib/python3.9/site-packages/spotdl/__main__.py", line 112, in console_entry_point
    downloader.download_multiple_songs(songObjList)
  File "/usr/local/lib/python3.9/site-packages/spotdl/download/downloader.py", line 93, in download_multiple_songs
    self._download_asynchronously(songObjList)
  File "/usr/local/lib/python3.9/site-packages/spotdl/download/downloader.py", line 355, in _download_asynchronously
    self.loop.run_until_complete(asyncio.gather(*tasks))
  File "/usr/local/Cellar/python@3.9/3.9.1_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.9/site-packages/spotdl/download/downloader.py", line 350, in _pool_download
    return await self.download_song(song_obj)
  File "/usr/local/lib/python3.9/site-packages/spotdl/download/downloader.py", line 176, in download_song
    youtubeHandler = YouTube(
  File "/Users/Dylan/Library/Python/3.9/lib/python/site-packages/pytube/__main__.py", line 91, in __init__
    self.prefetch()
  File "/Users/Dylan/Library/Python/3.9/lib/python/site-packages/pytube/__main__.py", line 183, in prefetch
    self.js_url = extract.js_url(self.watch_html)
  File "/Users/Dylan/Library/Python/3.9/lib/python/site-packages/pytube/extract.py", line 143, in js_url
    base_js = get_ytplayer_config(html)["assets"]["js"]
  File "/Users/Dylan/Library/Python/3.9/lib/python/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
Exception ignored in: <function tqdm.__del__ at 0x108077a60>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/tqdm/std.py", line 1124, in __del__
  File "/usr/local/lib/python3.9/site-packages/tqdm/std.py", line 1337, in close
  File "/usr/local/lib/python3.9/site-packages/tqdm/std.py", line 1516, in display
  File "/usr/local/lib/python3.9/site-packages/tqdm/std.py", line 1127, in __repr__
  File "/usr/local/lib/python3.9/site-packages/spotdl/download/progressHandlers.py", line 23, in format_dict
  File "/usr/local/lib/python3.9/site-packages/tqdm/std.py", line 1477, in format_dict
TypeError: cannot unpack non-iterable NoneType object

> pip3 list
Package                        Version
------------------------------ ---------
a-pytube-fork-for-spotdl-users 9.6.4
appdirs                        1.4.4
beautifulsoup4                 4.9.3
certifi                        2020.11.8
chardet                        3.0.4
colorama                       0.4.4
coloredlogs                    14.0
greenlet                       0.4.17
humanfriendly                  8.2
idna                           2.10
lyricwikia                     0.1.11
msgpack                        1.0.0
mutagen                        1.45.1
neovim                         0.3.1
pathlib                        1.0.1
pip                            20.3.3
pynvim                         0.4.2
pytube                         10.4.1
pytube3                        9.6.4
PyYAML                         5.3.1
rapidfuzz                      0.14.0
requests                       2.25.0
setuptools                     51.1.1
six                            1.15.0
soupsieve                      2.0.1
spotdl                         3.2.1
spotipy                        2.16.1
tqdm                           4.54.1
typing-extensions              3.7.4.3
unicode-slugify                0.1.3
Unidecode                      1.1.1
urllib3                        1.25.11
wheel                          0.36.2
youtube-dl                     2021.1.8
ytmusicapi                     0.12.2

Traceback

|ETA: ?, ~min/songTraceback (most recent call last):
  File "/usr/local/bin/spotdl", line 8, in <module>
    sys.exit(console_entry_point())
  File "/usr/local/lib/python3.9/site-packages/spotdl/__main__.py", line 112, in console_entry_point
    downloader.download_multiple_songs(songObjList)
  File "/usr/local/lib/python3.9/site-packages/spotdl/download/downloader.py", line 93, in download_multiple_songs
    self._download_asynchronously(songObjList)
  File "/usr/local/lib/python3.9/site-packages/spotdl/download/downloader.py", line 355, in _download_asynchronously
    self.loop.run_until_complete(asyncio.gather(*tasks))
  File "/usr/local/Cellar/python@3.9/3.9.1_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.9/site-packages/spotdl/download/downloader.py", line 350, in _pool_download
    return await self.download_song(song_obj)
  File "/usr/local/lib/python3.9/site-packages/spotdl/download/downloader.py", line 176, in download_song
    youtubeHandler = YouTube(
  File "/Users/Dylan/Library/Python/3.9/lib/python/site-packages/pytube/__main__.py", line 91, in __init__
    self.prefetch()
  File "/Users/Dylan/Library/Python/3.9/lib/python/site-packages/pytube/__main__.py", line 183, in prefetch
    self.js_url = extract.js_url(self.watch_html)
  File "/Users/Dylan/Library/Python/3.9/lib/python/site-packages/pytube/extract.py", line 143, in js_url
    base_js = get_ytplayer_config(html)["assets"]["js"]
  File "/Users/Dylan/Library/Python/3.9/lib/python/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
Exception ignored in: <function tqdm.__del__ at 0x108077a60>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/tqdm/std.py", line 1124, in __del__
  File "/usr/local/lib/python3.9/site-packages/tqdm/std.py", line 1337, in close
  File "/usr/local/lib/python3.9/site-packages/tqdm/std.py", line 1516, in display
  File "/usr/local/lib/python3.9/site-packages/tqdm/std.py", line 1127, in __repr__
  File "/usr/local/lib/python3.9/site-packages/spotdl/download/progressHandlers.py", line 23, in format_dict
  File "/usr/local/lib/python3.9/site-packages/tqdm/std.py", line 1477, in format_dict
TypeError: cannot unpack non-iterable NoneType object

Any other information:

Silverarmor commented 3 years ago

Duplicate of #1030. Also I note you are running spotdl-playlist [playlistUrl]. Shouldn't it be spotdl [playlistUrl]

Try the following:

  1. pip install pip-autoremove
  2. pip-autoremove spotdl
  3. pip cache purge
  4. pip install https://codeload.github.com/spotDL/spotify-downloader/zip/master
  5. pip install git+https://github.com/pytube/pytube
dylan-chong commented 3 years ago

Oops, for the record, spotdl-playlist was a function for

function spotdl-playlist() {
    mkdir spotdl-playlist && \
        cd spotdl-playlist && \
        spotdl $1
}

Will try your suggestion, thanks