{"id":20504683,"url":"https://github.com/lostdusty/gobalt","last_synced_at":"2025-04-13T20:50:36.583Z","repository":{"id":214997067,"uuid":"737802271","full_name":"lostdusty/gobalt","owner":"lostdusty","description":"Go library to work with the HTTP API of cobalt.tools","archived":false,"fork":false,"pushed_at":"2024-12-29T22:37:41.000Z","size":63,"stargazers_count":22,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"v2","last_synced_at":"2025-03-27T11:12:27.840Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lostdusty.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-01T14:58:47.000Z","updated_at":"2025-03-05T12:54:24.000Z","dependencies_parsed_at":"2024-01-01T20:32:10.825Z","dependency_job_id":"85e7416d-d6af-4c17-8112-b32639785708","html_url":"https://github.com/lostdusty/gobalt","commit_stats":null,"previous_names":["princessmortix/gobalt","lostdusty/gobalt"],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lostdusty%2Fgobalt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lostdusty%2Fgobalt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lostdusty%2Fgobalt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lostdusty%2Fgobalt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lostdusty","download_url":"https://codeload.github.com/lostdusty/gobalt/tar.gz/refs/heads/v2","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248782278,"owners_count":21160716,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T19:39:36.827Z","updated_at":"2025-04-13T20:50:36.565Z","avatar_url":"https://github.com/lostdusty.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\u003ca href=\"https://pkg.go.dev/github.com/lostdusty/gobalt/v2\" title=\"Go API Reference\" rel=\"nofollow\"\u003e\u003cimg src=\"https://img.shields.io/badge/go-documentation-blue.svg?style=for-the-badge\" alt=\"Go API Reference\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/lostdusty/gobalt/releases/lastest\" title=\"Latest Release\" rel=\"nofollow\"\u003e\u003cimg src=\"https://img.shields.io/github/v/release/lostdusty/gobalt?include_prereleases\u0026style=for-the-badge\" alt=\"Latest Release\"\u003e\u003c/a\u003e\n\n[![Static Badge](https://img.shields.io/badge/cobalt_discord-join-blue?style=for-the-badge\u0026logo=discord)](https://discord.gg/pQPt8HBUPu)\n[![Static Badge](https://img.shields.io/badge/supported-services-0077b6?style=for-the-badge\u0026logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2NDAgNTEyIj48IS0tIUZvbnQgQXdlc29tZSBGcmVlIDYuNS4xIGJ5IEBmb250YXdlc29tZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tIExpY2Vuc2UgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbS9saWNlbnNlL2ZyZ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LjUtMjA0LjUgMEw2MC4yIDI0NC4zeiIvPjwvc3ZnPg%3D%3D\u0026logoColor=0077b6)](https://github.com/wukko/cobalt?tab=readme-ov-file#supported-services)\n\u003ch1\u003egobalt v2\u003c/h1\u003e\n\u003cp\u003e(cobalt api v10.0.0+)\u003c/p\u003e\n\u003c/div\u003e\n\n\u003e [!NOTE]  \n\u003e This is the version 2 of the gobalt library, intended for interecting with cobalt recent version (v10.0.0 and up). If you're upgrading from v1, note that there some breaking changes.\n\u003e\n\u003e This version IS NOT compatible with cobalt previous version (v7.15 and lower), use the v1 version if you want to use the older api, it will be maintained until 31/December/2024.\n\nGobalt provides a way to communicate with [cobalt.tools](https://cobalt.tools) using Go. To use it in your projects, simply run this command:\n```sh\ngo get -u github.com/lostdusty/gobalt/v2\n```\n\n## Usage\nFirst, make sure you call `gobalt.CreateDefaultSettings()` to create the `Settings` struct with default values, then set an url.\n\n```go\n//Creates a Settings struct with default values, and save it to downloadMedia variable.\ndownloadMedia := gobalt.CreateDefaultSettings()\n\n//Sets the URL, you MUST set one before downloading the media.\ndownloadMedia.Url = \"https://www.youtube.com/watch?v=dQw4w9WgXcQ\"\n\n//After changing the url, Do() will make the necessary requests to cobalt to download your media\ndestination, err := gobalt.Do(downloadMedia)\nif err != nil {\n    //Handle errors here\n}\n\n//Prints out the url from cobalt to download the requested media.\nfmt.Println(destination.URL)\n//Output example: https://us4-co.wuk.sh/api/stream?t=wTn-71aaWAcV2RBejNFNV\u0026e=1711777798864\u0026h=fMtwwtW8AUmtTLB24DGjJJjrq1EJDBFaCDoDuZpX0pA\u0026s=_YVZhz8fnzBBKKo7UZmGWOqfe4wWwH5P1azdgBqwf-I\u0026i=6tGZqAXbW08_6KmAiLevZA\n```\n\n## Features\n### Server info\nYou can query information about any cobalt server by using `CobaltServerInfo(apiurl)`. This will return a `ServerInfo` struct with [this info](https://github.com/wukko/cobalt/blob/current/docs/api.md#response-body-variables-1).\n\nExample code:\n```go\nserver, err := gobalt.CobaltServerInfo(gobalt.CobaltApi)\nif err != nil {\n\t //Handle the error here\n}\nfmt.Printf(\"Downloading from %v!\\n\", server.URL)\n//Output: Downloading from https://us4-co.wuk.sh/!\n```\n\n### Use/Query other cobalt instances\nUsing `GetCobaltInstances()` fetches a community maintaned list of third-party cobalt instances ran by the community, except for ``*-co.wuk.sh``, none of them are \"official\" cobalt instances. Use them if you can't download from the main instance for whatever reason.\n\nExample:\n```go\ncobalt, err := gobalt.GetCobaltInstances()\nif err != nil { \n    //Handle errors here\n}\nfmt.Printf(\"Found %v online cobalt servers: \", len(cobalt))\nfor _, value := range cobalt {\n\tfmt.Printf(\"%v, \", value.URL)\n}\n/* Output: \n* Found 8 online cobalt servers: co.wuk.sh, cobalt-api.hyper.lol, cobalt.api.timelessnesses.me, api-dl.cgm.rs, cobalt.synzr.space, capi.oak.li, co.tskau.team, api.co.rooot.gay\n*/\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flostdusty%2Fgobalt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flostdusty%2Fgobalt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flostdusty%2Fgobalt/lists"}