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
8.07k stars 648 forks source link

Polluted by AIzaSyCIM4EzNqi1in22f4Z3Ru3iYvLaY8tc3bo API key. #1061

Closed sheeeng closed 1 year ago

sheeeng commented 4 years ago

Whenever I use my own Youtube Data API V3 API Key, it will still shows the the below output with my API Key being masked. It seems that it is not recognizing my given API Key by set api_key 000000000000000000000000000000000000000 command inside mpsyt.

  api_key           : AIzaSyCIM4EzNqi1in22f4Z3Ru3iYvLaY8tc3bo
  autoplay          : False
  set_title         : True
  mpris             : True

Invalid key or quota exceeded, '000000000000000000000000000000000000000'
➜  ~ $ brew --version
Homebrew 2.2.6
Homebrew/homebrew-core (git revision 5780; last commit 2020-02-21)
Homebrew/homebrew-cask (git revision 557b1b; last commit 2020-02-22)
➜  ~ $ mpsyt --version
mpsyt version      : 0.2.8
   notes           : released 17 February 2018
pafy version       : 0.5.5 (youtube-dl backend)
youtube-dl version : 2020.01.24
Python version     : 3.7.6 (default, Dec 30 2019, 19:38:26)
[Clang 11.0.0 (clang-1100.0.33.16)]
Processor          : i386
Machine type       : x86_64
Architecture       : 64bit,
Platform           : Darwin-19.3.0-x86_64-i386-64bit
sys.stdout.enc     : UTF-8
default enc        : utf-8
Config dir         : ${HOME}/.config/mps-youtube
env:TERM           : xterm-256color
env:SHELL          : /bin/zsh
➜  ~ $

After searching some issues online, it seems like the error is coming from one of these places.

➜  ~ $ sudo grep --recursive AIzaSyCIM4EzNqi1in22f4Z3Ru3iYvLaY8tc3bo /
grep: /usr/local/var/homebrew/linked/ghi/libexec/gems/pygments.rb-1.1.2/vendor/pygments-main/scripts/find_error.py: No such file or directory
/usr/local/var/homebrew/linked/mps-youtube/libexec/lib/python3.7/site-packages/mps_youtube/config.py:            ConfigItem("api_key", "AIzaSyCIM4EzNqi1in22f4Z3Ru3iYvLaY8tc3bo",
/usr/local/var/homebrew/linked/mps-youtube/libexec/lib/python3.7/site-packages/pafy/g.py:api_key = "AIzaSyCIM4EzNqi1in22f4Z3Ru3iYvLaY8tc3bo"
/usr/local/opt/mps-youtube/libexec/lib/python3.7/site-packages/mps_youtube/config.py:            ConfigItem("api_key", "AIzaSyCIM4EzNqi1in22f4Z3Ru3iYvLaY8tc3bo",
/usr/local/opt/mps-youtube/libexec/lib/python3.7/site-packages/pafy/g.py:api_key = "AIzaSyCIM4EzNqi1in22f4Z3Ru3iYvLaY8tc3bo"
/usr/local/Cellar/mps-youtube/0.2.8_9/libexec/lib/python3.7/site-packages/mps_youtube/config.py:            ConfigItem("api_key", "AIzaSyCIM4EzNqi1in22f4Z3Ru3iYvLaY8tc3bo",
/usr/local/Cellar/mps-youtube/0.2.8_9/libexec/lib/python3.7/site-packages/pafy/g.py:api_key = "AIzaSyCIM4EzNqi1in22f4Z3Ru3iYvLaY8tc3bo"
➜  ~ $
itaton commented 4 years ago

This seems to be the same issue as mentioned in in the last comment of #551

conceptrat commented 3 years ago

If you get the "Invalid key or quota exceeded" error then your API key won't get saved and so the original developers key is used instead.

You need to create a new Project in Google Developers Console and new Credentials and just add Youtube Data API and restrict to just that API. I'm not 100% sure why but it seems to happen if you don't use the key for a while then the Project gets disabled or the identity behind it gets dropped.