ytcv

package module
v0.0.0-...-98341f3 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2020 License: MIT Imports: 7 Imported by: 0

README

ytcv

Fetch YouTube videos from a specific channel without authentication.

Installation

$ go get github.com/dqn/ytcv

Usage

package main

import (
	"fmt"

	"github.com/dqn/ytcv"
)

func main() {
	videos, err := ytcv.FetchAll("CHANNEL_ID")
	if err != nil {
		// handle error
	}

	for _, video := range videos {
		fmt.Println(video.VideoID)
		fmt.Println(video.Title.SimpleText)
		fmt.Println(video.PublishedTimeText.SimpleText)
		fmt.Println(video.Thumbnail.Thumbnails[0].URL)
		fmt.Println(video.ViewCountText.SimpleText)
	}
}

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Accessibility

type Accessibility struct {
	AccessibilityData AccessibilityData `json:"accessibilityData"`
}

type AccessibilityData

type AccessibilityData struct {
	Label string `json:"label"`
}

type AddToPlaylistCommand

type AddToPlaylistCommand struct {
	OpenMiniplayer      bool                `json:"openMiniplayer"`
	OpenListPanel       bool                `json:"openListPanel"`
	VideoID             string              `json:"videoId"`
	ListType            string              `json:"listType"`
	OnCreateListCommand OnCreateListCommand `json:"onCreateListCommand"`
	VideoIds            []string            `json:"videoIds"`
}

type Avatar

type Avatar struct {
	Thumbnails []ThumbnailItem `json:"thumbnails"`
}

type ChannelMetadataRenderer

type ChannelMetadataRenderer struct {
	Title                  string   `json:"title"`
	Description            string   `json:"description"`
	PlusPageLink           string   `json:"plusPageLink"`
	ExternalID             string   `json:"externalId"`
	Keywords               string   `json:"keywords"`
	OwnerUrls              []string `json:"ownerUrls"`
	Avatar                 Avatar   `json:"avatar"`
	ChannelURL             string   `json:"channelUrl"`
	IsFamilySafe           bool     `json:"isFamilySafe"`
	AvailableCountryCodes  []string `json:"availableCountryCodes"`
	AndroidDeepLink        string   `json:"androidDeepLink"`
	AndroidAppindexingLink string   `json:"androidAppindexingLink"`
	IosAppindexingLink     string   `json:"iosAppindexingLink"`
	TabPath                string   `json:"tabPath"`
	VanityChannelURL       string   `json:"vanityChannelUrl"`
}

type ChannelVideosResponse

type ChannelVideosResponse []struct {
	Page      string   `json:"page"`
	XSRFToken string   `json:"xsrf_token,omitempty"`
	Response  Response `json:"response,omitempty"`
	Endpoint  Endpoint `json:"endpoint,omitempty"`
	Timing    Timing   `json:"timing,omitempty"`
}

type CommandMetadata

type CommandMetadata struct {
	WebCommandMetadata WebCommandMetadata `json:"webCommandMetadata"`
}

type Contents

type Contents struct {
	TwoColumnBrowseResultsRenderer TwoColumnBrowseResultsRenderer `json:"twoColumnBrowseResultsRenderer"`
}

type Continuation

type Continuation struct {
	NextContinuationData NextContinuationData `json:"nextContinuationData"`
}

type ContinuationContents

type ContinuationContents struct {
	GridContinuation GridContinuation `json:"gridContinuation"`
}

type CreatePlaylistServiceEndpoint

type CreatePlaylistServiceEndpoint struct {
	VideoIds []string `json:"videoIds"`
	Hack     bool     `json:"hack"`
	Params   string   `json:"params"`
}

type Endpoint

type Endpoint struct {
	CommandMetadata CommandMetadata `json:"commandMetadata"`
	URLEndpoint     URLEndpoint     `json:"urlEndpoint"`
}

type GridContinuation

type GridContinuation struct {
	Items          []GridContinuationItem `json:"items"`
	Continuations  []Continuation         `json:"continuations"`
	TrackingParams string                 `json:"trackingParams"`
}

type GridContinuationItem

type GridContinuationItem struct {
	GridVideoRenderer GridVideoRenderer `json:"gridVideoRenderer"`
}

type GridRenderer

type GridRenderer struct {
	Items         []GridContinuationItem `json:"items"`
	Continuations []Continuation         `json:"continuations"`
}

type GridVideoRenderer

type GridVideoRenderer struct {
	VideoID            string             `json:"videoId"`
	Thumbnail          Thumbnail          `json:"thumbnail"`
	Title              Title              `json:"title"`
	PublishedTimeText  PublishedTimeText  `json:"publishedTimeText"`
	ViewCountText      ViewCountText      `json:"viewCountText"`
	NavigationEndpoint NavigationEndpoint `json:"navigationEndpoint"`
	TrackingParams     string             `json:"trackingParams"`
	ShortViewCountText ShortViewCountText `json:"shortViewCountText"`
	Menu               Menu               `json:"menu"`
	ThumbnailOverlays  []ThumbnailOverlay `json:"thumbnailOverlays"`
}

func FetchAll

func FetchAll(channelID string) ([]GridVideoRenderer, error)

type Icon

type Icon struct {
	IconType string `json:"iconType"`
}

type Info

type Info struct {
	St int `json:"st"`
}

type InitialDataResponse

type InitialDataResponse struct {
	Contents Contents `json:"contents"`
}

type ItemSectionRenderer

type ItemSectionRenderer struct {
	Contents []ItemSectionRendererContent `json:"contents"`
}

type ItemSectionRendererContent

type ItemSectionRendererContent struct {
	GridRenderer GridRenderer `json:"gridRenderer"`
}

type LinkAlternate

type LinkAlternate struct {
	HrefURL string `json:"hrefUrl"`
}
type Menu struct {
	MenuRenderer MenuRenderer `json:"menuRenderer"`
}
type MenuRenderer struct {
	Items          []MenuRendererItem `json:"items"`
	TrackingParams string             `json:"trackingParams"`
	Accessibility  Accessibility      `json:"accessibility"`
}
type MenuRendererItem struct {
	MenuServiceItemRenderer MenuServiceItemRenderer `json:"menuServiceItemRenderer"`
}
type MenuServiceItemRenderer struct {
	Text            MenuServiceItemRendererText `json:"text"`
	Icon            Icon                        `json:"icon"`
	ServiceEndpoint ServiceEndpoint             `json:"serviceEndpoint"`
	TrackingParams  string                      `json:"trackingParams"`
}
type MenuServiceItemRendererText struct {
	Runs []Run `json:"runs"`
}

type Metadata

type Metadata struct {
	ChannelMetadataRenderer ChannelMetadataRenderer `json:"channelMetadataRenderer"`
}

type Microformat

type Microformat struct {
	MicroformatDataRenderer MicroformatDataRenderer `json:"microformatDataRenderer"`
}

type MicroformatDataRenderer

type MicroformatDataRenderer struct {
	URLCanonical       string          `json:"urlCanonical"`
	Title              string          `json:"title"`
	Description        string          `json:"description"`
	Thumbnail          Thumbnail       `json:"thumbnail"`
	SiteName           string          `json:"siteName"`
	AppName            string          `json:"appName"`
	AndroidPackage     string          `json:"androidPackage"`
	IosAppStoreID      string          `json:"iosAppStoreId"`
	IosAppArguments    string          `json:"iosAppArguments"`
	OgType             string          `json:"ogType"`
	URLApplinksWeb     string          `json:"urlApplinksWeb"`
	URLApplinksIos     string          `json:"urlApplinksIos"`
	URLApplinksAndroid string          `json:"urlApplinksAndroid"`
	URLTwitterIos      string          `json:"urlTwitterIos"`
	URLTwitterAndroid  string          `json:"urlTwitterAndroid"`
	TwitterCardType    string          `json:"twitterCardType"`
	TwitterSiteHandle  string          `json:"twitterSiteHandle"`
	SchemaDotOrgType   string          `json:"schemaDotOrgType"`
	Noindex            bool            `json:"noindex"`
	Unlisted           bool            `json:"unlisted"`
	Tags               []string        `json:"tags"`
	LinkAlternates     []LinkAlternate `json:"linkAlternates"`
}
type NavigationEndpoint struct {
	ClickTrackingParams string          `json:"clickTrackingParams"`
	CommandMetadata     CommandMetadata `json:"commandMetadata"`
	WatchEndpoint       WatchEndpoint   `json:"watchEndpoint"`
}

type NextContinuationData

type NextContinuationData struct {
	Continuation        string `json:"continuation"`
	ClickTrackingParams string `json:"clickTrackingParams"`
}

type OnCreateListCommand

type OnCreateListCommand struct {
	ClickTrackingParams           string                        `json:"clickTrackingParams"`
	CommandMetadata               CommandMetadata               `json:"commandMetadata"`
	CreatePlaylistServiceEndpoint CreatePlaylistServiceEndpoint `json:"createPlaylistServiceEndpoint"`
}

type Param

type Param struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type PlaylistEditEndpoint

type PlaylistEditEndpoint struct {
	PlaylistID string                       `json:"playlistId"`
	Actions    []PlaylistEditEndpointAction `json:"actions"`
}

type PlaylistEditEndpointAction

type PlaylistEditEndpointAction struct {
	AddedVideoID string `json:"addedVideoId"`
	Action       string `json:"action"`
}

type PublishedTimeText

type PublishedTimeText struct {
	SimpleText string `json:"simpleText"`
}

type RendererText

type RendererText struct {
	Accessibility Accessibility `json:"accessibility"`
	SimpleText    string        `json:"simpleText"`
}

type Response

type Response struct {
	ResponseContext      ResponseContext      `json:"responseContext"`
	ContinuationContents ContinuationContents `json:"continuationContents"`
	Metadata             Metadata             `json:"metadata"`
	TrackingParams       string               `json:"trackingParams"`
	Microformat          Microformat          `json:"microformat"`
}

type ResponseContext

type ResponseContext struct {
	ServiceTrackingParams           []ServiceTrackingParam          `json:"serviceTrackingParams"`
	MaxAgeSeconds                   int                             `json:"maxAgeSeconds"`
	WebResponseContextExtensionData WebResponseContextExtensionData `json:"webResponseContextExtensionData"`
}

type Run

type Run struct {
	Text string `json:"text"`
}

type SectionListRenderer

type SectionListRenderer struct {
	Contents []SectionListRendererContent `json:"contents"`
}

type SectionListRendererContent

type SectionListRendererContent struct {
	ItemSectionRenderer ItemSectionRenderer `json:"itemSectionRenderer"`
}

type ServiceEndpoint

type ServiceEndpoint struct {
	ClickTrackingParams   string                `json:"clickTrackingParams"`
	CommandMetadata       CommandMetadata       `json:"commandMetadata"`
	SignalServiceEndpoint SignalServiceEndpoint `json:"signalServiceEndpoint"`
}

type ServiceTrackingParam

type ServiceTrackingParam struct {
	Service string  `json:"service"`
	Params  []Param `json:"params"`
}

type ShortViewCountText

type ShortViewCountText struct {
	SimpleText string `json:"simpleText"`
}

type SignalServiceEndpoint

type SignalServiceEndpoint struct {
	Signal  string                        `json:"signal"`
	Actions []SignalServiceEndpointAction `json:"actions"`
}

type SignalServiceEndpointAction

type SignalServiceEndpointAction struct {
	AddToPlaylistCommand AddToPlaylistCommand `json:"addToPlaylistCommand"`
}

type Tab

type Tab struct {
	TabRenderer TabRenderer `json:"tabRenderer,omitempty"`
}

type TabRenderer

type TabRenderer struct {
	Title          string             `json:"title"`
	Selected       bool               `json:"selected"`
	TrackingParams string             `json:"trackingParams"`
	Content        TabRendererContent `json:"content"`
}

type TabRendererContent

type TabRendererContent struct {
	SectionListRenderer SectionListRenderer `json:"sectionListRenderer"`
}

type Thumbnail

type Thumbnail struct {
	Thumbnails []ThumbnailItem `json:"thumbnails"`
}

type ThumbnailItem

type ThumbnailItem struct {
	URL    string `json:"url"`
	Width  int    `json:"width"`
	Height int    `json:"height"`
}

type ThumbnailOverlay

type ThumbnailOverlay struct {
	ThumbnailOverlayTimeStatusRenderer   ThumbnailOverlayTimeStatusRenderer   `json:"thumbnailOverlayTimeStatusRenderer,omitempty"`
	ThumbnailOverlayToggleButtonRenderer ThumbnailOverlayToggleButtonRenderer `json:"thumbnailOverlayToggleButtonRenderer,omitempty"`
	ThumbnailOverlayNowPlayingRenderer   ThumbnailOverlayNowPlayingRenderer   `json:"thumbnailOverlayNowPlayingRenderer,omitempty"`
}

type ThumbnailOverlayNowPlayingRenderer

type ThumbnailOverlayNowPlayingRenderer struct {
	Text ThumbnailOverlayNowPlayingRendererText `json:"text"`
}

type ThumbnailOverlayNowPlayingRendererText

type ThumbnailOverlayNowPlayingRendererText struct {
	Runs []Run `json:"runs"`
}

type ThumbnailOverlayTimeStatusRenderer

type ThumbnailOverlayTimeStatusRenderer struct {
	Text  RendererText `json:"text"`
	Style string       `json:"style"`
}

type ThumbnailOverlayToggleButtonRenderer

type ThumbnailOverlayToggleButtonRenderer struct {
	IsToggled                bool                     `json:"isToggled"`
	UntoggledIcon            UntoggledIcon            `json:"untoggledIcon"`
	ToggledIcon              ToggledIcon              `json:"toggledIcon"`
	UntoggledTooltip         string                   `json:"untoggledTooltip"`
	ToggledTooltip           string                   `json:"toggledTooltip"`
	UntoggledServiceEndpoint UntoggledServiceEndpoint `json:"untoggledServiceEndpoint"`
	ToggledServiceEndpoint   ToggledServiceEndpoint   `json:"toggledServiceEndpoint"`
	UntoggledAccessibility   UntoggledAccessibility   `json:"untoggledAccessibility"`
	ToggledAccessibility     ToggledAccessibility     `json:"toggledAccessibility"`
	TrackingParams           string                   `json:"trackingParams"`
}

type Timing

type Timing struct {
	Info Info `json:"info"`
}

type Title

type Title struct {
	Accessibility Accessibility `json:"accessibility"`
	SimpleText    string        `json:"simpleText"`
}

type ToggledAccessibility

type ToggledAccessibility struct {
	AccessibilityData AccessibilityData `json:"accessibilityData"`
}

type ToggledIcon

type ToggledIcon struct {
	IconType string `json:"iconType"`
}

type ToggledServiceEndpoint

type ToggledServiceEndpoint struct {
	ClickTrackingParams  string               `json:"clickTrackingParams"`
	CommandMetadata      CommandMetadata      `json:"commandMetadata"`
	PlaylistEditEndpoint PlaylistEditEndpoint `json:"playlistEditEndpoint"`
}

type TwoColumnBrowseResultsRenderer

type TwoColumnBrowseResultsRenderer struct {
	Tabs []Tab `json:"tabs"`
}

type URLEndpoint

type URLEndpoint struct {
	URL string `json:"url"`
}

type UntoggledAccessibility

type UntoggledAccessibility struct {
	AccessibilityData AccessibilityData `json:"accessibilityData"`
}

type UntoggledIcon

type UntoggledIcon struct {
	IconType string `json:"iconType"`
}

type UntoggledServiceEndpoint

type UntoggledServiceEndpoint struct {
	ClickTrackingParams   string                `json:"clickTrackingParams"`
	CommandMetadata       CommandMetadata       `json:"commandMetadata"`
	PlaylistEditEndpoint  PlaylistEditEndpoint  `json:"playlistEditEndpoint"`
	SignalServiceEndpoint SignalServiceEndpoint `json:"signalServiceEndpoint"`
}

type ViewCountText

type ViewCountText struct {
	SimpleText string `json:"simpleText"`
}

type WatchEndpoint

type WatchEndpoint struct {
	VideoID string `json:"videoId"`
}

type WebCommandMetadata

type WebCommandMetadata struct {
	URL         string `json:"url"`
	WebPageType string `json:"webPageType"`
	RootVe      int    `json:"rootVe"`
}

type WebResponseContextExtensionData

type WebResponseContextExtensionData struct {
	YtConfigData YtConfigData `json:"ytConfigData"`
	HasDecorated bool         `json:"hasDecorated"`
}

type YtConfigData

type YtConfigData struct {
	Csn         string `json:"csn"`
	VisitorData string `json:"visitorData"`
}

Jump to

Keyboard shortcuts

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