ytuploader

package module
v0.0.0-...-6a738c5 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: MIT Imports: 18 Imported by: 1

README

Youtube uploader by golang and chrome headless

This is a very simple library in order to support me upload a video to Youtube.

Purpose

  • Upload a video to Youtube without using Youtube API.

Require:

  • Chromedrive
  • Golang version 1.11 above

How it works

-- Please take a look at the example folder

Documentation

Index

Constants

View Source
const (
	YoutuybeUploadURL    = "https://youtube.com/upload?persist_gl=1&gl=US&persist_hl=1&hl=en"
	YoutubeHomepageURL   = "https://www.youtube.com/?persist_gl=1&gl=US&persist_hl=1&hl=en"
	BypassHeadlessScript = `` /* 1036-byte string literal not displayed */

)

Variables

View Source
var DefaultBrowserCloseDuration = 1 * time.Second
View Source
var DefaultUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36"

Functions

This section is empty.

Types

type Cookie struct {
	Domain         string  `json:"domain"`
	ExpirationDate float64 `json:"expirationDate"`
	HostOnly       bool    `json:"hostOnly"`
	HTTPOnly       bool    `json:"httpOnly"`
	Name           string  `json:"name"`
	Path           string  `json:"path"`
	SameSite       string  `json:"sameSite"`
	Secure         bool    `json:"secure"`
	Session        bool    `json:"session"`
	StoreID        string  `json:"storeId"`
	Value          string  `json:"value"`
	ID             int     `json:"id"`
}

func (*Cookie) Builtin

func (c *Cookie) Builtin() *http.Cookie

type Cookies

type Cookies []*Cookie

func ParseCookiesFromJSONFile

func ParseCookiesFromJSONFile(path string) (Cookies, error)

func (Cookies) Builtin

func (cookies Cookies) Builtin() []*http.Cookie

type YtUploader

type YtUploader struct {
	Headless bool
	// contains filtered or unexported fields
}

YtUploader presents an uploader

func New

func New(screenshotFolder string, account string, userAgent string) *YtUploader

New creates a new upload instance

func (*YtUploader) Upload

func (u *YtUploader) Upload(channel string, filename string, cookies []*http.Cookie, thumbnail *string, save bool) (string, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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