diff options
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -12,8 +12,9 @@ import ( "strings" "time" + _ "github.com/ncruces/go-sqlite3/driver" + _ "github.com/ncruces/go-sqlite3/embed" "github.com/PuerkitoBio/goquery" - _ "github.com/mattn/go-sqlite3" ) const ( @@ -36,6 +37,7 @@ type Channel struct { type Item struct { Title string `xml:"title"` + Author string `xml:"https://www.itunes.com/dtds/podcast-1.0.dtd author"` Link string `xml:"link"` Category string `xml:"category"` Enclosure Enclosure `xml:"enclosure"` @@ -114,13 +116,13 @@ func parseYearWeek(date string) (YearWeek, error) { return YearWeek{Year: year, Week: week}, nil } -func parseTitle(title string) (TitleAuthor, error) { +func parseTitle(title string) (string, error) { parts := strings.Split(title, " - ") if len(parts) < 3 { - return TitleAuthor{}, fmt.Errorf("expected 'Week - Author - Title', got '%s'", title) + return "", fmt.Errorf("expected 'Week - Author - Title', got '%s'", title) } - return TitleAuthor{Title: strings.Join(parts[2:], " - "), Author: parts[1]}, nil + return strings.Join(parts[2:], " - "), nil } // For some tracks, like https://weeklybeats.com/keff/music/evil-los-man, the WB RSS feed returns invalid XML bytes. Scrub these. |
