Help us shape the future of Go! Take the 2026 Go Developer Survey

youtube

package module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2026 License: MIT Imports: 12 Imported by: 0

README

YouTube clients for Crawlora

Official Crawlora client packages for the hosted YouTube API. Access 14 API endpoints covering search, channels, videos, playlists, comments, captions, and transcripts from JavaScript/TypeScript, Python, Go, Ruby, Java, and PHP. These clients call Crawlora's hosted API; they do not scrape YouTube locally. Requests use your Crawlora account and CRAWLORA_API_KEY; service usage follows your account billing plan. Crawlora is independent from and not affiliated with or endorsed by YouTube or its owners.

Language packages

For installation and runnable examples, use the README for your language. See the API endpoint and parameter reference for shared operation details.

Create an account at crawlora.net, open the Crawlora console to get an API key, or read the API documentation. Keep CRAWLORA_API_KEY out of source control.

API coverage and supported endpoints

The six language clients provide access to all 14 selected public YouTube API operations. Search or browse by endpoint path and operation ID below; the complete API reference adds parameters, enums, and response details.

Method Endpoint API operation Description
GET /youtube/captions/{id} youtube-captions Retrieve auto-generated or human captions
GET /youtube/channel/{id}/playlists youtube-channel-playlists Retrieve the playlists tab for a YouTube channel
GET /youtube/channel/{id}/search youtube-channel-search Search within a YouTube channel
GET /youtube/channel/{id}/shorts youtube-channel-shorts Retrieve the shorts tab for a YouTube channel
GET /youtube/channel/{id}/videos youtube-channel-videos Retrieve the videos tab for a YouTube channel
GET /youtube/comments/{id} youtube-comments Retrieve video comments (top-level & replies)
GET /youtube/playlist/{id} youtube-playlist Retrieve playlist metadata and items
GET /youtube/profile/{id} youtube-profile Retrieve channel profile
GET /youtube/search youtube-search Search YouTube
GET /youtube/suggest youtube-suggest Suggest YouTube search queries
GET /youtube/tag/{tag} youtube-tag Retrieve YouTube videos by tag
GET /youtube/transcript/{id} youtube-transcript Retrieve transcript for a YouTube video
GET /youtube/transcript/{id}/languages youtube-transcript-languages List transcript languages for a YouTube video
GET /youtube/video/{id} youtube-video Retrieve video metadata & captions

License

MIT. See LICENSE.

Documentation

Overview

Package youtube is Crawlora's YouTube API client for 14 endpoints, covering search, channels, videos, playlists, comments, captions, and transcripts. API documentation: https://crawlora.net/docs?utm_source=pkg.go.dev&utm_medium=referral&utm_campaign=platform-clients&utm_content=youtube-go-api-docs

Index

Examples

Constants

View Source
const (
	DefaultBaseURL = "https://api.crawlora.net/api/v1"
	Version        = "0.2.0"
)
View Source
const OperationCount = 14

OperationCount reports how many selected-platform operations this module exposes.

Variables

This section is empty.

Functions

func OperationIDs

func OperationIDs() []string

OperationIDs returns the selected operation IDs in stable sorted order.

Types

type Client

type Client struct {
	APIKey     string
	BaseURL    string
	Timeout    time.Duration
	HTTPClient *http.Client
}

Client calls only the operation IDs included in this platform module.

func NewClient

func NewClient(apiKey string) *Client

NewClient creates a client using the supplied API key, or CRAWLORA_API_KEY when empty.

func (*Client) Call

func (c *Client) Call(ctx context.Context, operationID string, params Params) (any, error)

Call executes a selected platform operation by operation ID.

Example
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
	w.Header().Set("Content-Type", "application/json")
	_, _ = w.Write([]byte(`{"ok":true}`))
}))
defer server.Close()

client := NewClient("your-crawlora-api-key")
client.BaseURL = server.URL + "/api/v1"
client.HTTPClient = server.Client()
result, err := client.Call(context.Background(), "youtube-captions", Params{"id": "sample-id"})
if err != nil {
	panic(err)
}
fmt.Println(result.(map[string]any)["ok"])
Output:
true

func (*Client) Captions

func (c *Client) Captions(ctx context.Context, params Params) (any, error)

Captions calls the youtube-captions operation.

func (*Client) ChannelPlaylists

func (c *Client) ChannelPlaylists(ctx context.Context, params Params) (any, error)

ChannelPlaylists calls the youtube-channel-playlists operation.

func (*Client) ChannelSearch

func (c *Client) ChannelSearch(ctx context.Context, params Params) (any, error)

ChannelSearch calls the youtube-channel-search operation.

func (*Client) ChannelShorts

func (c *Client) ChannelShorts(ctx context.Context, params Params) (any, error)

ChannelShorts calls the youtube-channel-shorts operation.

func (*Client) ChannelVideos

func (c *Client) ChannelVideos(ctx context.Context, params Params) (any, error)

ChannelVideos calls the youtube-channel-videos operation.

func (*Client) Close

func (c *Client) Close() error

Close releases idle connections held by the configured HTTP transport.

func (*Client) Comments

func (c *Client) Comments(ctx context.Context, params Params) (any, error)

Comments calls the youtube-comments operation.

func (*Client) Playlist

func (c *Client) Playlist(ctx context.Context, params Params) (any, error)

Playlist calls the youtube-playlist operation.

func (*Client) Profile

func (c *Client) Profile(ctx context.Context, params Params) (any, error)

Profile calls the youtube-profile operation.

func (*Client) Search

func (c *Client) Search(ctx context.Context, params Params) (any, error)

Search calls the youtube-search operation.

func (*Client) Suggest

func (c *Client) Suggest(ctx context.Context, params Params) (any, error)

Suggest calls the youtube-suggest operation.

func (*Client) Tag

func (c *Client) Tag(ctx context.Context, params Params) (any, error)

Tag calls the youtube-tag operation.

func (*Client) Transcript

func (c *Client) Transcript(ctx context.Context, params Params) (any, error)

Transcript calls the youtube-transcript operation.

func (*Client) TranscriptLanguages

func (c *Client) TranscriptLanguages(ctx context.Context, params Params) (any, error)

TranscriptLanguages calls the youtube-transcript-languages operation.

func (*Client) Video

func (c *Client) Video(ctx context.Context, params Params) (any, error)

Video calls the youtube-video operation.

type Params

type Params map[string]any

Params maps the exact OpenAPI parameter names expected by this platform client.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL