Documentation
¶
Index ¶
- Constants
- Variables
- func GetLanguageName(langCode string) string
- func ListShows() []string
- type Option
- type Scrapper
- func (s *Scrapper) DownloadSubtitles(meta *VideoMetadata, outputDir string) error
- func (s *Scrapper) DownloadVideoMeta(videoID string) (*VideoMetadata, error)
- func (s *Scrapper) FetchSubtitles(meta *VideoMetadata) (*Subtitles, error)
- func (s *Scrapper) SaveVideoToFile(meta *VideoMetadata, directory string) error
- func (s *Scrapper) Scrape(maxPages int) (int, []error)
- func (s *Scrapper) ScrapePage(page int) ([]*VideoInfo, error)
- type Show
- type SubtitleItem
- type SubtitlePage
- type SubtitleResponse
- type Subtitles
- type VideoInfo
- type VideoMetadata
- type VideoPage
- type VideoResponse
Constants ¶
View Source
const ApiURL = "https://api2.rtve.es/api/videos/%s.json"
View Source
const SubsURL = "https://api2.rtve.es/api/videos/%s/subtitulos.json"
Variables ¶
View Source
var ErrForbidden = errors.New("access not allowed")
View Source
var ErrPageNotFound = errors.New("page not found")
Functions ¶
func GetLanguageName ¶
Helper function to get language name from language code
Types ¶
type Scrapper ¶
type Scrapper struct {
Program string
// contains filtered or unexported fields
}
func NewScrapper ¶
func (*Scrapper) DownloadSubtitles ¶
func (s *Scrapper) DownloadSubtitles(meta *VideoMetadata, outputDir string) error
DownloadSubtitles downloads all available subtitles for a given video ID and saves them to the specified directory
func (*Scrapper) DownloadVideoMeta ¶
func (s *Scrapper) DownloadVideoMeta(videoID string) (*VideoMetadata, error)
DownloadVideoMeta fetches and parses video metadata for a given video ID
func (*Scrapper) FetchSubtitles ¶
func (s *Scrapper) FetchSubtitles(meta *VideoMetadata) (*Subtitles, error)
FetchSubtitles fetches subtitle metadata for a video and returns a Subtitles object
func (*Scrapper) SaveVideoToFile ¶
func (s *Scrapper) SaveVideoToFile(meta *VideoMetadata, directory string) error
type SubtitleItem ¶
type SubtitlePage ¶
type SubtitlePage struct {
Items []SubtitleItem `json:"items"` // List of subtitle items
Number int `json:"number"` // Current page number
Size int `json:"size"` // Page size
Offset int `json:"offset"` // Offset in the results
Total int `json:"total"` // Total number of items
TotalPages int `json:"totalPages"` // Total number of pages
NumElements int `json:"numElements"` // Number of elements in the current page
}
SubtitlePage represents the page of subtitle items along with pagination info
type SubtitleResponse ¶
type SubtitleResponse struct {
Page SubtitlePage `json:"page"` // Subtitle page information
}
SubtitleResponse represents the top-level JSON response
type Subtitles ¶ added in v0.2.0
type Subtitles struct {
// VideoID is the ID of the video these subtitles belong to
VideoID string
// Subtitles is a list of available subtitle tracks
Subtitles []SubtitleItem
}
Subtitles represents parsed subtitle data for a video
type VideoMetadata ¶
type VideoMetadata struct {
URI string `json:"uri"`
HTMLUrl string `json:"htmlUrl"`
ID string `json:"id"`
LongTitle string `json:"longTitle"`
PublicationDate string `json:"publicationDate"`
}
VideoMetadata represents essential metadata from a video
func (*VideoMetadata) Parse ¶
func (m *VideoMetadata) Parse(body string) error
type VideoPage ¶
type VideoPage struct {
Items []VideoMetadata `json:"items"`
Number int `json:"number"`
Size int `json:"size"`
Offset int `json:"offset"`
Total int `json:"total"`
TotalPages int `json:"totalPages"`
NumElements int `json:"numElements"`
}
VideoPage represents the page of video items
type VideoResponse ¶
type VideoResponse struct {
Page VideoPage `json:"page"`
}
VideoResponse represents the top-level JSON response
Directories
¶
| Path | Synopsis |
|---|---|
|
Package api provides a high-level interface for fetching video metadata and subtitles from RTVE (Radio Televisión Española) on-demand streaming service.
|
Package api provides a high-level interface for fetching video metadata and subtitles from RTVE (Radio Televisión Española) on-demand streaming service. |
|
cmd
|
|
|
rtve-subs
command
|
Click to show internal directories.
Click to hide internal directories.