MusicBot icon indicating copy to clipboard operation
MusicBot copied to clipboard

[Feature Request] Apply cookies at the start of the bot from a config file

Open LiderKonmils opened this issue 2 years ago • 10 comments

Please tick all applicable boxes.

  • [x] I am using Python 3.5.3 or higher (run python --version on the command line)
  • [x] I have followed the official guides to install the bot for my system
  • [x] I have updated my dependencies to the latest version using the appropriate update script

Which version are you using?

  • [x] The latest master version (release-260419)
  • [ ] The latest review version

What type of issue are you creating?

  • [ ] Bug
  • [x] Feature request
  • [ ] Question

Description of issue

As i've been told (https://github.com/Just-Some-Bots/MusicBot/issues/2220) , to play restricted videos from Youtube, we need to apply cookies to a running Youtube-dl... First, i don't understand how to do that, and second, needing to do that every time i need to restart the bot is not an option for me.

Can you add a line in any config file to apply it when starting the bot?

Steps to reproduce


Log file

Please attach your MusicBot log file (located at logs/musicbot.log) to this issue. You can do so by dragging and dropping the file here. If you do not include your log file, you WILL be asked to provide one.

LiderKonmils avatar Jul 25 '21 15:07 LiderKonmils

I've solved it, after @AutumnClove message, if you want to use cookies file in order to bypass age-restriction on videos you need to download you cookies file from youtube in netscape format (i used "Get cookies.txt" extension to a browser). In order to use the cookies in MusicBot you need to add 'cookiefile': 'Cookies location', in downloader.py file located in MusicBot/musicbot/downloader.py in ytdl_format_options. Im not getting Unable to extract video data error anymore, so if you have that problem try doing that. See #2118 I'll keep this open as an possible PR for someone in hactober 🤣

AutumnClove avatar Jul 26 '21 06:07 AutumnClove

I've tried it, but since i don't have clear explainations and examples, i'Ve done something and now the bot refuse to start.

Pics of what happen

001 002 003 004 005

LiderKonmils avatar Jul 26 '21 12:07 LiderKonmils

Don't use notepad use something like notepad++, sublime text, VSC, etc and tabs not spaces.

AutumnClove avatar Jul 26 '21 14:07 AutumnClove

its not notepad tho :P

Jcodeerd avatar Jul 26 '21 14:07 Jcodeerd

What i did:

006

LiderKonmils avatar Jul 26 '21 14:07 LiderKonmils

You need to escape the '\' when writing in the path in the .py file using '\\'. So for every '\' in your path, you need to put another '\' in so you have '\\' in the end.

Example:

Raw: C:\Users\Admin\Desktop Escaped: C:\\Users\\Admin\\Desktop

DestinyofYeet avatar Jul 26 '21 15:07 DestinyofYeet

Can you send in a screenshot of what you currently have in your editor?

DestinyofYeet avatar Jul 26 '21 17:07 DestinyofYeet

Ok, i made a change, by adding a "," at the end of the line before:

image

and now, i have this:

image

LiderKonmils avatar Jul 26 '21 17:07 LiderKonmils

i think you need to specify the full path to your cookie file, like ...\\Cookie\\cookies.txt or whatever you named the file.

DestinyofYeet avatar Jul 26 '21 17:07 DestinyofYeet

Goooood, now that's working... but yeah... please, Devs, add a line in the options.ini to get the cookie file easier... for a non-programmer like me, it was a pain in the a**. And THANK YOU a lot @DestinyofYeet for your help.

LiderKonmils avatar Jul 26 '21 17:07 LiderKonmils

So I was looking into making this an option for users, but it turns out to be a bit of a pain, when trying to add the option to the downloader handler, as I can't do something like self config in ytdl setttings. I am going to close this.

BabyBoySnow avatar Aug 04 '23 17:08 BabyBoySnow