alexta69 / metube

Self-hosted YouTube downloader (web UI for youtube-dl / yt-dlp)
GNU Affero General Public License v3.0
6.82k stars 428 forks source link

Issue with using --Cookies #47

Closed Hawkins1212 closed 3 years ago

Hawkins1212 commented 3 years ago

Trying to pull a video from DiscoveryPlus using link and receive an error: image

I've reviewed and I believe I need to use the command line --cookies and link it to the cookies for my URL after I login. I've done this and pulled the info into a "cookies.txt" file.

Then I go into the console of Metube in Unraid and type the command:/app # yt-dlp --cookies cookies.txt https://www.discoveryplus.com/video/...." which should pull the video file. When I do this, I get the same error: "This video is only available for registered users. You may want to use --cookies."

I am guessing my cookies file is not being found by Metube. What directory do we put the cookies file in so Metube can find it?

Thanks,

alexta69 commented 3 years ago

If you're using the yt-dlp command line, then why do you need MeTube? It'll be a lot easier to just download it and use it directly. In order to use it from inside MeTube, you have to mount the cookies.txt file from the outside. And also make sure it downloads into an externally mounted folder. But again, it will be a lot simpler to not use MeTube at all, and just use yt-dlp.

Hawkins1212 commented 3 years ago

I guess that's valid however, I prefer to use MeTube if possible due to the GUI, ease of use with Unraid, etc. I've never used yt-dlp and simply went to the command lines only to see if I can figure out the cookies issue. The GUI worked perfectly for me for "non-registered" items like youtube, etc. and I am looking to expand the use to Discovery Plus. Currently, I have my downloads going to my cache drive mounted folder. When you indicate I need to mount cookies.txt file from the outside, I am not sure I understand what you mean. Is this something that's set up (ie. port, variable, etc) in Unraid? I am more of a novice and trying to figure things about but a kick in the right direction would be helpful.

Thanks for your time!

alexta69 commented 3 years ago

I'm not familiar with Unraid specifically, so I can't really say how exactly it's done there. But the idea is that just as you mount your /downloads folder as a docker volume, you need to mount the cookies file into the container in the same way (as a volume). Let's say you mount it in the root directory as /cookies.txt in the container. Then you can instruct the yt-dlp copy that MeTube runs to use this cookie file. That you will have to do via the YTDL_OPTIONS environment variable. You'll have to set it to {"cookiefile":"/cookies.txt"}. If you're doing it directly via YAML, make sure you properly escape this string. This is the MeTube side of things; as to how to make all this happen in Unraid I don't know -- perhaps ask someone who's familiar with that platform, forward them these instructions and maybe they can translate them into the Unraid system.

Hawkins1212 commented 3 years ago

Thank you. I appreciate your time in helping this. I'll take what you said do do some trial and error. Thanks!

Hawkins1212 commented 3 years ago

You mentioned "YTDL_OPTIONS" as being the environment variable value; however the logs say "YTDL_OPTIONS is invalid"

Is this meant to be YTDL_FORMAT_OPTIONS?

alexta69 commented 3 years ago

I just answered in the Unraid forums thread (I guess it doesn't show yet because it has to go through moderation). I'll paste it here as well:

@Hawkins12, as I said I know nothing about Unraid but still these don't look right... In the mount section, I think you want to use /mnt/user/Downloads/MeTube/cookies.txt as the host path. And in the environment variable section, you'll probably want YTDL_OPTIONS as the key, and the JSON string {"cookiefile":"/cookies.txt"} as the value.

auanasgheps commented 3 years ago

Hi, I'm having trouble using this option, coming from #32

However, TikTok videos still fail. immagine

This is the first time doing this so I might be missing something obvious. I'm trying with a generic video like this one

alexta69 commented 3 years ago

Can you try running yt-dlp from the command line within the container to download the video, specifying the cookie file via the --cookies argument? This will tell us whether it's a general problem with yt-dlp not being able to use these cookies to download the video properly, or whether it's a specific problem with the way MeTube invokes yt-dlp.

auanasgheps commented 3 years ago

Can you try running yt-dlp from the command line within the container to download the video, specifying the cookie file via the --cookies argument? This will tell us whether it's a general problem with yt-dlp not being able to use these cookies to download the video properly, or whether it's a specific problem with the way MeTube invokes yt-dlp.

Can I do this from the container terminal or should I install yt-dlp on my PC?

alexta69 commented 3 years ago

Within the container (the same place where you checked for the existence of the cookie file in the screenshot above, I assumed you used docker exec to run a shell within the container, right?) You should have the yt-dlp command ready there.

auanasgheps commented 3 years ago

So ironic, Tiktok is down now. Will try later!

auanasgheps commented 3 years ago

Yes, I get the same error. Should I file an issue with yt-dlp? Here's a verbosed screenshot immagine

auanasgheps commented 3 years ago

EDIT: ok, it's broken in yt-dlp 2021.09.02. they have already committed the fix but it's yet to be released.

https://github.com/yt-dlp/yt-dlp/issues/971

Apparently TikTow won't even require a cookie.

Sorry for jumping in this case.

alexta69 commented 3 years ago

No problem. Glad you figured it out.