summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--go.mod9
-rw-r--r--go.sum9
-rw-r--r--main.go10
3 files changed, 20 insertions, 8 deletions
diff --git a/go.mod b/go.mod
index 4c671fa..e440fb8 100644
--- a/go.mod
+++ b/go.mod
@@ -2,10 +2,15 @@ module weeklybeats-scraper
go 1.25.1
-require github.com/mattn/go-sqlite3 v1.14.32
+require (
+ github.com/PuerkitoBio/goquery v1.11.0
+ github.com/ncruces/go-sqlite3 v0.30.3
+)
require (
- github.com/PuerkitoBio/goquery v1.11.0 // indirect
github.com/andybalholm/cascadia v1.3.3 // indirect
+ github.com/ncruces/julianday v1.0.0 // indirect
+ github.com/tetratelabs/wazero v1.10.1 // indirect
golang.org/x/net v0.47.0 // indirect
+ golang.org/x/sys v0.38.0 // indirect
)
diff --git a/go.sum b/go.sum
index 12fe035..04f3efc 100644
--- a/go.sum
+++ b/go.sum
@@ -3,8 +3,12 @@ github.com/PuerkitoBio/goquery v1.11.0/go.mod h1:wQHgxUOU3JGuj3oD/QFfxUdlzW6xPHf
github.com/andybalholm/cascadia v1.3.3 h1:AG2YHrzJIm4BZ19iwJ/DAua6Btl3IwJX+VI4kktS1LM=
github.com/andybalholm/cascadia v1.3.3/go.mod h1:xNd9bqTn98Ln4DwST8/nG+H0yuB8Hmgu1YHNnWw0GeA=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
-github.com/mattn/go-sqlite3 v1.14.32 h1:JD12Ag3oLy1zQA+BNn74xRgaBbdhbNIDYvQUEuuErjs=
-github.com/mattn/go-sqlite3 v1.14.32/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
+github.com/ncruces/go-sqlite3 v0.30.3 h1:X/CgWW9GzmIAkEPrifhKqf0cC15DuOVxAJaHFTTAURQ=
+github.com/ncruces/go-sqlite3 v0.30.3/go.mod h1:AxKu9sRxkludimFocbktlY6LiYSkxiI5gTA8r+os/Nw=
+github.com/ncruces/julianday v1.0.0 h1:fH0OKwa7NWvniGQtxdJRxAgkBMolni2BjDHaWTxqt7M=
+github.com/ncruces/julianday v1.0.0/go.mod h1:Dusn2KvZrrovOMJuOt0TNXL6tB7U2E8kvza5fFc9G7g=
+github.com/tetratelabs/wazero v1.10.1 h1:2DugeJf6VVk58KTPszlNfeeN8AhhpwcZqkJj2wwFuH8=
+github.com/tetratelabs/wazero v1.10.1/go.mod h1:DRm5twOQ5Gr1AoEdSi0CLjDQF1J9ZAuyqFIjl1KKfQU=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
@@ -71,3 +75,4 @@ golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+>>>>>>> Conflict 1 of 1 ends
diff --git a/main.go b/main.go
index 2389688..9985c1e 100644
--- a/main.go
+++ b/main.go
@@ -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.