• 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.

EN [SOLVED][API] add url and download

Status
Not open for further replies.

Dotty

New Member
Hi,
I'm writing a script that given a Youtube url get the mp3 file
(this part il done, I have an api pointing to the mp3 file url given the Youtube link)
and here is my problem: I want sinusbot to download this file and add it to the list.
But this api end-point "http://127.0.0.1:8087/api/v1/bot/url" is not working ( because it's not a youtube link or a link that youtube-dl can understand)

And here is a strange thing, I tried to use youtube-dl myself to download and read the file from the url and it works fine in CLI ($ youtube-dl http://myurltomp3/)

Can I get some help here ? :)
Thanks.

Dotty
 

Dotty

New Member
Me again,

here is the angular code of Sinusbot itself:

Code:
$scope.addDLJob = function(a) {
        $http({
            url: "/api/v1/bot/jobs",
            method: "POST",
            data: {
                url: a
            },
            headers: {
                "Content-Type": "application/json"
            }
        }).success(function(a) {
            a && a.success ? $scope.dlJobUrl = "" : $alert({
                title: t("Download"),
                content: t("Failed. Too many jobs in queue."),
                type: "warning",
                show: !0,
                placement: "top-right",
                duration: 5
            })
        })
    }

I use exactly the same, header, parameters and method, but my script fails and the web-service of sinusbot got it wright.
This is very irritating :/
 

Dotty

New Member
I know where to find the doc, any way I solved my problem don't know exactly what was wrong I was so tired when I fixed it, sorry can't help anyone :/
 
Status
Not open for further replies.
Top