Created
November 14, 2024 13:03
-
-
Save ZTRdiamond/2bb01a35a28114102cd7b06189255258 to your computer and use it in GitHub Desktop.
Cobalt downloader tools (Free Alternatives API)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import axios from "axios"; | |
| /* | |
| Created by https://github.com/ztrdiamond ! | |
| Source: https://whatsapp.com/channel/0029VagFeoY9cDDa9ulpwM0T | |
| "Aku janji jika hapus watermark ini maka aku rela miskin hingga 7 turunan" | |
| */ | |
| async function cobalt(config) { | |
| try { | |
| return await new Promise(async(resolve, reject) => { | |
| if(!(typeof config === "object")) return reject("invalid config input, config must be json object!") | |
| config = { | |
| url: config?.url || null, | |
| videoQuality: config?.videoQuality || "720", | |
| audioFormat: config?.audioFormat || "mp3", | |
| audioBitrate: config?.audioBitrate || "128", | |
| filenameStyle: config?.filenameStyle || "classic", | |
| downloadMode: config?.downloadMode || "auto", | |
| youtubeVideoCodec: config?.youtubeVideoCodec || "h264", | |
| youtubeDubLang: config?.youtubeDubLang || "en", | |
| alwaysProxy: config?.alwaysProxy || false, | |
| disableMetadata: config?.disableMetadata || false, | |
| tiktokFullAudio: config?.tiktokFullAudio || true, | |
| tiktokH265: config?.tiktokH265 || true, | |
| twitterGif: config?.twitterGif || true, | |
| youtubeHLS: config?.youtubeHLS || false | |
| } | |
| if(!config.url) return reject("missing url input!"); | |
| axios.post("https://co.eepy.today/", config, { | |
| headers: { | |
| accept: "application/json", | |
| contentType: "application/json" | |
| } | |
| }).then(res => { | |
| const data = res.data | |
| if(data.status === "error") return reject("failed fetch content"); | |
| resolve({ | |
| success: true, | |
| result: data | |
| }) | |
| }).catch(e => { | |
| if(e?.response?.data) return reject(e.response.data.error) | |
| else return reject(e) | |
| }) | |
| }) | |
| } catch (e) { | |
| return { | |
| success: false, | |
| errors: e | |
| } | |
| } | |
| } | |
| export default cobalt; |
Author
Author
Free Alternatives API
please don't abuse all these APIs
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Cobalt Downloader Tools
Cobalt is a multifunctional tool for downloading content from social media such as Facebook, TikTok, YouTube, Bilibili, etc. This gist is a simple code to interact with the cobalt API.
Features
This gist code has several advantages that can simplify interaction and make it easier to read errors from functions or APIs
How to use
i will teach you how to use the function
Output
SUCCESSFUL RESPONSE
ERROR RESPONSE
Disclaimer
Read more about Cobalt's documentation in its repository to see the different results of each social media downloader here.
Please don't delete the watermark, thx