mirror of
https://salsa.debian.org/mdosch/feed-to-muc.git
synced 2024-11-10 00:06:49 +01:00
Changet getArticles to save timestamp after every updated article as I learned there are feeds which have the articles in wrong order (looking at you spiegel.de).
This commit is contained in:
parent
4577ec34c1
commit
e64aa5ac63
1 changed files with 18 additions and 20 deletions
|
@ -168,29 +168,27 @@ func getArticles(feedURL string, max int) (string, error) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if i == 0 {
|
last = updateTime
|
||||||
last = updateTime
|
lastUpdate.LastChange = updateTime.Format(time.RFC3339)
|
||||||
lastUpdate.LastChange = updateTime.Format(time.RFC3339)
|
|
||||||
|
|
||||||
// Remove file with cached timestamp and create it
|
// Remove file with cached timestamp and create it
|
||||||
// again with updated timestamp.
|
// again with updated timestamp.
|
||||||
// ToDo: Replace timestamp without deleting.
|
// ToDo: Replace timestamp without deleting.
|
||||||
err = os.Remove(cacheFile)
|
err = os.Remove(cacheFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("Error: ", err)
|
log.Fatal("Error: ", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
file, err = os.Create(cacheFile)
|
file, err = os.Create(cacheFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("Error: ", err)
|
log.Fatal("Error: ", err)
|
||||||
}
|
}
|
||||||
defer file.Close()
|
defer file.Close()
|
||||||
|
|
||||||
lastUpdateJSON, _ := json.MarshalIndent(lastUpdate, "", " ")
|
lastUpdateJSON, _ := json.MarshalIndent(lastUpdate, "", " ")
|
||||||
_, err = file.Write(lastUpdateJSON)
|
_, err = file.Write(lastUpdateJSON)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("Error: ", err)
|
log.Fatal("Error: ", err)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove redirects and tracking parameters from URL.
|
// Remove redirects and tracking parameters from URL.
|
||||||
|
|
Loading…
Reference in a new issue