search

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package search queries YouTube search results without an API key by parsing the ytInitialData JSON embedded in the results page.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result struct {
	ID       string
	Title    string
	Channel  string
	Duration string // "3:33"; empty for live streams
	Views    string // "1.2M views"
	Live     bool
}

Result is one video from a search results page.

func Search(ctx context.Context, query string, limit int) ([]Result, error)

Search fetches up to limit video results for query.

func (Result) ThumbnailURL

func (r Result) ThumbnailURL() string

ThumbnailURL returns a 320×180 thumbnail (exact 16:9, no letterbox bars).

func (Result) URL

func (r Result) URL() string

URL returns the watch URL for the result.

Jump to

Keyboard shortcuts

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