MusicBot
MusicBot copied to clipboard
[Feature Request] Apply cookies at the start of the bot from a config file
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.
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 🤣
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
Don't use notepad use something like notepad++, sublime text, VSC, etc and tabs not spaces.
its not notepad tho :P
What i did:
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
Can you send in a screenshot of what you currently have in your editor?
Ok, i made a change, by adding a "," at the end of the line before:
and now, i have this:
i think you need to specify the full path to your cookie file, like ...\\Cookie\\cookies.txt
or whatever you named the file.
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.
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.