xmlapi

package
v0.0.0-...-2f996ff Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValidChannelID

func IsValidChannelID(s string) bool

Checks (roughly) if the given string is a valid YouTube channel ID.

func IsValidVideoID

func IsValidVideoID(s string) bool

Checks (roughly) if the given string is a valid YouTube video ID.

Types

type Author

type Author struct {
	Name string `xml:"name"`
	URI  string `xml:"uri"`
}

type ChannelFeed

type ChannelFeed struct {
	XMLName xml.Name `xml:"feed"`

	Links []Link `xml:"link,omitempty"`

	Title     string  `xml:"title"`
	Author    *Author `xml:"author,omitempty"`
	Published string  `xml:"published"`

	Entries []ChannelFeedEntry `xml:"entry,omitempty"`
}

func ParseChannelFeed

func ParseChannelFeed(b []byte) (*ChannelFeed, error)

func (*ChannelFeed) Videos

func (f *ChannelFeed) Videos() (videos []ChannelFeedVideo)

type ChannelFeedEntry

type ChannelFeedEntry struct {
	ID string `xml:"id"`

	VideoID   string `xml:"videoId"`
	ChannelID string `xml:"channelId"`

	Title     string  `xml:"title"`
	Links     []Link  `xml:"link,omitempty"`
	Author    *Author `xml:"author,omitempty"`
	Published string  `xml:"published"`
	Updated   string  `xml:"updated"`

	MediaGroups []MediaGroup `xml:"group,omitempty"`
}

type ChannelFeedVideo

type ChannelFeedVideo struct {
	ID        string `json:"id"`
	ChannelID string `json:"channel_id"`

	Title        string `json:"title"`
	Description  string `json:"description"`
	URL          string `json:"url"`
	ThumbnailURL string `json:"thumbnail_url"`

	Published int64 `json:"published"` // (unix timestamp; in milliseconds)
	Updated   int64 `json:"updated"`   // (unix timestamp; in milliseconds)
}

func (ChannelFeedVideo) String

func (vid ChannelFeedVideo) String() string

type ChannelIndex

type ChannelIndex struct {
	ChannelID string
}

func ParseChannelIndex

func ParseChannelIndex(b []byte) (*ChannelIndex, error)

func (ChannelIndex) String

func (res ChannelIndex) String() string
type Link struct {
	Rel  string `xml:"rel,attr"`
	Href string `xml:"href,attr"`
}

type MediaCommunity

type MediaCommunity struct {
	StarRating *MediaStarRating `xml:"starRating,omitempty"`
	Statistics *MediaStatistics `xml:"statistics,omitempty"`
}

type MediaContent

type MediaContent struct {
	URL    string `xml:"url,attr"`
	Type   string `xml:"type,attr"`
	Width  int    `xml:"width,attr"`
	Height int    `xml:"height,attr"`
}

type MediaGroup

type MediaGroup struct {
	XMLName xml.Name `xml:"group"`

	Title       string          `xml:"title"`
	Content     *MediaContent   `xml:"content,omitempty"`
	Thumbnail   *MediaThumbnail `xml:"thumbnail,omitempty"`
	Description string          `xml:"description"`
	Community   *MediaCommunity `xml:"community,omitempty"`
}

type MediaStarRating

type MediaStarRating struct {
	Count   int     `xml:"count,attr"`
	Average float32 `xml:"average,attr"`
	Min     int     `xml:"min,attr"`
	Max     int     `xml:"max,attr"`
}

type MediaStatistics

type MediaStatistics struct {
	Views int `xml:"views,attr"`
}

type MediaThumbnail

type MediaThumbnail struct {
	URL    string `xml:"url,attr"`
	Width  int    `xml:"width,attr"`
	Height int    `xml:"height,attr"`
}

Jump to

Keyboard shortcuts

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