BREAKING CHANGE: Guardar contenido
This commit is contained in:
parent
ce90f0be32
commit
099148a34b
6 changed files with 20 additions and 7 deletions
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
[submodule "go-rss"]
|
||||||
|
path = go-rss
|
||||||
|
url = https://gitea.nulo.in/Nulo/go-rss
|
|
@ -51,11 +51,12 @@ func (fetcher GenericRSSFetcher) Fetch() {
|
||||||
formatted_pub_date := parsedDate.Format(DefaultDateFormat)
|
formatted_pub_date := parsedDate.Format(DefaultDateFormat)
|
||||||
|
|
||||||
_, err = fetcher.DB.Exec(`
|
_, err = fetcher.DB.Exec(`
|
||||||
INSERT INTO notas(medio, title, link, publication_date)
|
INSERT INTO notas(medio, title, content, link, publication_date)
|
||||||
VALUES(?, ?, ?, ?)
|
VALUES(?, ?, ?, ?, ?)
|
||||||
ON CONFLICT(link) DO UPDATE SET
|
ON CONFLICT(link) DO UPDATE SET
|
||||||
title=excluded.title;
|
title=excluded.title,
|
||||||
`, fetcher.MedioName, entry.Title, entry.Link, formatted_pub_date)
|
content=excluded.content;
|
||||||
|
`, fetcher.MedioName, entry.Title, entry.ContentEncoded, entry.Link, formatted_pub_date)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("Error when saving nota", err)
|
log.Println("Error when saving nota", err)
|
||||||
}
|
}
|
||||||
|
|
1
go-rss
Submodule
1
go-rss
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 1b4d16383269a0a2b5e51aae3d166a7cb1978a9f
|
9
go.mod
9
go.mod
|
@ -3,7 +3,10 @@ module medios.nulo.in/web
|
||||||
go 1.19
|
go 1.19
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/mattn/go-sqlite3 v1.14.15 // indirect
|
github.com/mattn/go-sqlite3 v1.14.15
|
||||||
github.com/paulrosania/go-charset v0.0.0-20190326053356-55c9d7a5834c // indirect
|
github.com/ungerik/go-rss v0.0.0-20200405130036-81ac15598626
|
||||||
github.com/ungerik/go-rss v0.0.0-20200405130036-81ac15598626 // indirect
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
require github.com/paulrosania/go-charset v0.0.0-20190326053356-55c9d7a5834c // indirect
|
||||||
|
|
||||||
|
replace github.com/ungerik/go-rss => ./go-rss
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -1,3 +1,7 @@
|
||||||
|
gitea.nulo.in/Nulo/go-rss v0.0.0-20200405130036-81ac15598626 h1:QkC7ZtrV7w6LON50hPGuXOz6J4196WIuCC+jRnYFlko=
|
||||||
|
gitea.nulo.in/Nulo/go-rss v0.0.0-20200405130036-81ac15598626/go.mod h1:UeGmbG1AM6Cx0FfruZOzOC02lDvXbUWV+06tAxgCoGA=
|
||||||
|
gitea.nulo.in/Nulo/go-rss v0.0.0-20221012153719-f25f0ae1f12e h1:kd56QKzyFz2ALRN5ITosKINKKo+hPLn4EW2agt2eUOM=
|
||||||
|
gitea.nulo.in/Nulo/go-rss v0.0.0-20221012153719-f25f0ae1f12e/go.mod h1:UeGmbG1AM6Cx0FfruZOzOC02lDvXbUWV+06tAxgCoGA=
|
||||||
github.com/mattn/go-sqlite3 v1.14.15 h1:vfoHhTN1af61xCRSWzFIWzx2YskyMTwHLrExkBOjvxI=
|
github.com/mattn/go-sqlite3 v1.14.15 h1:vfoHhTN1af61xCRSWzFIWzx2YskyMTwHLrExkBOjvxI=
|
||||||
github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
|
github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
|
||||||
github.com/paulrosania/go-charset v0.0.0-20190326053356-55c9d7a5834c h1:P6XGcuPTigoHf4TSu+3D/7QOQ1MbL6alNwrGhcW7sKw=
|
github.com/paulrosania/go-charset v0.0.0-20190326053356-55c9d7a5834c h1:P6XGcuPTigoHf4TSu+3D/7QOQ1MbL6alNwrGhcW7sKw=
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
CREATE TABLE notas (
|
CREATE TABLE notas (
|
||||||
medio TEXT NOT NULL,
|
medio TEXT NOT NULL,
|
||||||
title TEXT NOT NULL,
|
title TEXT NOT NULL,
|
||||||
|
content TEXT,
|
||||||
link TEXT NOT NULL,
|
link TEXT NOT NULL,
|
||||||
publication_date DATETIME NOT NULL,
|
publication_date DATETIME NOT NULL,
|
||||||
created_at DATETIME NOT NULL DEFAULT current_timestamp,
|
created_at DATETIME NOT NULL DEFAULT current_timestamp,
|
||||||
|
|
Loading…
Reference in a new issue