[GH-ISSUE #708] New API: /api/url #6279

Closed
opened 2026-04-19 08:20:13 -05:00 by GiteaMirror · 4 comments
Owner

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

New API: /api/url

Currently when using the json API, you have to send a POST request, parse the json response, then return the url from the json response. I would like to be able to directly send a GET request to the API and get redirected to the url, for cases where you need a direct URL to the file such as Discord bots etc.

Additional Context

For compatibility of other things that use direct links (such as Discord bots etc), this needs to be supported.
I would like to be able to use it like this example, but anything else is appreciated as well:

https://api.cobalt.tools/api/url?aFormat=best&isAudioOnly=true&url=https://youtu.be/wcT7zgL6gug

image

Originally created by @SmilerRyan on GitHub (Sep 1, 2024). Original GitHub issue: https://github.com/imputnet/cobalt/issues/708 ### New API: /api/url Currently when using the json API, you have to send a POST request, parse the json response, then return the url from the json response. I would like to be able to directly send a GET request to the API and get redirected to the url, for cases where you need a direct URL to the file such as Discord bots etc. ### Additional Context For compatibility of other things that use direct links (such as Discord bots etc), this needs to be supported. I would like to be able to use it like this example, but anything else is appreciated as well: https://api.cobalt.tools/api/url?aFormat=best&isAudioOnly=true&url=https://youtu.be/wcT7zgL6gug ![image](https://github.com/user-attachments/assets/fb91b385-4b45-4ea9-87d9-730e782967af)
GiteaMirror added the duplicate label 2026-04-19 08:20:13 -05:00
Author
Owner

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

i dont think thats a good design

<!-- gh-comment-id:2323525738 --> @lostdusty commented on GitHub (Sep 1, 2024): i dont think thats a good design
Author
Owner

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

why did you make 2 issues related to 1 thing

<!-- gh-comment-id:2323526023 --> @KwiatekMiki commented on GitHub (Sep 1, 2024): why did you make 2 issues related to 1 thing
Author
Owner

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

why did you make 2 issues related to 1 thing

I posted 2 issues since whilst both feel like they are needed for me, they are both different things.
One being to accept GET parameters instead of just POST parameters, and the other to have an endpoint that redirects to a video.

i dont think thats a good design

How would prefer to do this?
My initial thought before deciding on a different endpoint was an extra json such as "redirectToUrl": true.
If it exists to redirect instead of showing the json, but it feels more right to have a different endpoint to expect a url rather than json (url only at /api/url instead of /api/json so it's less misleading).

<!-- gh-comment-id:2323530478 --> @SmilerRyan commented on GitHub (Sep 1, 2024): > why did you make 2 issues related to 1 thing I posted 2 issues since whilst both feel like they are needed for me, they are both different things. One being to accept GET parameters instead of just POST parameters, and the other to have an endpoint that redirects to a video. > i dont think thats a good design How would prefer to do this? My initial thought before deciding on a different endpoint was an extra json such as ``"redirectToUrl": true``. If it exists to redirect instead of showing the json, but it feels more right to have a different endpoint to expect a url rather than json (url only at ``/api/url`` instead of ``/api/json`` so it's less misleading).
Author
Owner

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

duplicate of #707, see my reply there

<!-- gh-comment-id:2323577026 --> @wukko commented on GitHub (Sep 2, 2024): duplicate of #707, see my reply there
Sign in to join this conversation.