Documentation
¶
Index ¶
- func ParseVideosResponse(data []byte) (map[string]VideoDetails, error)
- type Episode
- func FetchPlaylist(url string) ([]Episode, error)
- func FetchPlaylistAPI(playlistID, apiKey string) ([]Episode, error)
- func FetchPlaylistRetry(url string, maxAttempts int) ([]Episode, error)
- func ParseFeed(data []byte) ([]Episode, error)
- func Resolve(src content.YouTubeSource, apiKey string) ([]Episode, error)
- type HTTPError
- type PlaylistItemParsed
- type VideoDetails
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseVideosResponse ¶
func ParseVideosResponse(data []byte) (map[string]VideoDetails, error)
ParseVideosResponse parses a YouTube videos.list JSON response. It returns a map keyed by video ID containing duration and tag details.
Types ¶
type Episode ¶
type Episode struct {
ID string
Title string
URL string
Published time.Time
Description string
Duration string
Tags []string
}
Episode is a single SAP Developer News video from the YouTube playlist.
func FetchPlaylist ¶
FetchPlaylist fetches the YouTube playlist RSS feed at url and returns episodes.
func FetchPlaylistAPI ¶
FetchPlaylistAPI fetches all episodes in a YouTube playlist using the Data API v3. It paginates through playlistItems.list and batch-fetches video details via videos.list. Video detail fetch failures are non-fatal — episodes are returned without enrichment.
func FetchPlaylistRetry ¶
FetchPlaylistRetry wraps FetchPlaylist with exponential backoff. Only retries on HTTP 404/5xx (YouTube's intermittent outage codes).
func Resolve ¶
func Resolve(src content.YouTubeSource, apiKey string) ([]Episode, error)
Resolve fetches videos for a YouTubeSource. For type:"video", returns a synthetic Episode without a network call. For type:"playlist" with apiKey, tries API v3 first, falls back to RSS. For type:"playlist" without apiKey, uses RSS directly.
type PlaylistItemParsed ¶
type PlaylistItemParsed struct {
VideoID string
Title string
Description string
Published time.Time
}
PlaylistItemParsed holds the fields extracted from a playlistItems.list response item.
func ParsePlaylistItemsResponse ¶
func ParsePlaylistItemsResponse(data []byte) ([]PlaylistItemParsed, string, error)
ParsePlaylistItemsResponse parses a YouTube playlistItems.list JSON response. It returns the parsed items and the nextPageToken (empty string when no more pages).
type VideoDetails ¶
VideoDetails holds the enrichment fields returned by a videos.list response item.