Closed KuntilBogel closed 2 months ago
Hey, i can't see why plugins wouldn't work as long as the yt-dlp you use can find and load them. And at least using the .netrc
variants for https://github.com/coletdjnz/yt-dlp-youtube-oauth2 should work, using --username
and --password
would require adding support for that, should be easy i guess.
Did it work?
I haven't tried it because im currently busy, I'll prob try it asap.
Aha, no stress! Let me know once you try
Okay, so when using the normal cli it works, but when I'm trying to use this package it does not. Kinda weird.
Yes that is strange. Some difference in environment like $HOME
etc? possible to enable debug log to see if yt-dlp complains about something? can have a look at cmd/goutubedl how to enable debug.
This is the debug output
2024/06/25 01:08:51 cmd [/usr/local/bin/yt-dlp --ignore-errors --no-call-home --no-cache-dir --skip-download --restrict-filenames --batch-file - -J]
this is the err output err [youtube+oauth2] MS91knuzoOA: Sign in to confirm your age. This video may be inappropriate for some users. errend
Is it possible to reproduce the issue in a shell using:
echo '<youtube-url-here>' | /usr/local/bin/yt-dlp --verbose --ignore-errors --no-call-home --no-cache-dir --skip-download --restrict-filenames --batch-file - -J
The yt-dlp documentations says it should say if the plugin gets loaded or not "Run yt-dlp with --verbose to check if the plugin has been loaded."
If not could you edit the go code and add --verbose
and look at the log?
Could you also share the url? tried to find some age restricted video but all a try works fine with just yt-dlp <url>
yea ill try
I tried this vid https://www.youtube.com/watch?v=MS91knuzoOA
err //Start err Golang Code
[youtube+oauth2] MS91knuzoOA: Sign in to confirm your age. This video may be inappropriate for some users.
errend //End err Golang Code
//fmt.Print() golang code
{
"id": "",
"title": "",
"url": "",
"alt_title": "",
"display_id": "",
"uploader": "",
"license": "",
"creator": "",
"release_date": "",
"timestamp": 0,
"upload_date": "",
"uploader_id": "",
"channel": "",
"channel_id": "",
"location": "",
"duration": 0,
"view_count": 0,
"like_count": 0,
"dislike_count": 0,
"repost_count": 0,
"average_rating": 0,
"comment_count": 0,
"age_limit": 0,
"is_live": false,
"start_time": 0,
"end_time": 0,
"extractor": "",
"extractor_key": "",
"epoch": 0,
"autonumber": 0,
"playlist": "",
"playlist_index": 0,
"playlist_id": "",
"playlist_title": "",
"playlist_uploader": "",
"playlist_uploader_id": "",
"chapter": "",
"chapter_number": 0,
"chapter_id": "",
"series": "",
"season": "",
"season_number": 0,
"season_id": "",
"episode": "",
"episode_number": 0,
"episode_id": "",
"track": "",
"track_number": 0,
"track_id": "",
"artist": "",
"genre": "",
"album": "",
"album_type": "",
"album_artist": "",
"disc_number": 0,
"release_year": 0,
"_type": "",
"direct": false,
"webpage_url": "",
"description": "",
"thumbnail": "",
"thumbnails": null,
"formats": null,
"subtitles": null,
"entries": null,
"ext": "",
"format": "",
"format_id": "",
"format_note": "",
"width": 0,
"height": 0,
"resolution": "",
"tbr": 0,
"abr": 0,
"acodec": "",
"asr": 0,
"vbr": 0,
"fps": 0,
"vcodec": "",
"container": "",
"filesize": 0,
"filesize_approx": 0,
"protocol": "",
"http_headers": null
}```
```shell echo '<youtube-url-here>' | /usr/local/bin/yt-dlp --verbose --ignore-errors --no-call-home --no-cache-dir --skip-download --restrict-filenames --batch-file - -J
Yes It's possible to reproduce it, this is the output
[debug] Command-line config: ['--verbose', '--ignore-errors', '--no-call-home', '--no-cache-dir', '--skip-download', '--restrict-filenames', '--batch-file', '-', '-J']
Reading URLs from STDIN - EOF (Ctrl+D) to end:
[debug] Batch file urls: ['https://www.youtube.com/watch?v=MS91knuzoOA']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version nightly@2024.06.15.232712 from yt-dlp/yt-dlp-nightly-builds [4093eb1fc] (pip)
[debug] Python 3.10.12 (CPython x86_64 64bit) - Linux-5.2.0-x86_64-with-glibc2.35 (OpenSSL 3.0.2 15 Mar 2022, glibc 2.35)
[debug] exe versions: ffmpeg 4.4.2 (setts), ffprobe 4.4.2
[debug] Optional libraries: Cryptodome-3.20.0, brotli-1.1.0, certifi-2024.06.02, mutagen-1.47.0, requests-2.32.3, secretstorage-3.3.1, sqlite3-3.37.2, urllib3-2.2.1, 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.10/dist-packages/yt_dlp_plugins']
[debug] Loaded 1821 extractors
[youtube+oauth2] Extracting URL: https://www.youtube.com/watch?v=MS91knuzoOA
[youtube+oauth2] MS91knuzoOA: Downloading webpage
[youtube+oauth2] MS91knuzoOA: Downloading ios player API JSON
[youtube+oauth2] MS91knuzoOA: Downloading tv embedded player API JSON
[youtube+oauth2] MS91knuzoOA: Downloading web embedded client config
[youtube+oauth2] MS91knuzoOA: Downloading player 61b3b5e4
[youtube+oauth2] MS91knuzoOA: Downloading web embedded player API JSON
ERROR: [youtube+oauth2] MS91knuzoOA: Sign in to confirm your age. This video may be inappropriate for some users.
File "/usr/local/lib/python3.10/dist-packages/yt_dlp/extractor/common.py", line 733, in extract
ie_result = self._real_extract(url)
File "/usr/local/lib/python3.10/dist-packages/yt_dlp/extractor/youtube.py", line 4247, in _real_extract
self.raise_no_formats(reason, expected=True)
File "/usr/local/lib/python3.10/dist-packages/yt_dlp/extractor/common.py", line 1256, in raise_no_formats
raise ExtractorError(msg, expected=expected, video_id=video_id)
null
After seeing the plugins github and yt-dlp github, I need to pass another arguments that is --netrc, and comment the "--no-cache-dir", because the plugins save all the session on yt-dlp cache dir.
This is the final args that I used
cmd := exec.CommandContext(
ctx,
ProbePath(),
// see comment below about ignoring errors for playlists
"--ignore-errors",
"--no-call-home",
// "--no-cache-dir",
"--skip-download",
"--restrict-filenames",
// provide URL via stdin for security, youtube-dl has some run command args
"--batch-file", "-",
"-J",
"--verbose",
"--netrc",
)
Thanks for testing. I guess --netrc
could be added by default or maybe an option to add it? not sure sure about removing --no-cache-dir
, have to test that a bit, don't remember why i added it. Does it work with --no-cache-dir
but is just slower as it have to requests new access token etc?
I tested it, using --no-cache-dir would mean that I need to re-auth the code using youtube tv ouath2, everytime
Alr thanks!
but I suggest adding the option to disable .netrc or/and add an option to use custom .netrc location
Yeap, and now when i think about it goutubedl should probably use same defaults as yt-dlp as much as possible. So a NetRC
bool and a NetRCLocation
string (used if not empty) option? NetRCCMD
also?
Feel free to send a PR or i will probably get to it later today or tomorrow (also remember to update README docs)
Alr thanks!
hi is this package support yt-dlp plugins? such as https://github.com/coletdjnz/yt-dlp-youtube-oauth2