youtube

package
v1.20.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2021 License: OSL-3.0 Imports: 8 Imported by: 4

README

YouTube

watch

desktop:

curl -o index.html https://www.youtube.com/watch?v=UpNXI3_ctAc

Next:

<script nonce="GWQS4dROIhbOWa4QpveqWw">var ytInitialPlayerResponse = {"respons...
...ta":false,"viewCount":"11059","category":"Music","publishDate":"2020-10-02"...
...1"}},"adSlotLoggingData":{"serializedSlotAdServingDataEntry":""}}}]};</script>

Next:

<script nonce="GWQS4dROIhbOWa4QpveqWw">var ytInitialPlayerResponse = {"respons...
...u0026sp=sig\u0026url=https://r4---sn-q4flrner.googlevideo.com/videoplayback...
...1"}},"adSlotLoggingData":{"serializedSlotAdServingDataEntry":""}}}]};</script>

mobile good:

Never Gonna Reach Me
curl -o index.html -A iPad https://m.youtube.com/watch?v=UpNXI3_ctAc

mobile bad:

Goon Gumpas
curl -o index.html -A iPad https://m.youtube.com/watch?v=NMYIVsdGfoo

Free proxy list

https://proxy.webshare.io/register

Documentation

Overview

YouTube

Index

Constants

This section is empty.

Variables

View Source
var (
	WebP = ImageFormat{0, "vi_webp", "webp"}
	JPG  = ImageFormat{1, "vi", "jpg"}
)
View Source
var Images = ImageSlice{
	{120, 90, 68, "default", JPG},
	{120, 90, 90, "1", JPG},
	{120, 90, 90, "2", JPG},
	{120, 90, 90, "3", JPG},
	{120, 90, 68, "default", WebP},
	{120, 90, 90, "1", WebP},
	{120, 90, 90, "2", WebP},
	{120, 90, 90, "3", WebP},
	{320, 180, 180, "mqdefault", JPG},
	{320, 180, 320, "mq1", JPG},
	{320, 180, 320, "mq2", JPG},
	{320, 180, 320, "mq3", JPG},
	{320, 180, 180, "mqdefault", WebP},
	{320, 180, 320, "mq1", WebP},
	{320, 180, 320, "mq2", WebP},
	{320, 180, 320, "mq3", WebP},
	{480, 360, 270, "0", JPG},
	{480, 360, 270, "hqdefault", JPG},
	{480, 360, 360, "hq1", JPG},
	{480, 360, 360, "hq2", JPG},
	{480, 360, 360, "hq3", JPG},
	{480, 360, 270, "0", WebP},
	{480, 360, 270, "hqdefault", WebP},
	{480, 360, 360, "hq1", WebP},
	{480, 360, 360, "hq2", WebP},
	{480, 360, 360, "hq3", WebP},
	{640, 480, 360, "sddefault", JPG},
	{640, 480, 480, "sd1", JPG},
	{640, 480, 480, "sd2", JPG},
	{640, 480, 480, "sd3", JPG},
	{640, 480, 360, "sddefault", WebP},
	{640, 480, 480, "sd1", WebP},
	{640, 480, 480, "sd2", WebP},
	{640, 480, 480, "sd3", WebP},
	{1280, 720, 720, "hq720", JPG},
	{1280, 720, 720, "maxres1", JPG},
	{1280, 720, 720, "maxres2", JPG},
	{1280, 720, 720, "maxres3", JPG},
	{1280, 720, 720, "maxresdefault", JPG},
	{1280, 720, 720, "hq720", WebP},
	{1280, 720, 720, "maxres1", WebP},
	{1280, 720, 720, "maxres2", WebP},
	{1280, 720, 720, "maxres3", WebP},
	{1280, 720, 720, "maxresdefault", WebP},
}

Functions

This section is empty.

Types

type CompactVideoRenderer added in v1.16.9

type CompactVideoRenderer struct {
	VideoID string
}

type Format

type Format struct {
	Bitrate       int64
	ContentLength int64 `json:"contentLength,string"`
	Height        int
	Itag          int
	MimeType      string
	URL           string
}

func (Format) Ext added in v1.17.8

func (f Format) Ext() string

func (Format) Write

func (f Format) Write(w io.Writer) error

type FormatSlice added in v1.17.8

type FormatSlice []Format

func (FormatSlice) Filter added in v1.17.8

func (f FormatSlice) Filter(keep func(Format) bool) FormatSlice

func (FormatSlice) Sort added in v1.17.8

func (f FormatSlice) Sort(less ...func(a, b Format) bool)

type Image added in v1.15.8

type Image struct {
	Width     int
	Height    int
	SubHeight int
	Base      string
	Format    ImageFormat
}

func (Image) Address added in v1.15.9

func (i Image) Address(id string) string

func (Image) Rect added in v1.20.0

func (i Image) Rect() image.Rectangle

type ImageFormat added in v1.20.0

type ImageFormat struct {
	Sort int
	Dir  string
	Ext  string
}

type ImageSlice added in v1.17.6

type ImageSlice []Image

func (ImageSlice) Filter added in v1.17.6

func (i ImageSlice) Filter(keep func(Image) bool) ImageSlice

func (ImageSlice) Sort added in v1.17.6

func (i ImageSlice) Sort(less ...func(a, b Image) bool)

type Microformat added in v1.13.6

type Microformat struct {
	PlayerMicroformatRenderer `json:"playerMicroformatRenderer"`
}

type Player added in v1.13.0

type Player struct {
	Microformat       `json:"microformat"`
	PlayabilityStatus struct {
		Reason string
	}
	StreamingData `json:"streamingData"`
	VideoDetails  `json:"videoDetails"`
}

func GetVideoInfo added in v1.19.6

func GetVideoInfo(id string, detailPage bool) (*Player, error)

func IPlayer added in v1.19.7

func IPlayer(id string) (*Player, error)

type PlayerMicroformatRenderer added in v1.13.6

type PlayerMicroformatRenderer struct {
	PublishDate string
}
type Search struct {
	Contents struct {
		SectionListRenderer struct {
			Contents []struct {
				ItemSectionRenderer struct {
					Contents []struct {
						CompactVideoRenderer CompactVideoRenderer
					}
				}
			}
		}
	}
}

func ISearch added in v1.19.7

func ISearch(query string) (*Search, error)

func (Search) Videos added in v1.18.2

func (s Search) Videos() []CompactVideoRenderer

type StreamingData added in v1.17.9

type StreamingData struct {
	AdaptiveFormats FormatSlice
}

type VideoDetails added in v1.13.6

type VideoDetails struct {
	Author           string
	ShortDescription string
	Title            string
	VideoID          string
	ViewCount        int `json:"viewCount,string"`
}

Jump to

Keyboard shortcuts

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