• If you need help or want to discuss things, you now can also join us on our Discord Server!
  • A first preview of the unlimited version of SinusBot can be found in the Upcoming Changes thread. A version for Windows will follow, but we don't have a release date, yet.

Solved Bot not playing or downloading any youtube video with most recent youtube-dl (sinus0.14)

olokos

Insider
Insider
Hello,

I've been running sinusbot since quite some time and more or less it worked fine, but since a few weeks it suddenly stopped working. I tried installing it fresh as per guide in wiki, using ts3 client both 3.2.1 and 3.2.2. I found out that something happened with instances as it said that they couldn't connect to server because invalid credentials.
Seems like deleting instances and creating them fresh solved the issue, but either !yt or !play doesnt actually play any audio through musicbot. Downloading videos using youtube-dl itself works perfectly fine, I tried it manually.
But using either !yt or !play from https://forum.sinusbot.com/resources/youtube-search.56/ only results in those logs:
Bash:
2018-09-20T07:18:22+02:00 Storing configuration.
2018-09-20T07:18:18+02:00 youtube :1017 Append to queue: wWhtcU4-xAM
2018-09-20T07:18:18+02:00 HTTP: GET https://www.googleapis.com/youtube/v3/videos?id=wWhtcU4-xAM&part=snippet%2Cstatistics%2CcontentDetails&fields=items(snippet%2Ftitle%2Csnippet%2Fdescription%2Csnippet%2FchannelTitle%2Cid%2Ckind%2Cstatistics%2CcontentDetails%2Fduration)&key=(MyActualKeyHere@olokos)
2018-09-20T07:18:18+02:00 HTTP: GET https://www.googleapis.com/youtube/v3/search?q=barbra%20streisand&part=snippet&type=video&maxResults=1&fields=items(id)&key=(MyActualKeyHere@olokos)
2018-09-20T07:18:03+02:00 2568/insufficient client permissions/i_channel_needed_description_view_power


and here's diag.sh output
https://pastebin.com/NDNG1PMs
 

flyth

is reticulating splines
Staff member
Developer
Contributor
Thema make sure you're using the same for the bot (check config.ini). It looks like your manual tests are done with another version.
 

flyth

is reticulating splines
Staff member
Developer
Contributor
From looking at the screenshots again, I think it's still using something else located in /home/sinusbot/.local

Maybe remove / rename that dir.
 

olokos

Insider
Insider
server@server:~$ cd /home/sinusbot/.local
server@server:/home/sinusbot/.local$ ls
bin etc lib share
server@server:/home/sinusbot/.local$ cd bin
server@server:/home/sinusbot/.local/bin$ ls
pip pip2 pip2.7 youtube-dl
server@server:/home/sinusbot/.local/bin$ youtube-dl --version
2018.09.18
server@server:/home/sinusbot/.local/bin$

also it seems its essential to the user account
https://askubuntu.com/questions/14535/whats-the-local-folder-for-in-my-home-directory
 

olokos

Insider
Insider
@flyth I found the problem! I was just about to report the issue on yt-dl github, which suggest to try youtube-dl with verbose flag (-v), so I tried taht.

In the meanwhile I noticed that in admin panel there's plenty of errors such as unauthorized etc so I went on and chowned the directory.

That was a start because this allowed for yt-dl output inside and outside of sinusbot panel. Then it has said the API key expired, so I deleted any and created new ones.
Still nope.

Problem was here:
Code:
server@server:/usr/local/bin$ youtube-dl --version
2018.09.18

invoking it directly in command line also results in latest version of youtube-dl
Code:
server@server:~$ youtube-dl -v https://www.youtube.com/watch?v=5RNePy_awq0
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'https://www.youtube.com/watch?v=5RNePy_awq0']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2018.09.18
[debug] Python version 2.7.x (CPython) - Linux-4.x-generic-x86_64-with-Ubuntu-x

BUT if I invoke youtube-dl using sinusbot user
Code:
sinusbot@server:/opt/sinusbot$ youtube-dl --version
2017.08.23
We can see that it's actually still using old youtube-dl for some unknown reason when pip says its up-to-date and in config.ini there's youtube-dl path defined.

I took closer look at .local which did contain youtube-dl and deleted it; after all, what's the need of it when bots dont work anyway?

Obviously youtube-dl wouldn't work anyway BUT after I restarted sinusbot it's using the correct youtube-dl again!

Please do note in wiki/guides that YoutubeDLPath variable is no longer being used. Problem solved, cheers!
 

olokos

Insider
Insider
It seems that after removing YoutubeDLPath it's saying youtube-dl unavailable like it's not there, so it is actually using this path and it has to be defined.
This is really awkward.
 

irgendwr

no longer active, "retired" staff member
is awesome!
V.I.P.
is uber awesome!
Contributor
Insider
It seems that after removing YoutubeDLPath it's saying youtube-dl unavailable like it's not there, so it is actually using this path and it has to be defined.
This is really awkward.
If you follow our guide on how to install youtube-dl (installing it in the sinusbot folder) there is no need to set the path in the config. If it's installed somewhere else you need to set the path.
 

olokos

Insider
Insider
IMO much better solution is to use pip to keep youtube-dl updated along with a cronjob which keeps it updated for me instead of just downloading the binary each time there's an update manually. (which can be done with a cronjob too - but it seems dirty)

EDIT
Anyway my suggestion is to look for youtube-dl binary in /usr/bin/local/youtube-dl by default or follow YoutubeDLPath instead of defaulting to root sinusbot location.
as per
http://rg3.github.io/youtube-dl/download.html
But of course it's all down to preference, awesome bot. Thank you for that. :)
 

irgendwr

no longer active, "retired" staff member
is awesome!
V.I.P.
is uber awesome!
Contributor
Insider
IMO much better solution is to use pip to keep youtube-dl updated along with a cronjob which keeps it updated for me instead of just downloading the binary each time there's an update manually. (which can be done with a cronjob too - but it seems dirty)
I don't get why you think the second option is worse than the first one.

1) installing pip, installing youtube-dl with pip, adding cronjob that instructs pip to update youtube-dl
2) downloading youtube-dl, adding cronjob that updates youtube-dl

To me the second option seems cleaner and more efficient than the first one since you are basically cutting out the middle man.
 

irgendwr

no longer active, "retired" staff member
is awesome!
V.I.P.
is uber awesome!
Contributor
Insider
Ah I think I know what you mean with "dirty".
If you redownload the youtube-dl binary in the cronjob: yes that's dirty.
But you can call youtube-dl with the "-U" flag and it will update itself only if there is a new version available. (that's how it's done with the linux install script)
 

olokos

Insider
Insider
Ah I think I know what you mean with "dirty".
If you redownload the youtube-dl binary in the cronjob: yes that's dirty.
But you can call youtube-dl with the "-U" flag and it will update itself only if there is a new version available. (that's how it's done with the linux install script)
Thats exactly what I thought about. I don't know what -U flag does exactly and pip resembles apt a lot, so for me it seemed like a better solution :p
 
Top