coletdjnz / yt-dlp-youtube-oauth2

Plugin that adds OAuth2 login support to yt-dlp's YouTube extractors
The Unlicense
240 stars 26 forks source link

Still asking to Sign in after installing this plugin #16

Closed zNiGhTFuRyZNTT closed 1 month ago

zNiGhTFuRyZNTT commented 2 months ago

after I installed the plugin I noticed oauth2 was added here: [youtube+oauth2], but still encountering the issue below:

[youtube+oauth2] Extracting URL: https://www.youtube.com/watch?v=BaW_jenozKc
[youtube+oauth2] BaW_jenozKc: Downloading webpage
[youtube+oauth2] BaW_jenozKc: Downloading ios player API JSON
ERROR: [youtube+oauth2] BaW_jenozKc: Sign in to confirm you’re not a bot. This helps protect our community.

I assume this plugin must be outdated by now, isn't it?

IshanArdithya commented 2 months ago

It still works.

You need to use this: --username oauth2 --password ''.

Example: yt-dlp https://www.youtube.com/watch?v=BaW_jenozKc --username oauth2 --password ''

Arnaud69 commented 2 months ago

Hello, Same for me : i enter the code with google.com/device, and the next is down : `my_machine:~# python /usr/bin/yt-dlp -v -f b --no-cache-dir https://www.youtube.com/watch?v=id_youtube --username oauth2 --password 'password' [debug] Command-line config: ['-v', '-f', 'b', '--no-cache-dir', 'https://www.youtube.com/watch?v=id_youtube', '--username', 'PRIVATE', '--password', 'PRIVATE'] [debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8 [debug] yt-dlp version stable@2024.07.25 from yt-dlp/yt-dlp [f0993391e] [debug] Lazy loading extractors is disabled [debug] Python 3.12.2 (CPython x86_64 64bit) - Linux-4.19.0-17-amd64-x86_64-with-glibc2.28 (OpenSSL 1.1.1g 21 Apr 2020, glibc 2.28) [debug] exe versions: ffmpeg N-51907-ge27a35e045-static [debug] Optional libraries: Cryptodome-3.20.0, brotli-1.1.0, certifi-2024.07.04, mutagen-1.47.0, requests-2.32.3, sqlite3-3.27.2, urllib3-2.2.2, websockets-12.0 [debug] Proxy map: {} [debug] Request Handlers: urllib, requests, websockets [debug] Extractor Plugins: oauth2 (YoutubeBaseInfoExtractor), oauth2 (YoutubeClipIE), oauth2 (YoutubeConsentRedirectIE), oauth2 (YoutubeFavouritesIE), oauth2 (YoutubeIE), oauth2 (YoutubeMusicSearchURLIE), oauth2 (YoutubeNotificationsIE), oauth2 (YoutubeSearchDateIE), oauth2 (YoutubeSearchIE), oauth2 (YoutubeSearchURLIE), oauth2 (YoutubeTabBaseInfoExtractor), oauth2 (YoutubeTabIE) [debug] Plugin directories: ['/usr/lib/python3.12/site-packages/yt_dlp_plugins'] [debug] Loaded 1828 extractors [youtube+oauth2] oauth2: Initializing OAuth2 Authorization Flow [youtube+oauth2] To give yt-dlp access to your account, go to https://www.google.com/device and enter code JJM-RDM-ZXM [youtube+oauth2] Authorization successful [youtube+oauth2] Extracting URL: https://www.youtube.com/watch?v=id_youtube [youtube+oauth2] id_youtube: Downloading webpage [youtube+oauth2] id_youtube: Downloading ios player API JSON [youtube+oauth2] id_youtube: Downloading player 1f8742dc [debug] [youtube+oauth2] Decrypted nsig RmUP0lk4MQrpBjms0 => DivKLzC-5Wu0Eg [debug] [youtube+oauth2] Decrypted nsig nSU9MYRQG2vvDCyOk => 9McK08dpqXvJ-Q [youtube+oauth2] id_youtube: Downloading m3u8 information [debug] Sort order given by extractor: quality, res, fps, hdr:12, source, vcodec:vp9.2, channels, acodec, lang, proto [debug] Formats sorted by: hasvid, ie_pref, quality, res, fps, hdr:12(7), source, vcodec:vp9.2(10), channels, acodec, lang, proto, size, br, asr, vext, aext, hasaud, id [info] id_youtube: Downloading 1 format(s): 18 [debug] Invoking http downloader on "https://rr2---sn-4g5lzner.googlevideo.com/videoplayback?expire=1722194141&ei=fUSmZr22I8iXvdIPqNiSqAY&ip=149.202.72.187&id=long_id" [download] bla bla bla [id_youtube].mp4 has already been downloaded [download] 100% of 4.49MiB

my_machine:~# python /usr/bin/yt-dlp -v -f b --no-cache-dir https://www.youtube.com/watch?v=id_youtube --username oauth2 --password 'password' [debug] Command-line config: ['-v', '-f', 'b', '--no-cache-dir', 'https://www.youtube.com/watch?v=id_youtube', '--username', 'PRIVATE', '--password', 'PRIVATE'] [debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8 [debug] yt-dlp version stable@2024.07.25 from yt-dlp/yt-dlp [f0993391e] [debug] Lazy loading extractors is disabled [debug] Python 3.12.2 (CPython x86_64 64bit) - Linux-4.19.0-17-amd64-x86_64-with-glibc2.28 (OpenSSL 1.1.1g 21 Apr 2020, glibc 2.28) [debug] exe versions: ffmpeg N-51907-ge27a35e045-static [debug] Optional libraries: Cryptodome-3.20.0, brotli-1.1.0, certifi-2024.07.04, mutagen-1.47.0, requests-2.32.3, sqlite3-3.27.2, urllib3-2.2.2, websockets-12.0 [debug] Proxy map: {} [debug] Request Handlers: urllib, requests, websockets [debug] Extractor Plugins: oauth2 (YoutubeBaseInfoExtractor), oauth2 (YoutubeClipIE), oauth2 (YoutubeConsentRedirectIE), oauth2 (YoutubeFavouritesIE), oauth2 (YoutubeIE), oauth2 (YoutubeMusicSearchURLIE), oauth2 (YoutubeNotificationsIE), oauth2 (YoutubeSearchDateIE), oauth2 (YoutubeSearchIE), oauth2 (YoutubeSearchURLIE), oauth2 (YoutubeTabBaseInfoExtractor), oauth2 (YoutubeTabIE) [debug] Plugin directories: ['/usr/lib/python3.12/site-packages/yt_dlp_plugins'] [debug] Loaded 1828 extractors [youtube+oauth2] oauth2: Initializing OAuth2 Authorization Flow [youtube+oauth2] To give yt-dlp access to your account, go to https://www.google.com/device and enter code CCM-WSY-FJWH ^C ERROR: Interrupted by user

my_machine:~# python /usr/bin/yt-dlp -v -f b --no-cache-dir https://www.youtube.com/watch?v=id_youtube --username oauth2 --password '' [debug] Command-line config: ['-v', '-f', 'b', '--no-cache-dir', 'https://www.youtube.com/watch?v=id_youtube', '--username', 'PRIVATE', '--password', 'PRIVATE'] [debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8 [debug] yt-dlp version stable@2024.07.25 from yt-dlp/yt-dlp [f0993391e] [debug] Lazy loading extractors is disabled [debug] Python 3.12.2 (CPython x86_64 64bit) - Linux-4.19.0-17-amd64-x86_64-with-glibc2.28 (OpenSSL 1.1.1g 21 Apr 2020, glibc 2.28) [debug] exe versions: ffmpeg N-51907-ge27a35e045-static [debug] Optional libraries: Cryptodome-3.20.0, brotli-1.1.0, certifi-2024.07.04, mutagen-1.47.0, requests-2.32.3, sqlite3-3.27.2, urllib3-2.2.2, websockets-12.0 [debug] Proxy map: {} [debug] Request Handlers: urllib, requests, websockets [debug] Extractor Plugins: oauth2 (YoutubeBaseInfoExtractor), oauth2 (YoutubeClipIE), oauth2 (YoutubeConsentRedirectIE), oauth2 (YoutubeFavouritesIE), oauth2 (YoutubeIE), oauth2 (YoutubeMusicSearchURLIE), oauth2 (YoutubeNotificationsIE), oauth2 (YoutubeSearchDateIE), oauth2 (YoutubeSearchIE), oauth2 (YoutubeSearchURLIE), oauth2 (YoutubeTabBaseInfoExtractor), oauth2 (YoutubeTabIE) [debug] Plugin directories: ['/usr/lib/python3.12/site-packages/yt_dlp_plugins'] [debug] Loaded 1828 extractors [youtube+oauth2] oauth2: Initializing OAuth2 Authorization Flow [youtube+oauth2] To give yt-dlp access to your account, go to https://www.google.com/device and enter code QCM-VBD-TYY ^C ERROR: Interrupted by user `

coletdjnz commented 2 months ago

You are passing --no-cache-dir, so it is not able to cache the token

Arnaud69 commented 2 months ago

Shame on me ! Now working fine ;-)

Many thx Arno

debin-ge commented 2 months ago

hi,i have the same problem, the details show that there is an exception in plugins. Help me.

# yt-dlp -v --username mygoogle@email --password 'mypassword' youtube.com/watch?v=OrLo4FgAplU
[debug] Command-line config: ['-v', '--username', 'PRIVATE', '--password', 'PRIVATE', 'youtube.com/watch?v=OrLo4FgAplU']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2024.08.01 from yt-dlp/yt-dlp [ffd7781d6] (pip)
[debug] Python 3.8.10 (CPython x86_64 64bit) - Linux-5.4.0-189-generic-x86_64-with-glibc2.29 (OpenSSL 1.1.1f  31 Mar 2020, glibc 2.31)
[debug] exe versions: none
[debug] Optional libraries: Cryptodome-3.20.0, brotli-1.1.0, certifi-2019.11.28, mutagen-1.47.0, requests-2.32.3, secretstorage-2.3.1, sqlite3-3.31.1, urllib3-2.2.2, websockets-12.0
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests, websockets
[debug] Extractor Plugins: oauth2 (YoutubeBaseInfoExtractor), oauth2 (YoutubeClipIE), oauth2 (YoutubeConsentRedirectIE), oauth2 (YoutubeFavouritesIE), oauth2 (YoutubeIE), oauth2 (YoutubeMusicSearchURLIE), oauth2 (YoutubeNotificationsIE), oauth2 (YoutubeSearchDateIE), oauth2 (YoutubeSearchIE), oauth2 (YoutubeSearchURLIE), oauth2 (YoutubeTabBaseInfoExtractor), oauth2 (YoutubeTabIE)
[debug] Plugin directories: ['/usr/local/lib/python3.8/dist-packages/yt_dlp_plugins']
[debug] Loaded 1830 extractors
[generic] Extracting URL: youtube.com/watch?v=OrLo4FgAplU
WARNING: [generic] The url doesn't specify the protocol, trying with http
[youtube+oauth2] Extracting URL: http://youtube.com/watch?v=OrLo4FgAplU
[youtube+oauth2] OrLo4FgAplU: Downloading webpage
[youtube+oauth2] OrLo4FgAplU: Downloading ios player API JSON
[youtube+oauth2] OrLo4FgAplU: Downloading tv player API JSON
ERROR: [youtube+oauth2] OrLo4FgAplU: Sign in to confirm you’re not a bot. This helps protect our community. Learn more
  File "/usr/local/lib/python3.8/dist-packages/yt_dlp/extractor/common.py", line 740, in extract
    ie_result = self._real_extract(url)
  File "/usr/local/lib/python3.8/dist-packages/yt_dlp/extractor/youtube.py", line 4351, in _real_extract
    self.raise_no_formats(reason, expected=True)
  File "/usr/local/lib/python3.8/dist-packages/yt_dlp/extractor/common.py", line 1263, in raise_no_formats
    raise ExtractorError(msg, expected=expected, video_id=video_id)
amrutadotorg commented 2 months ago

@debin-ge use
yt-dlp -v --username oauth2 --password '' --restrict-filenames OrLo4FgAplU

interfaceuser commented 2 months ago

@amrutadotorg i use next command: yt-dlp --verbose --restrict-filenames 'i90JLhi-rc8' --merge-output-format mp4 -o "%(channel)s/%(title)s.%(ext)s" -r 1M -i https://www.youtube.com/@TillyTheCoder (username and password in yt-dlp.conf)

but i have this

[youtube+oauth2] i90JLhi-rc8: Downloading web creator player API JSON ERROR: [youtube+oauth2] i90JLhi-rc8: Sign in to confirm you’re not a bot. This helps protect our community. Learn more File "/usr/local/lib/python3.10/dist-packages/yt_dlp/extractor/common.py", line 740, in extract ie_result = self._real_extract(url) File "/usr/local/lib/python3.10/dist-packages/yt_dlp/extractor/youtube.py", line 4358, in _real_extract self.raise_no_formats(reason, expected=True) File "/usr/local/lib/python3.10/dist-packages/yt_dlp/extractor/common.py", line 1263, in raise_no_formats raise ExtractorError(msg, expected=expected, video_id=video_id)

[youtube:tab+oauth2] Extracting URL: https://www.youtube.com/@TillyTheCoder

where is my error? help me please.

Maniaz09 commented 2 months ago

You are passing --no-cache-dir, so it is not able to cache the token

How can I store the token and use it later? It's currently asking every time for login

coletdjnz commented 2 months ago

You are passing --no-cache-dir, so it is not able to cache the token

How can I store the token and use it later? It's currently asking every time for login

Don't pass --no-cache-dir