Also check for xmlUrl while importing OPML
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is failing

Closes #37.
This commit is contained in:
Peter Stuifzand 2020-10-04 00:05:56 +02:00
parent d47533c0fb
commit fb6c70b2ce
Signed by: peter
GPG Key ID: 374322D56E5209E8

View File

@ -554,18 +554,27 @@ func importOPMLIntoMicrosub(sub microsub.Microsub, filename string) {
} }
for _, f := range c.Outlines { for _, f := range c.Outlines {
if f.HTMLURL == "" { var url string
log.Println("Missing url on second row item")
if f.HTMLURL != "" {
url = f.HTMLURL
} else if f.XMLURL != "" {
url = f.XMLURL
} else {
log.Println("Missing htmlUrl and xmlUrl attributes")
continue continue
} }
if _, e := feedMap[f.HTMLURL]; !e { if _, e := feedMap[url]; !e {
_, err := sub.FollowURL(uid, f.HTMLURL) _, err := sub.FollowURL(uid, url)
if err != nil { if err != nil {
log.Printf("An error occurred: %q\n", err) log.Printf("An error occurred while following feed %s: %q\n", url, err)
continue continue
} }
log.Printf("Feed followed: %s\n", f.HTMLURL)
log.Printf("Feed followed: %s\n", url)
} else {
log.Printf("Feed not followed: %s\n", url)
} }
} }
} }