Compare commits

..

5 Commits

Author SHA1 Message Date
ekzyis
8a86cf02a8 Use twiiit.com 2025-12-05 23:37:43 +01:00
6dbf91c9e4 Update to snappy v0.8.2 2025-12-02 19:50:38 +00:00
987b0e8db7 Update to snappy v0.8.1 2025-12-02 16:04:19 +00:00
ekzyis
2b475f27e0 Update to snappy v0.5.4 2024-09-26 19:28:11 +00:00
d428ed892a Remove 'item is not twitter link' log message 2024-09-08 21:50:30 +02:00
3 changed files with 10 additions and 13 deletions

4
go.mod
View File

@ -3,6 +3,8 @@ module git.ekzyis.com/ekzyis/unpaywall
go 1.21.0 go 1.21.0
require ( require (
github.com/ekzyis/snappy v0.5.3 github.com/ekzyis/snappy v0.8.2
github.com/mattn/go-sqlite3 v1.14.17 github.com/mattn/go-sqlite3 v1.14.17
) )
require gopkg.in/guregu/null.v4 v4.0.0 // indirect

6
go.sum
View File

@ -1,4 +1,6 @@
github.com/ekzyis/snappy v0.5.3 h1:Pq8b2s4WPz5gnHgCoZR2LVqArEVqWeVCyHSVZCawat4= github.com/ekzyis/snappy v0.8.2 h1:fT+IekT9QMg82waxfo5Qtutb5pZIJDTiw/iK0kYhRKs=
github.com/ekzyis/snappy v0.5.3/go.mod h1:BxJwdGlCwUw0Q5pQzBr59weAIS6pkVdivBBaZkkWTSo= github.com/ekzyis/snappy v0.8.2/go.mod h1:UksYI0dU0+cnzz0LQjWB1P0QQP/ghx47e4atP99a5Lk=
github.com/mattn/go-sqlite3 v1.14.17 h1:mCRHCLDUBXgpKAqIKsaAaAsrAlbkeomtRFKXh2L6YIM= github.com/mattn/go-sqlite3 v1.14.17 h1:mCRHCLDUBXgpKAqIKsaAaAsrAlbkeomtRFKXh2L6YIM=
github.com/mattn/go-sqlite3 v1.14.17/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= github.com/mattn/go-sqlite3 v1.14.17/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
gopkg.in/guregu/null.v4 v4.0.0 h1:1Wm3S1WEA2I26Kq+6vcW+w0gcDo44YKYD7YIEJNHDjg=
gopkg.in/guregu/null.v4 v4.0.0/go.mod h1:YoQhUrADuG3i9WqesrCmpNRwm1ypAgSHYqoOcTu/JrI=

13
main.go
View File

@ -19,12 +19,7 @@ type NostrClient struct {
var ( var (
TwitterUrlRegexp = regexp.MustCompile(`(?:https?:\/\/)?(?:www\.)?((?:twitter|x)\.com)\/\w+\/status(?:es)?\/\d+`) TwitterUrlRegexp = regexp.MustCompile(`(?:https?:\/\/)?(?:www\.)?((?:twitter|x)\.com)\/\w+\/status(?:es)?\/\d+`)
// references: NitterDomain = "twiiit.com"
// - https://github.com/zedeus/nitter/wiki/Instances
// - https://status.d420.de/
NitterClearnetUrls = []string{
"xcancel.com",
}
) )
func WaitUntilNext(d time.Duration) { func WaitUntilNext(d time.Duration) {
@ -57,9 +52,9 @@ func main() {
var comment string var comment string
if m = TwitterUrlRegexp.FindStringSubmatch(item.Url); m != nil { if m = TwitterUrlRegexp.FindStringSubmatch(item.Url); m != nil {
comment = strings.Replace(m[0], m[1], "xcancel.com", 1) comment = strings.Replace(m[0], m[1], NitterDomain, 1)
} else if m = TwitterUrlRegexp.FindStringSubmatch(item.Text); m != nil { } else if m = TwitterUrlRegexp.FindStringSubmatch(item.Text); m != nil {
comment = strings.Replace(m[0], m[1], "xcancel.com", 1) comment = strings.Replace(m[0], m[1], NitterDomain, 1)
} }
if comment != "" { if comment != "" {
@ -79,8 +74,6 @@ func main() {
log.Printf("created comment %d\n", cId) log.Printf("created comment %d\n", cId)
SaveComment(&sn.Comment{Id: cId, Text: comment, ParentId: item.Id}) SaveComment(&sn.Comment{Id: cId, Text: comment, ParentId: item.Id})
} else {
log.Printf("item %d is not twitter link\n", item.Id)
} }
} }