Documentation ¶
Index ¶
- Constants
- func FetchDecryptFunction(mediaUrlJs string) (decryptFunctions []decryptFunc, err error)
- type Comment
- type ExtractMediaOutput
- type FullVideo
- type MediaFormat
- type SidebarEntry
- type SidebarPlaylist
- type SidebarRadio
- type SidebarVideo
- type VideoScraper
- func (v VideoScraper) Export() VideoScraperExport
- func (v *VideoScraper) ExtractMediaFormats() (output ExtractMediaOutput, err error)
- func (v *VideoScraper) NextNewestCommentsPage() (comments []Comment, err error)
- func (v *VideoScraper) NextSidebarVideosPage() (sidebarEntries []SidebarEntry, err error)
- func (v *VideoScraper) NextTopCommentsPage() (comments []Comment, err error)
- type VideoScraperExport
Constants ¶
View Source
const ( SidebarEntryTypeVideo sidebarEntryType = iota SidebarEntryTypePlaylist SidebarEntryTypeRadio )
View Source
const WebKey = "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8"
Youtube web client api key
View Source
const YoutubeVideoDateLayout = "Jan 2, 2006"
Used for parsing youtube video upload date to golang time.Time
Variables ¶
This section is empty.
Functions ¶
func FetchDecryptFunction ¶
TODO: fix & cleanup TODO: add caching
Types ¶
type Comment ¶
type Comment struct { NewChannelID string CommentID string Content string PublishedTime string // "5 days ago" Likes int PinnedBy string // "Pinned by Username" IsPinned bool IsHearted bool WasEdited bool // if the comment was edited RepliesAmount int Avatars []scraper.YoutubeImage // contains filtered or unexported fields }
func (*Comment) HasSubComments ¶
HasSubComments returns if the comment has any replies
func (*Comment) NextSubCommentPage ¶
NextSubCommentPage returns comment replies in chunks. Check with HasSubComments if there are replies
type ExtractMediaOutput ¶
type ExtractMediaOutput struct { Formats []MediaFormat `rjson:"streamingData.formats"` // Best quality formats are here, but the video and audio tracks will be separate AdaptiveFormats []MediaFormat `rjson:"streamingData.adaptiveFormats"` }
func ExtractMediaFormats ¶
func ExtractMediaFormats(id string) (output ExtractMediaOutput, err error)
type FullVideo ¶
type FullVideo struct { VideoID string Title string Description string Views int // Displays number of video views exept in a livestream where it will display number of viewers IsLive bool WasLive bool // if this video was live in the past Date time.Time // video upload date Likes int CommentsCount int Category string // video category IsUnlisted bool VideoPremiered bool // if the video was premiered in the past Username string ChannelID string NewChannelID string ChannelSubscribers int ChannelAvatars []scraper.YoutubeImage ChannelIsVerified bool ChannelIsVerifiedArtist bool }
FullVideo has the full metadata unlike Video which is fetched from Video lists
type MediaFormat ¶
type MediaFormat struct { Bitrate int `rjson:"bitrate"` Width int `rjson:"width"` Height int `rjson:"height"` Url string `rjson:"url"` MimeType string `rjson:"mimeType"` // e.g "audio/mp4; codecs=\"mp4a.40.2\"" or "video/mp4; codecs=\"av01.0.00M.08\"" QualityLabel string `rjson:"qualityLabel"` SignatureCipher string `rjson:"signatureCipher"` // DRM // Videos can have dubs AudioTrack struct { DisplayName string `rjson:"displayName"` AudioIsDefault bool `rjson:"audioIsDefault"` } `rjson:"audioTrack"` }
func (*MediaFormat) GetMediaUrl ¶
func (m *MediaFormat) GetMediaUrl(v *VideoScraper) (out string, err error)
GetMediaUrl is a generic function to get the media url, doesnt matter if it has DRM or not
type SidebarEntry ¶
type SidebarEntry struct { Type sidebarEntryType Entry any }
func (SidebarEntry) IsPlaylist ¶
func (s SidebarEntry) IsPlaylist() bool
func (SidebarEntry) IsRadio ¶
func (s SidebarEntry) IsRadio() bool
func (SidebarEntry) IsVideo ¶
func (s SidebarEntry) IsVideo() bool
type SidebarPlaylist ¶
type SidebarRadio ¶
type SidebarVideo ¶
type VideoScraper ¶
type VideoScraper struct { VideoInfo FullVideo // Initial info about the video InitialSidebarEntries []SidebarEntry // contains filtered or unexported fields }
func NewVideoScraper ¶
func NewVideoScraper(id string) (v VideoScraper, err error)
func VideoScraperFromExport ¶
func VideoScraperFromExport(export VideoScraperExport) (v VideoScraper, err error)
func (VideoScraper) Export ¶
func (v VideoScraper) Export() VideoScraperExport
func (*VideoScraper) ExtractMediaFormats ¶
func (v *VideoScraper) ExtractMediaFormats() (output ExtractMediaOutput, err error)
func (*VideoScraper) NextNewestCommentsPage ¶
func (v *VideoScraper) NextNewestCommentsPage() (comments []Comment, err error)
NextNewestCommentsPage returns comments in chunks sorted by newest
func (*VideoScraper) NextSidebarVideosPage ¶
func (v *VideoScraper) NextSidebarVideosPage() (sidebarEntries []SidebarEntry, err error)
func (*VideoScraper) NextTopCommentsPage ¶
func (v *VideoScraper) NextTopCommentsPage() (comments []Comment, err error)
NextTopCommentsPage returns comments in chunks sorted by most popular
Source Files ¶
Click to show internal directories.
Click to hide internal directories.