youtube

package module
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 11 Imported by: 0

README

YouTube clients for Crawlora

Official Crawlora client packages for the hosted YouTube API. These packages send requests to Crawlora's API and require a Crawlora account and CRAWLORA_API_KEY; service usage follows your Crawlora account billing plan.

The packages do not run a browser or scrape YouTube locally. Crawlora is an independent service and is not affiliated with or endorsed by YouTube or its owners.

Create an account at crawlora.net, open the Crawlora console to get an API key, or read the API documentation.

Install

npm install @crawlora-org/youtube
python -m pip install crawlora-youtube
go get github.com/Crawlora-org/crawlora-youtube@latest
gem install crawlora-youtube
composer require crawlora/youtube

For Java, add net.crawlora:crawlora-youtube:0.1.4 to your Maven dependencies; see java/README.md.

Set your Crawlora key in the environment before running a client:

export CRAWLORA_API_KEY="your-crawlora-api-key"

Do not commit API keys. See the language-specific READMEs for sync and async use.

PHP example

The Packagist package is available as crawlora/youtube:

composer require crawlora/youtube
<?php
require __DIR__ . '/vendor/autoload.php';

$apiKey = getenv('CRAWLORA_API_KEY');
if (!$apiKey) throw new RuntimeException('Set CRAWLORA_API_KEY before running this example.');
$client = new \Crawlora\YouTube\Client(apiKey: $apiKey);
$result = $client->request("youtube-search", ['q' => 'science explainers', 'type' => 'video']);
print_r($result);
$client->close();

The same example and install details are in php/README.md.

Run examples from a source checkout

From the repository root, set CRAWLORA_API_KEY as shown above and run:

node examples/javascript.mjs
python -m pip install ./python
python examples/python.py

The checked-in JavaScript example imports the generated local source at javascript/src/index.js. The Python command installs this checkout's package before running its example. Every language-specific README also includes an install snippet and a client call for the corresponding registry package.

Contract

This package release is 0.1.4. The generated client methods follow the bundled openapi/public.json contract at revision sha256:677d4bc412f42cf0083135b32bf36b478ab37efbea5f35fc5e8b6e86caaf6a68. scripts/generate.py regenerates all six language clients and the documentation from the shared source.

Contract updates and releases

The Sync live API contract workflow checks the deployed public OpenAPI contract every day at 03:47 UTC. It always reads https://api.crawlora.net/swagger/doc.json; its only manual option is dry_run, which applies the candidate in the workflow and reports the result without validating, committing, tagging, or publishing it.

An unchanged contract is a no-op and does not run the client test matrix or create a release. Additions and updates are applied to a candidate, checked across Node.js, Python, Go, Ruby, Java, and PHP, then committed to main only after all checks pass. Removing or deprecating an existing operation stops the run for maintainer review; packages already published remain available. The release workflow publishes accepted versions to npm, PyPI, Go modules, RubyGems, Maven Central, GitHub Packages, and Packagist. A failed fetch, invalid contract, or failed check also stops before the commit. A later scheduled run can resume an incomplete registry publication at the same package version and immutable tag; recovery does not bypass the removed-operation review.

The workflow does not accept an alternate source URL or a caller-supplied version. To preview a change, open Actions → Sync live API contract → Run workflow and select dry_run.

License

MIT. See LICENSE.

Documentation

Overview

Package youtube is a focused Go client for Crawlora's YouTube endpoints.

Index

Constants

View Source
const (
	DefaultBaseURL = "https://api.crawlora.net/api/v1"
	Version        = "0.1.4"
)
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.

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