coletdjnz / yt-dlp-youtube-oauth2

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

Cannot figure out how to use this plugin. #13

Closed hillihappo closed 1 month ago

hillihappo commented 2 months ago

Hi all,

I'm trying to figure out how to use this plugin when doing the following command to mark videos as played:

yt-dlp --mark-watched --simulate --batch-file history.txt

It works with cookies parameter but only for a while, like a couple of hundreds of videos, but then it stops working. So I really want to use Oauth2 but I really can't get it to show me the autentication.

I've tried with the following: yt-dlp --username oauth2 --password '' --mark-watched --simulate --batch-file history.txt

I only get: WARNING: [youtube] Login with password is not supported for this website. Use --cookies-from-browser or --cookies for the authentication. See https://github.com/yt-dlp/yt-dlp/wiki/FAQ#how-do-i-pass-cookies-to-yt-dlp for how to manually pass cookies

hillihappo commented 1 month ago

I solved it myself so here is how I did it on a Windows machine.

  1. Installed ty-dlp (https://github.com/yt-dlp/yt-dlp) with PIP (https://github.com/yt-dlp/yt-dlp/wiki/Installation#with-pip). To get PIP working on Windows I followed this article
  2. I then installed the plugin with PIP - python3 -m pip install -U https://github.com/coletdjnz/yt-dlp-youtube-oauth2/archive/refs/heads/master.zip
  3. From Powershell, I went to the installation folder of yt-dlp (PIP) which was C:\Users\%USERNAME%\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\Scripts
  4. From here I saw that the plugin was loaded with yt-dlp --verbose - [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: ['C:\Users\%USERNAME%\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\yt_dlp_plugins']
  5. I run my command - yt-dlp --username oauth2 --password '' --mark-watched --simulate --batch-file history.txt - and finally got the sign in text I was hoping for meaning that the plugin was working (please note that the batch file history.txt is a Google Takeout converted file with all my YouTube watch history in URL format from my Brand YouTube account that I wanted to transfer to my Main/Primary account)
  6. I followed instructions for the login was successful and I could do the simulation

Awesome plugin, big thanks!