Fix item lookup and item creation

SN API changed. Had to update to sn-goapi v0.3.1
This commit is contained in:
ekzyis 2023-08-27 23:42:10 +02:00
parent 95f9c41aa7
commit 4c35631633
3 changed files with 7 additions and 1 deletions

2
go.mod
View File

@ -3,7 +3,7 @@ module git.ekzyis.com/ekzyis/unpaywall
go 1.21.0 go 1.21.0
require ( require (
github.com/ekzyis/sn-goapi v0.3.0 // indirect github.com/ekzyis/sn-goapi v0.3.1 // indirect
github.com/joho/godotenv v1.5.1 // indirect github.com/joho/godotenv v1.5.1 // indirect
github.com/mattn/go-sqlite3 v1.14.17 // indirect github.com/mattn/go-sqlite3 v1.14.17 // indirect
github.com/namsral/flag v1.7.4-pre // indirect github.com/namsral/flag v1.7.4-pre // indirect

4
go.sum
View File

@ -6,6 +6,10 @@ github.com/ekzyis/sn-goapi v0.2.1-0.20230823015232-6a259372b331 h1:NpCmANlADOcRY
github.com/ekzyis/sn-goapi v0.2.1-0.20230823015232-6a259372b331/go.mod h1:FObbYr/NXgnXNWU+EwiWKoWQy+wAaRS6AoW3NgsJ/Oo= github.com/ekzyis/sn-goapi v0.2.1-0.20230823015232-6a259372b331/go.mod h1:FObbYr/NXgnXNWU+EwiWKoWQy+wAaRS6AoW3NgsJ/Oo=
github.com/ekzyis/sn-goapi v0.3.0 h1:pXRbD2iAMHvUC/+gZKXPRwInP4PuABEC1qQc+DWARlE= github.com/ekzyis/sn-goapi v0.3.0 h1:pXRbD2iAMHvUC/+gZKXPRwInP4PuABEC1qQc+DWARlE=
github.com/ekzyis/sn-goapi v0.3.0/go.mod h1:FObbYr/NXgnXNWU+EwiWKoWQy+wAaRS6AoW3NgsJ/Oo= github.com/ekzyis/sn-goapi v0.3.0/go.mod h1:FObbYr/NXgnXNWU+EwiWKoWQy+wAaRS6AoW3NgsJ/Oo=
github.com/ekzyis/sn-goapi v0.3.1-0.20230827213658-0ee21b998335 h1:Zl30HHHnM2LU0yXrrUUAGEGcSuoJXFcSt9ez0/tVPLI=
github.com/ekzyis/sn-goapi v0.3.1-0.20230827213658-0ee21b998335/go.mod h1:FObbYr/NXgnXNWU+EwiWKoWQy+wAaRS6AoW3NgsJ/Oo=
github.com/ekzyis/sn-goapi v0.3.1 h1:Cz/f7/yXMqnZNosRl4TRD3VHfxxkhKsKYCN7SwJc9ck=
github.com/ekzyis/sn-goapi v0.3.1/go.mod h1:FObbYr/NXgnXNWU+EwiWKoWQy+wAaRS6AoW3NgsJ/Oo=
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/mattn/go-sqlite3 v1.14.17 h1:mCRHCLDUBXgpKAqIKsaAaAsrAlbkeomtRFKXh2L6YIM= github.com/mattn/go-sqlite3 v1.14.17 h1:mCRHCLDUBXgpKAqIKsaAaAsrAlbkeomtRFKXh2L6YIM=

View File

@ -58,6 +58,7 @@ func main() {
log.Println("fetching items ...") log.Println("fetching items ...")
r, err := sn.Items(&sn.ItemsQuery{Sort: "recent", Limit: 21}) r, err := sn.Items(&sn.ItemsQuery{Sort: "recent", Limit: 21})
if err != nil { if err != nil {
log.Println(err)
SendToNostr(fmt.Sprint(err)) SendToNostr(fmt.Sprint(err))
WaitUntilNext(time.Minute) WaitUntilNext(time.Minute)
continue continue
@ -79,6 +80,7 @@ func main() {
comment += "Click [here](https://github.com/zedeus/nitter) for more information._" comment += "Click [here](https://github.com/zedeus/nitter) for more information._"
cId, err := sn.CreateComment(item.Id, comment) cId, err := sn.CreateComment(item.Id, comment)
if err != nil { if err != nil {
log.Println(err)
SendToNostr(fmt.Sprint(err)) SendToNostr(fmt.Sprint(err))
continue continue
} }