Skip to content

Commit

Permalink
Better metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
CuriouslyCory committed Jan 2, 2025
1 parent b4b8b96 commit 1629f36
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions plugins/tools/youtube/youtube.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,13 +387,16 @@ type VideoInfo struct {
}

type VideoMetadata struct {
Title string `json:"title"`
Description string `json:"description"`
PublishedAt string `json:"publishedAt"`
ChannelId string `json:"channelId"`
ChannelTitle string `json:"channelTitle"`
ViewCount uint64 `json:"viewCount"`
LikeCount uint64 `json:"likeCount"`
Id string `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
PublishedAt string `json:"publishedAt"`
ChannelId string `json:"channelId"`
ChannelTitle string `json:"channelTitle"`
CategoryId string `json:"categoryId"`
Tags []string `json:"tags"`
ViewCount uint64 `json:"viewCount"`
LikeCount uint64 `json:"likeCount"`
}

func (o *YouTube) GrabMetadata(videoId string) (metadata *VideoMetadata, err error) {
Expand All @@ -416,11 +419,14 @@ func (o *YouTube) GrabMetadata(videoId string) (metadata *VideoMetadata, err err
likeCount := video.Statistics.LikeCount

metadata = &VideoMetadata{
Id: video.Id,
Title: video.Snippet.Title,
Description: video.Snippet.Description,
PublishedAt: video.Snippet.PublishedAt,
ChannelId: video.Snippet.ChannelId,
ChannelTitle: video.Snippet.ChannelTitle,
CategoryId: video.Snippet.CategoryId,
Tags: video.Snippet.Tags,
ViewCount: viewCount,
LikeCount: likeCount,
}
Expand Down

0 comments on commit 1629f36

Please sign in to comment.