Deprecated: Use of "parent" in callables is deprecated in /var/www/html/forum/src/vendor/league/flysystem-eventable-filesystem/src/EventableFilesystem.php on line 431
  • 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 [Scripting/HTTP API] Getting YouTube URL of a cached video.

IronicPickle

Active Member
SinusBot Version: 0.14.0-be7bbc4
OS: Linux Unbuntu 16.04.4

Hello,

Was hoping if anyone could shine some light on an issue I've been having with both APIs.
When obtaining track info through either the scripting or HTTP API, it's possible to get the URL of a YouTube video using the following methods:
Scripting:
var media = require('media');
media.getCurrentTrack().filename();
HTTP:
Instances - Status
currentTrack > filename > YouTube URL

This however, only works when a YouTube video is downloaded through methods such as: !ytdl, otherwise the filename is empty.
I was wondering if there is any possible way of getting the YouTube URL of a track that hasn't been downloaded, only cached through methods such as: !qyt.
Am I missing something obvious? Or is it just not possible right now?

I need to be able to obtain the URL in order to sync up a YouTube player on the Web UI i'm creating, to the bot..

Also, in an attempt to potentially work around this issue, I considered writing a script with a custom queue command that would download and enqueue a video, so the filename field contains the URL, then remove it after it finishes playing. But I cannot find a method in the scripting API documentation that would allow me to remove a track with a UUID.
Not sure if I'm missing something here, or this is also not possible right now.

Thanks in advance!


*Edit:
Solved!

For anyone wondering how:
Created an internal queue handling system that stores and saves the YT URLs of queued up tracks in an Array. The array is queried with a public API request, using the first URL in the array for the web player. The array has it's first value spliced every time a track ends.
 
Last edited:
Top