Add support of cookies arguments commands of yt-dlp "--cookies-from-browser firefox" to play restircted videos of twitter
Hello, yesterday i tried to play twitter videos because videos on twitter are very heavy and lag freeze even lowest quality in my old laptop, i tried with Qmplay2, smplayer, potplayer with 3DYD Youtube Source plugin, mpc hc, mpc be, qmplay2...all these players fails to pay twitter videos and have message that i should add cookies commands like --cookies-from-browser firefox....
i am not expert, i tired to add --cookies-from-browser firefox to the yt-dlp engines of these media players but no video playback :(
my idea please is that media player allows to support or add cookies yt-dlp commands arguments --cookies-from-browser firefox --cookies-from-browser chrome --cookies-from-browser r3dfox ........to video stream detected so we can avoid possible bugs and we could playback restirctid videos of twitter in vlc or potplayer or smplayer...thank you very much!
Hello, could you try this:
diff --git a/src/qmplay2/YouTubeDL.cpp b/src/qmplay2/YouTubeDL.cpp
index fd4a5d24..c64eb6d1 100644
--- a/src/qmplay2/YouTubeDL.cpp
+++ b/src/qmplay2/YouTubeDL.cpp
@@ -63,6 +63,7 @@ QStringList YouTubeDL::getCommonArgs()
QStringList commonArgs {
"--no-check-certificate", // Ignore SSL errors
"--user-agent", Functions::getUserAgent(),
+ "--cookies-from-browser", "firefox",
};
const char *httpProxy = getenv("http_proxy");
?
Sorry I didn't understand well, i.e. I click on ctrl+u and I put all that?
before doing that, I try with a link of a normal youtube video because I suceeded to watch bein sport live channel during the olympics games with QMPlay2 but I didn't try with a normal youtube video and it works !!!
Our so bloved QMPlay2 can playback youtube video in my windows 7 SP1 32 bits without the need of comand cookies-from-browser firefox chrome !!!! I don't know what changed, maybe new version of yt-dlp, also recently I uninstalled python (installed by elephant extension of FDM).....
I just proposed this idea of being able to add this command cookies-from-browser firefox in case there would be a future playback problem in the future, in addition I recently read a thread that advises against adding this command cookies-from-browser firefox chrome because youtube will block the video so cookies-from-browser firefox seems to have the opposite effect !!
a user said this command cookies-from-browser firefox can work provided that we are not connected and if we are logged out of our youtube account......
but we still hope, in case youtube complicates things in the future, to be able to easily add custom command please, maybe that will solve some possible problems, for the moment I close my issue of the problem of youtube playback in windows 7 32 bits, and it's up to you to decide Mr Zaps166 if this issue of adding custom command argument should be closed or left open.....
from what I've read, youtube seems to censor only ip addresses that download or use youtube too much.....a trick I found is it seems when we use aria2c and yt-dlp together, and I even added the argument cookies-from-browser firefox, we can download youtube videos and bypass possible blocking, I have used this beautiful downloader which allows us to add custom argument command and allows to add aria2c extension and combine it with yt-dlp to prove this theory :
https://github.com/mhogomchungu/media-downloader
Thanks a lot !
Hello, could you try this:
"--user-agent", Functions::getUserAgent(),
"--cookies-from-browser", "firefox",
Hah, I was just going to suggest this because it actually works (provided you're logged in to YT in firefox I presume):
> yt-dlp "https://www.youtube.com/watch?v=thx-HKhb-X8"
[youtube] Extracting URL: https://www.youtube.com/watch?v=thx-HKhb-X8
[youtube] thx-HKhb-X8: Downloading webpage
[youtube] thx-HKhb-X8: Downloading ios player API JSON
[youtube] thx-HKhb-X8: This video is age-restricted; some formats may be missing without authentication. 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
[youtube] thx-HKhb-X8: Downloading tv embedded player API JSON
[youtube] thx-HKhb-X8: Downloading mweb player API JSON
ERROR: [youtube] thx-HKhb-X8: Sign in to confirm your age. This video may be inappropriate for some users.
Exit 1
> yt-dlp --cookies-from-browser firefox "https://www.youtube.com/watch?v=thx-HKhb-X8"
Extracting cookies from firefox
Extracted 1537 cookies from firefox
[youtube] Extracting URL: https://www.youtube.com/watch?v=thx-HKhb-X8
[youtube] thx-HKhb-X8: Downloading webpage
[youtube] thx-HKhb-X8: Downloading ios player API JSON
[youtube] thx-HKhb-X8: Downloading mweb player API JSON
[youtube] thx-HKhb-X8: Downloading player 76c7a082
[youtube] thx-HKhb-X8: Downloading m3u8 information
[info] thx-HKhb-X8: Downloading 1 format(s): 135+140
[download] Destination: Differences of Alternate, Scalpel and Sarod Picking [thx-HKhb-X8].f135.mp4
[download] 100% of 75.46MiB in 00:00:10 at 7.20MiB/s
[download] Destination: Differences of Alternate, Scalpel and Sarod Picking [thx-HKhb-X8].f140.m4a
[download] 100% of 13.31MiB in 00:00:04 at 3.14MiB/s
[Merger] Merging formats into "Differences of Alternate, Scalpel and Sarod Picking [thx-HKhb-X8].mp4"
Deleting original file Differences of Alternate, Scalpel and Sarod Picking [thx-HKhb-X8].f140.m4a (pass -k to keep)
Deleting original file Differences of Alternate, Scalpel and Sarod Picking [thx-HKhb-X8].f135.mp4 (pass -k to keep)
(very curious to have an age-limit on a video about guitar picking...)
Try with these tools :
https://github.com/seproDev/yt-dlp-ChromeCookieUnlock
https://github.com/coletdjnz/yt-dlp-youtube-oauth2
https://github.com/coletdjnz/yt-dlp-get-pot
On Tuesday October 29 2024 12:04:21 trimechee wrote:
Try with these tools :
Is the --cookies-from-browser option not enough?
QMPlay2 uses its own yt-dlp copy so installing a plugin is probably going to be (much) more work than just adding an argument to its invocation!
FWIW, if the --cookies-from-browser option suffices there could be an additional simple choice in the Extensions/YouTube settings, e.g. a drop-down list with the known-supported browsers plus "none".
Yes it seems good idea 👍 💯
I'll add this option, seems to be useful.
Great ! Thanks so much Mr @zaps166 :) 💯 🥇
we hope also please our beloved QMPlay2 will be able to update automatically yt-dlp for windows 7 os 32 bits please, because Media downloader can do this with yt-dlp of Mr Nicolaasjan :
https://github.com/nicolaasjan/yt-dlp/releases
https://github.com/mhogomchungu/media-downloader
according to my research, here are the most effective tools to solve possible yt-dlp cookies problems, it seems to me it is better to make a custom yt-dlp engine by adding these rare plugins:
this solution is to add these 2 vital plugins or add an option to easily add these capital 2 vital plugins to fix cookies problems :
This repository contains a plugin package that adds support for logging into YouTube with OAuth2 to yt-dlp YouTube Extractors :
https://github.com/coletdjnz/yt-dlp-youtube-oauth2
and
A plugin framework for yt-dlp that allows the YouTube extractor to request Proof of Origin (PO) Tokens from an external source when needed. It allows for multiple providers to co-exist and provide PO Tokens for different scenarios.
https://github.com/coletdjnz/yt-dlp-get-pot
and
A yt-dlp plugin to unlock the cookie database of chromium-based browsers
https://github.com/seproDev/yt-dlp-ChromeCookieUnlock
so the risk is very serious and yt-dlp might not be able to download youtube in the near future, we hope they will be supported please, and these plugins will be optional and it is up to the user to choose with his free will to install it or not, thank you very much!
https://github.com/coletdjnz/yt-dlp-youtube-oauth2
and
https://github.com/coletdjnz/yt-dlp-get-pot
and
https://github.com/seproDev/yt-dlp-ChromeCookieUnlock
and also : we hope please the support of these rare extensions that can add cookies to download mangers :
https://github.com/zaidka/cliget https://github.com/54ac/stream-detector
and i also discover these rare new plugins that can enhance yt-dlp and make it more powerfu and support anime websites l, it will be great please to integrate some of these rare awesome plugins please in yt-dlp engine of QMPlay2 tHAT can help to decrypt some videos, thank you !
https://github.com/yt-dlp/yt-dlp-wiki/blob/master/Plugins.md https://github.com/un-def/dl-plus
https://github.com/ytdl-patched/ytdl-patched https://github.com/yt-dlp/yt-dlp/wiki/Forks
https://github.com/pratikpatel8982/yt-dlp-hianime https://github.com/pratikpatel8982/yt-dlp-mp4decrypt
https://github.com/pystardust/ani-cli
https://github.com/kemuvx/hianime-dl
https://github.com/pratikpatel8982/AnimeDownloader
https://github.com/CoolnsX/dra-cla
https://github.com/Benexl/FastAnime
https://github.com/lanlinju/Animius
https://github.com/670848654/MoviesBox https://github.com/670848654/SakuraAnime
https://github.com/open-ani/animeko
https://github.com/LifeActor/ykdl
https://github.com/Lagradost/cloudstream-3 https://github.com/saikou-app/saikou
and also I discover recently this promising project "libcurl" which allows to integrate curl webassembly in web browsers, maybe this project can help for media player interaction with the web browser :
https://github.com/ading2210/libcurl.js https://www.npmjs.com/package/libcurl.js
https://github.com/MercuryWorkshop/epoxy-tls
https://ading.dev/projects/
windows 7 os 32 bits
It's super obsolete and unsupported by upstream. You can put alternative youtube-dl manually (QMPlay2 can prevent auto-updates, I'll add it normally to settings instead of INI-only).
Great ! Yes Mr Błażej , thanks for the advice ! 💯
yes I know , it is not for pleasure that I use my little old eee pc widows 7 os, my main laptop broke down, the screen turns all green, and the new laptop models with new energy-efficient entry-level intel cpu have not yet come out, maybe next year they will come out, only the new high-end intel cpus have come out so I have to wait if I ever consider buying a new computer.....
in addition I think I should rather buy a mici pc instead of a laptop, because I don't need the battery and I can buy a 22-inch screen more comfortable than the 16-inch screen of laptops for an equivalent price and I think I have to wait a long time to see the new energy-efficient intel cpu models equip the mini pcs so I am currently forced to use my eee pc windws 7.....
I saw that the great QMPlay2 didn't forget windows 7 os 32 bts users, thanks a lot and that's why I asked for this, otherwise we hope for a quick easy to use feature to add ourselves unofficial yt-dlp for windows 7 to QMPlay2 without having to rename or dig into hidden installation path folders.....thanks!
How about this prototype?
Ohhh very excellent magnificent!!! 💯 🥇 the new feature is very easy and practical!!! we are impatiently waiting for the new stable version! thank you very much Mr @zaps166 for your great generosity to support and think for the users of the Windows OS :)
and it seems this tool :
https://github.com/un-def/dl-plus
add yt-dlp features to youtube-dl, i don't know if it is good idea to add it to QMPlay2 media player.....
"dl-plus is an extension and a drop-in replacement of youtube-dl (or any compatible fork, e.g., yt-dlp). The main goal of the project is to add an easy-to-use extractor plugin system to youtube-dl while maintaining full backward compatibility."
How about this prototype?
LGTM - unless those are the default options? ;)
Looks like I'll be having to refactor my local tweak to unpack the compressed yt-dlp "bundle" and use that instead of having to wait for the decompression every time you use the script. I suppose you're still not very interested in merging that?
unless those are the default options
Not default ofc :smile:
Looks like I'll be having to refactor my local tweak to unpack the compressed yt-dlp "bundle" and use that instead of having to wait for the decompression every time you use the script.
IMHO yt-dlp should do it automatically if has permissions to write to directory (or use TEMP until system restart)...
With custom commands user can do it manually, too.
Btw. Is your solution automated and respects auto-updates and cleans up after update?
On Saturday November 30 2024 04:51:10 Błażej Szczygieł wrote:
Not default ofc :smile:
In fact, if you know of a way to detect the user's default browser you could set the cookies-from-browser option accordingly as it will probably be what most users will want to use...
IMHO yt-dlp should do it automatically if has permissions to write to directory (or use TEMP until system restart)...
Never noticed that it does, but I agree with the principle. And the yt-dlp devs could equally rightfully state that Python should do this automatically with all compressed application bundles - it could use its own cache directories for the byte-compiled scripts for instance.
Btw. Is your solution automated and respects auto-updates and cleans up after update?
Not sure what you mean with "cleans up" (I leave the downloaded executable in place ATM) but otherwise, yes. It also does a simple check if the procedure succeeded. Of course, I'dd add ^^ https://github.com/RJVB/macstrop/blob/master/multimedia/qmplay2/files/patch-ytdlp-unpack.diff
You'll see that I only implemented it for Unix though, basically because I can't test it on MSWin.
Ok, you use unzip :smile: Maybe some day, but not for upcoming release. How about Windows - it requires to bundle unzip.exe I guess...?
On Saturday November 30 2024 05:15:53 Błażej Szczygieł wrote:
How about Windows - it requires to bundle
unzip.exeI guess...?
I suppose it should be possible to write an unzip utility in Python, or possibly even to leverage the MSWin/Explorer native support for zip files somehow. Or just consider that the unpacking overhead is really not the bottleneck on that platform anyway O:^)
Ah on Windows it's in EXE file, so it's more work (and maybe requires to install/bundle entire Python...) :sweat_smile:
Why this tool isn't written in modern C++ with some network tool or maybe use Qt? :sob: Could be like 100x faster :smile:
I want to prevent auto-downloading this tool for custom path, but is it wise to allow auto-updates for custom path?
about this commad : cookies-from-browser , i remember when i was reading yt-dlp cookies issues, some users said about chrome that we should be disconnected log out from our youtube account otherwise this command does not work, i don't know if we should also disconnect from youtube for firefox.....
I have to be logged in to youtube to make it work from firefox.
So i talked in my previous post about this rare extension open source made by a great friendly polish developer Mr @54ac :
https://github.com/54ac/stream-detector
development has been on hiatus for a year but the great developer of Stream-Detector recently told me that his extension still works without problems and that he himself uses it and that he plans to relaunch the project soon by adding several improvements.....
I mention this rare extension because amazing Stream Detector has the rare feature of adding cookies to an external program like wget, aria2c, yt-dlp and maybe QMPlay2 !.... this could be the ultimate solution if possible yt-dlp cookies probelms persist.....
Too much for now. Isn't streamlink not sufficient?
Ahh so we should be connected to youtube account if we use cookies-from-browser firefox , interesting, thanks Mr Zaps166 for the clarifiication !
For me, i think i never had yt-dlp cookies problems , because i use the default settings of Media-Downloader thnat adds the possiblity to playback the fetched link for exemple yotube video with media player like QMPLlay2 :
https://github.com/mhogomchungu/media-downloader
and i use potplayer that has internal youtube fetcher, and also the famous 3D YOUTUBE SOURCE plugin add support of yt-dlp to potplayer :
https://ys.3dyd.com/
I see that PotPlayer is not open source and it's Windows-only - it's not a reference for feature requests to me, sorry. I don't enjoy closed-source Windows software for regular users (I agree with releasing commercial software for other business use, but it's just a video player). Also I guess PotPlayer has more developers...
On Saturday November 30 2024 06:12:54 Błażej Szczygieł wrote:
I have to be logged in to youtube to make it work from firefox.
Anything else doesn't really make sense as far as I can see...
FWIW, if this feature somehow works better with Firefox: you don't actually have to use FF as your main browser. Unless it's dependent on actually running Firefox when yt-dlp tries to use the cookie(s)?
Streamlink seems good but iy is command line and i don't know how use command line......Stream Detector support also streamlink !! ....
i remember Gridplayer has added support native support for streamlink but gridplayer is nor more updated since a year and ytdlp not updated, and sadly gridplayer is not compatible wiht windows 7 os .....
for me, the most important thing is QMPlay2 support yt-dlp for windows 7 os 32 bits and thanks Mr Błażej for adding this vital feature :) 💯 🥇
yes , potplayer is apparently a subsidiary of a big famous korean entertainment company, and the developer is the inventor of the famous kmlayer, after the sale of kmplayer, the developer seems to have developed potplayer.....it says in the past potplayer displayed ads but does not do so anymore.....potplayer seems better than vlc, potplayer supports youtube, uses few resources and improves video quality, has keyboard and mouse shortcuts, has more customizations than vlc.....
and potplayer allows us to quickly add an external audio to the video only file, unlike vlc whose external audio procedure is very complicated and tedious ....because some video downloaders extensions cannot merge audio and video files and this feature add external audio becomes very useful .....
vlc currently cannot stretch video and cannot remove black bars, i tried vlc zoom which erases part of the video, I have tried many things, different aspect ratio, settings .... , stretch doesn't work, but potplayer can stretch video and remove black bars, but vlc beats potplayer in one thing: sometimes some streaming sites have separate streams audio only and video only, to play these files and have a video with sound, for example by copying the M3U8 link detected by the cat catch or live stream downloader or open in vlc extension, the stream can't be playback in potplayer, but in vlc, if I go to advanced settings, GNU TLS/I choose priority to fast encryption, I can playback this particular kind of encrypted hls video.....
we hope that our beloved QMPLay2 can do such things if the developer of Cat-Catch or Open in vlc add QMPLAY2 support, I already asked Mr Andy the developer of Open in vlc extension to add QMPLAY2 support.....
https://github.com/andy-portmen/open-in-vlc
I just upgraded, and had to look for the cookies option - I expected it with the other YouTube options... :D