mps-youtube / yewtube

yewtube, forked from mps-youtube , is a Terminal based YouTube player and downloader. No Youtube API key required.
GNU General Public License v3.0
7.98k stars 643 forks source link

Troubleshooting #1182

Closed AxlMemote closed 1 year ago

AxlMemote commented 2 years ago

Hello, there was problem with quota limit so I set my own API, however, I get this whenever I start playing anything:

Exception in thread Thread-1 (_preload):                                                                                                                                                       
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1009, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 946, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.10/site-packages/mps_youtube/streams.py", line 180, in _preload
    streamlist = get(song)
  File "/usr/lib/python3.10/site-packages/mps_youtube/streams.py", line 51, in get
    p = util.get_pafy(vid, force=force, callback=callback)
  File "/usr/lib/python3.10/site-packages/mps_youtube/util.py", line 205, in get_pafy
    p = pafy.new(ytid, callback=callback_fn)
  File "/usr/lib/python3.10/site-packages/pafy/pafy.py", line 124, in new
    return Pafy(url, basic, gdata, size, callback, ydl_opts=ydl_opts)
  File "/usr/lib/python3.10/site-packages/pafy/backend_youtube_dl.py", line 31, in __init__
    super(YtdlPafy, self).__init__(*args, **kwargs)
  File "/usr/lib/python3.10/site-packages/pafy/backend_shared.py", line 97, in __init__
    self._fetch_basic()
  File "/usr/lib/python3.10/site-packages/pafy/backend_youtube_dl.py", line 54, in _fetch_basic
    self._dislikes = self._ydl_info['dislike_count']
KeyError: 'dislike_count'
Traceback (most recent call last):                                                                                                                                                             
  File "/usr/bin/mpsyt", line 33, in <module>
    sys.exit(load_entry_point('mps-youtube==0.2.8', 'console_scripts', 'mpsyt')())
  File "/usr/lib/python3.10/site-packages/mps_youtube/main.py", line 148, in main
    if matchfunction(i.function, i.regex, userinput):
  File "/usr/lib/python3.10/site-packages/mps_youtube/main.py", line 65, in matchfunction
    func(*matches)
  File "/usr/lib/python3.10/site-packages/mps_youtube/commands/play.py", line 100, in play
    play_range(songlist, shuffle, repeat, override)
  File "/usr/lib/python3.10/site-packages/mps_youtube/player.py", line 49, in play_range
    video, stream = stream_details(song, override=override, softrepeat=softrepeat)
  File "/usr/lib/python3.10/site-packages/mps_youtube/player.py", line 159, in stream_details
    streams.get(song, force=failcount, callback=screen.writestatus)
  File "/usr/lib/python3.10/site-packages/mps_youtube/streams.py", line 51, in get
    p = util.get_pafy(vid, force=force, callback=callback)
  File "/usr/lib/python3.10/site-packages/mps_youtube/util.py", line 205, in get_pafy
    p = pafy.new(ytid, callback=callback_fn)
  File "/usr/lib/python3.10/site-packages/pafy/pafy.py", line 124, in new
    return Pafy(url, basic, gdata, size, callback, ydl_opts=ydl_opts)
  File "/usr/lib/python3.10/site-packages/pafy/backend_youtube_dl.py", line 31, in __init__
    super(YtdlPafy, self).__init__(*args, **kwargs)
  File "/usr/lib/python3.10/site-packages/pafy/backend_shared.py", line 97, in __init__
    self._fetch_basic()
  File "/usr/lib/python3.10/site-packages/pafy/backend_youtube_dl.py", line 54, in _fetch_basic
    self._dislikes = self._ydl_info['dislike_count']
KeyError: 'dislike_count'
Rom1deTroyes commented 2 years ago

Youtube has changed the dislike functionality : you can still vote to dislike a video, but there is no dislike count displayed with the video, thus this key is no more available in the video description.

onixldlc commented 2 years ago

the dislike key error has been fixed... but for some reason the pafy that came with mps-youtube didnt have these changes (the fix was already from 10 months ago from today) https://github.com/mps-youtube/pafy/commit/110bf7c01dcf57ec4e6e327e0c7907a4099d6933 just replace the old backend_youtube_dl.py with the new one from https://github.com/mps-youtube/pafy/blob/110bf7c01dcf57ec4e6e327e0c7907a4099d6933/pafy/backend_youtube_dl.py

or just change the self._dislikes = self._ydl_info['dislike_count'] to self._dislikes = self._ydl_info.get('dislike_count', 0)

the default location is: /usr/local/lib/python3.8/site-packages/pafy/backend_youtube_dl.py

iamtalhaasghar commented 1 year ago

closed in favor of #1180