subsyt/internal/format/opml.go
Viktor Varland 6ff2d53c2d
Some checks are pending
build / build (push) Waiting to run
feat: use rss to fetch list of videos
This uses RSS to fetch a list of videos to avoid the vid being invisible
due to "restrictions", then downloads the videos one-by-one instead of
scraping and parsing the channel page using yt-dlp.

We lose metadata for the entire channel (show-level) so introducing a
hack to download just the metadata of a channel.
2025-09-08 22:30:57 +02:00

41 lines
623 B
Go

package format
import (
"encoding/xml"
"os"
)
type Outline struct {
Outlines []Outline `xml:"outline"`
Text string `xml:"text,attr"`
Title string `xml:"title,attr"`
Type string `xml:"type,attr"`
XmlUrl string `xml:"xmlUrl,attr"`
}
type Body struct {
Outline []Outline `xml:"body>outline"`
}
type OPML struct {
XMLName xml.Name `xml:"opml"`
Body `xml:"opml>body"`
}
func OpmlLoad(path string) (OPML, error) {
data, err := os.ReadFile(path)
if err != nil {
panic(err)
}
opml := OPML{}
err = xml.Unmarshal(data, &opml)
if err != nil {
panic(err)
}
return opml, err
}