youtube

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2025 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UploadVideo

func UploadVideo(ctx context.Context, media io.Reader, opts ...VideoUploadOption) error

UploadVideo uploads a video to AusOcean's YouTube account using the provided media reader and options. Defaults are applied for title, description, category, privacy, and tags if not specified in options. Defaults are as follows: - Title: "Uploaded at <current time>" - Description: "No description provided." - Category: "Science & Technology" (ID: 28) - Privacy: "unlisted" - Tags: ["ocean uploads"] It returns an error if the upload fails.

Types

type VideoUploadOption

type VideoUploadOption func(*youtube.Video) error

VideoUploadOption is a functional option type for configuring YouTube video uploads.

func WithCategory

func WithCategory(categoryID string) VideoUploadOption

WithCategory sets the category of the video being uploaded. It accepts either a category ID or a category name (both as strings) from the following:

1 - Film & Animation 2 - Autos & Vehicles 10 - Music 15 - Pets & Animals 17 - Sports 18 - Short Movies 19 - Travel & Events 20 - Gaming 21 - Videoblogging 22 - People & Blogs 23 - Comedy 24 - Entertainment 25 - News & Politics 26 - Howto & Style 27 - Education 28 - Science & Technology 29 - Nonprofits & Activism 30 - Movies 31 - Anime/Animation 32 - Action/Adventure 33 - Classics 34 - Comedy 35 - Documentary 36 - Drama 37 - Family 38 - Foreign 39 - Horror 40 - Sci-Fi/Fantasy 41 - Thriller 42 - Shorts 43 - Shows 44 - Trailers

If a name is provided, it will be matched against a predefined list of categories and the corresponding ID will be used. It returns an error if the category ID/name is not found.

func WithDescription

func WithDescription(description string) VideoUploadOption

WithDescription sets the description of the video being uploaded. It returns an error if the description is empty.

func WithPrivacy

func WithPrivacy(privacy string) VideoUploadOption

WithPrivacy sets the privacy status of the video being uploaded. It accepts "public", "unlisted", or "private" as valid privacy statuses. It returns an error if the privacy status is empty or invalid.

func WithTags

func WithTags(tags []string) VideoUploadOption

WithTags sets the tags for the video being uploaded. It returns an error if the tags slice is empty.

func WithTitle

func WithTitle(title string) VideoUploadOption

WithTitle sets the title of the video being uploaded. It returns an error if the title is empty.

Jump to

Keyboard shortcuts

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