Skip to content

Commit

Permalink
Support OPML files with no categories
Browse files Browse the repository at this point in the history
  • Loading branch information
piqoni committed Dec 27, 2022
1 parent a3e64c5 commit c2db042
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.vscode/
.obsidian/
.DS_Store
*.md

/bin/
Expand Down
10 changes: 5 additions & 5 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ func parseOPML(xmlContent []byte) []RSS {
err := xml.Unmarshal(xmlContent, &o)
if err != nil {
fmt.Println(err)
} else {
for _, outline := range o.Body.Outline {
for _, feed := range outline.Outline {
OpmlSlice = append(OpmlSlice, RSS{url: feed.XmlUrl, limit: 20})
}
}
for _, outline := range o.Body.Outline {
OpmlSlice = append(OpmlSlice, RSS{url: outline.XmlUrl, limit: 20})
for _, feed := range outline.Outline {
OpmlSlice = append(OpmlSlice, RSS{url: feed.XmlUrl, limit: 20})
}
}
return OpmlSlice
Expand Down
3 changes: 3 additions & 0 deletions opml.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ type Opml struct {
Text string `xml:",chardata"`
AttrText string `xml:"text,attr"`
Title string `xml:"title,attr"`
Type string `xml:"type,attr"`
XmlUrl string `xml:"xmlUrl,attr"`
HtmlUrl string `xml:"htmlUrl,attr"`
Outline []struct {
Text string `xml:",chardata"`
Type string `xml:"type,attr"`
Expand Down

0 comments on commit c2db042

Please sign in to comment.