youtube

package
v0.0.0-...-5b3c2df Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2021 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Ytwaiting = "???"
	Bot       *discordgo.Session
)

Functions

func CheckPrivate

func CheckPrivate()

func CheckYtByTime

func CheckYtByTime()

func CheckYtSchedule

func CheckYtSchedule()

func GetRSS

func GetRSS(YtID string) []string

GetRSS GetRSS from Channel

func GetWaiting

func GetWaiting(VideoID string) (string, error)

func ParseDuration

func ParseDuration(str string) time.Duration

ParseDuration Parse video duration

func ParseInt64

func ParseInt64(value string) int64

func Start

func Start(BotInit *discordgo.Session, cronInit *cron.Cron)

Start start twitter module

func StartCheckYT

func StartCheckYT(Member database.Member, Group database.Group, wg *sync.WaitGroup) error

StartCheckYT Youtube rss and API

Types

type NotifStruct

type NotifStruct struct {
	YtData        *database.YtDbData
	ActuallyStart time.Time
	Member        database.Member
	Group         database.Group
}

func (*NotifStruct) AddData

func (Data *NotifStruct) AddData(new *database.YtDbData) *NotifStruct

func (*NotifStruct) ChangeYtStatus

func (Data *NotifStruct) ChangeYtStatus(new string) *NotifStruct

func (*NotifStruct) SendNude

func (PushData *NotifStruct) SendNude() error

func (*NotifStruct) SetActuallyStart

func (Data *NotifStruct) SetActuallyStart(new time.Time) *NotifStruct

func (*NotifStruct) SetYoutubeID

func (Data *NotifStruct) SetYoutubeID(new int64) *NotifStruct

func (*NotifStruct) UpYtEnd

func (Data *NotifStruct) UpYtEnd(new time.Time) *NotifStruct

func (*NotifStruct) UpYtLen

func (Data *NotifStruct) UpYtLen(new string) *NotifStruct

func (*NotifStruct) UpYtSchedul

func (Data *NotifStruct) UpYtSchedul(new time.Time) *NotifStruct

func (*NotifStruct) UpYtView

func (Data *NotifStruct) UpYtView(new string) *NotifStruct

func (*NotifStruct) UpdateYtDB

func (Data *NotifStruct) UpdateYtDB() *NotifStruct

type YtData

type YtData struct {
	Items []struct {
		Snippet struct {
			PublishedAt time.Time `json:"publishedAt"`
			Title       string    `json:"title"`
			Description string    `json:"description"`
			Thumbnails  struct {
				Standard struct {
					URL    string `json:"url"`
					Width  int    `json:"width"`
					Height int    `json:"height"`
				} `json:"Standard"`
			} `json:"thumbnails"`
			ChannelTitle string `json:"channelTitle"`
			VideoStatus  string `json:"liveBroadcastContent"`
		} `json:"snippet"`
		ContentDetails struct {
			Duration string `json:"duration"`
		} `json:"contentDetails"`
		Statistics struct {
			ViewCount string `json:"viewCount"`
		} `json:"statistics"`
		LiveDetails struct {
			StartTime       time.Time `json:"scheduledStartTime"`
			ActualStartTime time.Time `json:"actualStartTime"`
			EndTime         time.Time `json:"actualEndTime"`
			Viewers         string    `json:"concurrentViewers"`
		} `json:"liveStreamingDetails"`
	} `json:"items"`
}

func YtAPI

func YtAPI(VideoID []string) (YtData, error)

YtAPI Get data from youtube api

type YtXML

type YtXML struct {
	XMLName xml.Name `xml:"feed"`
	Text    string   `xml:",chardata"`
	Link    []struct {
		Text string `xml:",chardata"`
		Rel  string `xml:"rel,attr"`
		Href string `xml:"href,attr"`
		Type string `xml:"type,attr"`
		ID   string `xml:"id,attr"`
	} `xml:"link"`
	ID        string `xml:"id"`
	ChannelId string `xml:"channelId"`
	Title     string `xml:"title"`
	Author    struct {
		Text string `xml:",chardata"`
		Name string `xml:"name"`
		URI  string `xml:"uri"`
	} `xml:"author"`
	Published string `xml:"published"`
	Entry     []struct {
		Text      string `xml:",chardata"`
		ID        string `xml:"id"`
		VideoId   string `xml:"videoId"`
		ChannelId string `xml:"channelId"`
		Title     string `xml:"title"`
		Link      struct {
			Text string `xml:",chardata"`
			Rel  string `xml:"rel,attr"`
			Href string `xml:"href,attr"`
		} `xml:"link"`
		Author struct {
			Text string `xml:",chardata"`
			Name string `xml:"name"`
			URI  string `xml:"uri"`
		} `xml:"author"`
		Published string `xml:"published"`
		Updated   string `xml:"updated"`
		Group     struct {
			Text    string `xml:",chardata"`
			Title   string `xml:"title"`
			Content struct {
				Text   string `xml:",chardata"`
				URL    string `xml:"url,attr"`
				Type   string `xml:"type,attr"`
				Width  string `xml:"width,attr"`
				Height string `xml:"height,attr"`
			} `xml:"content"`
			Thumbnail struct {
				Text   string `xml:",chardata"`
				URL    string `xml:"url,attr"`
				Width  string `xml:"width,attr"`
				Height string `xml:"height,attr"`
			} `xml:"thumbnail"`
			Description string `xml:"description"`
			Community   struct {
				Text       string `xml:",chardata"`
				StarRating struct {
					Text    string `xml:",chardata"`
					Count   string `xml:"count,attr"`
					Average string `xml:"average,attr"`
					Min     string `xml:"min,attr"`
					Max     string `xml:"max,attr"`
				} `xml:"starRating"`
				Statistics struct {
					Text  string `xml:",chardata"`
					Views string `xml:"views,attr"`
				} `xml:"statistics"`
			} `xml:"community"`
		} `xml:"group"`
	} `xml:"entry"`
	Style struct {
		Text string `xml:",chardata"`
		Type string `xml:"type,attr"`
		ID   string `xml:"id,attr"`
	} `xml:"style"`
	Script string `xml:"script"`
}

Jump to

Keyboard shortcuts

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