Documentation ¶
Index ¶
Constants ¶
View Source
const ( // YouTubeVideoPrefix : YouTube video prefix YouTubeVideoPrefix = "https://www.youtube.com" // YouTubeQueryURL : YouTube query URL YouTubeQueryURL = YouTubeVideoPrefix + "/results" // YouTubeQueryPattern : YouTube query URL parseable with *printf functions YouTubeQueryPattern = YouTubeQueryURL + "?q=%s" // YouTubeHTMLVideoSelector : YouTube entry video selector YouTubeHTMLVideoSelector = ".yt-uix-tile-link" // YouTubeHTMLDescSelector : YouTube entry description selector YouTubeHTMLDescSelector = ".yt-lockup-byline" // YouTubeHTMLDurationSelector : YouTube entry duration selector YouTubeHTMLDurationSelector = ".accessible-description" )
View Source
const ( // DurationTolerance : max result duration difference tolerance DurationTolerance = 20 // second(s) )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Entry ¶
Entry : single search result struct
type Provider ¶
type Provider interface { Name() string Query(*track.Track) ([]*Entry, error) Match(*Entry, *track.Track) error Download(*Entry, string) error ValidateURL(url string) error }
Provider defines the generic interface on which every download provider should be basing its logic
type YouTubeProvider ¶
YouTubeProvider is the provider implementation which uses as source YouTube videos.
func (YouTubeProvider) Download ¶
func (p YouTubeProvider) Download(e *Entry, fname string) error
Download : delegate youtube-dl call to download entry
func (YouTubeProvider) Match ¶
func (p YouTubeProvider) Match(e *Entry, t *track.Track) error
Match : return nil error if YouTube entry is matching with track
func (YouTubeProvider) Name ¶
func (p YouTubeProvider) Name() string
Name returns a human readable name for the provider
func (YouTubeProvider) Query ¶
func (p YouTubeProvider) Query(track *track.Track) ([]*Entry, error)
Query : query provider for entries related to track
func (YouTubeProvider) ValidateURL ¶
func (p YouTubeProvider) ValidateURL(url string) error
ValidateURL : return nil error if input URL is a valid YouTube URL
Click to show internal directories.
Click to hide internal directories.