[GH-ISSUE #707] Allow GET requests to the API via query string. #7765

Closed
opened 2026-04-21 19:45:23 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @SmilerRyan on GitHub (Sep 1, 2024).
Original GitHub issue: https://github.com/imputnet/cobalt/issues/707

Allow GET requests to the API via query string

Currently in order to use this for my needs, i need to have a direct url in order to download video/audio and i'd like the ability to not have to host my own relay to convert GET request (in my case with just a youtube video id) to a POST request, then redirect with the url provided.

Additional Context

For example, the Discord bot I use seems to work great when using a direct url to media rather to music now, so I have to run an API of my own that calls the Cobalt API purely to receive the URL and redirect the user to it.

Example Code

Here is how this currently looks like as a POST request vs a GET request.

// POST request get get a stream URL
await fetch("https://api.cobalt.tools/api/json", {
    headers: {
        "Accept": "application/json",
        "Content-Type": "application/json",
    },
    body: JSON.stringify({
        aFormat: "best",
        filenamePattern: "nerdy",
        isAudioOnly: "true",
        url: "https://www.youtube.com/watch?v=wcT7zgL6gug"
    }),
    method: "POST",
})
.then(response => response.json())
.then(data => console.log(data.url))

// GET Request for YouTube Stream URL
await fetch("https://api.cobalt.tools/api/json?aFormat=best&filenamePattern=nerdy&isAudioOnly=true&url=https://youtu.be/wcT7zgL6gug").then(r=>{r.json();console.log(r.url)});
Originally created by @SmilerRyan on GitHub (Sep 1, 2024). Original GitHub issue: https://github.com/imputnet/cobalt/issues/707 ### Allow GET requests to the API via query string Currently in order to use this for my needs, i need to have a direct url in order to download video/audio and i'd like the ability to not have to host my own relay to convert GET request (in my case with just a youtube video id) to a POST request, then redirect with the url provided. ### Additional Context For example, the Discord bot I use seems to work great when using a direct url to media rather to music now, so I have to run an API of my own that calls the Cobalt API purely to receive the URL and redirect the user to it. ### Example Code Here is how this currently looks like as a POST request vs a GET request. ```js // POST request get get a stream URL await fetch("https://api.cobalt.tools/api/json", { headers: { "Accept": "application/json", "Content-Type": "application/json", }, body: JSON.stringify({ aFormat: "best", filenamePattern: "nerdy", isAudioOnly: "true", url: "https://www.youtube.com/watch?v=wcT7zgL6gug" }), method: "POST", }) .then(response => response.json()) .then(data => console.log(data.url)) // GET Request for YouTube Stream URL await fetch("https://api.cobalt.tools/api/json?aFormat=best&filenamePattern=nerdy&isAudioOnly=true&url=https://youtu.be/wcT7zgL6gug").then(r=>{r.json();console.log(r.url)}); ```
GiteaMirror added the feature request label 2026-04-21 19:45:23 -05:00
Author
Owner

@lostdusty commented on GitHub (Sep 1, 2024):

for anyone reading before the comment gets deleted, DO NOT run this on your computer, its malware.
@wukko spam ^ @dumbmoron

<!-- gh-comment-id:2323526262 --> @lostdusty commented on GitHub (Sep 1, 2024): for anyone reading before the comment gets deleted, DO NOT run this on your computer, its malware. @wukko spam ^ @dumbmoron
Author
Owner

@wukko commented on GitHub (Sep 2, 2024):

we will not implement GET requests for main processing endpoint.

<!-- gh-comment-id:2323576548 --> @wukko commented on GitHub (Sep 2, 2024): we will not implement GET requests for main processing endpoint.
Sign in to join this conversation.