Go SDK for the Supadata API - extract transcripts from YouTube, Instagram, and other video platforms.
This is an UNOFFICIAL library and is not affiliated with https://supadata.ai/
OpenAPI specification: https://supadata.ai/api/v1/openapi.json
go get github.com/petros0/supadata-gopackage main
import (
"fmt"
supadata "github.com/petros0/supadata-go"
)
func main() {
client := supadata.NewSupadata() // Will use SUPADATA_API_KEY env var
transcript, err := client.Transcript(&supadata.TranscriptParams{
Url: "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
})
if err != nil {
panic(err)
}
if transcript.IsAsync() {
fmt.Println("Job ID:", transcript.Async.JobId)
} else {
for _, segment := range transcript.Sync.Content {
fmt.Println(segment.Text)
}
}
}The project uses https://asdf-vm.com/guide/getting-started.html for version management. To set up the development environment, run:
asdf installSee the example folder for more usage examples.
To run the examples, set your API key as an environment variable and execute the main file:
export SUPADATA_API_KEY=your_api_key
go run ./exampleYou can provide your API key in two ways:
- Environment variable (recommended):
export SUPADATA_API_KEY=your_api_keyclient := supadata.NewSupadata() // Will use SUPADATA_API_KEY env var- Explicit configuration:
client := supadata.NewSupadata(
WithAPIKey("sd_..."),
WithTimeout(30*time.Second), // just override timeout of the client
)You can provide a custom HTTP client for advanced use cases:
client := supadata.NewSupadata(
WithAPIKey("sd_..."),
WithClient(
&http.Client{
Timeout: 30 * time.Second,
Transport: http.DefaultTransport,
},
),
)MIT License - see LICENSE for details.