~m15o/the-neon-kiosk

ebf8a24b364cc851b79319bfbdb755ed6d057c71 — m15o 2 years ago d5fd705
Update deps
2 files changed, 10 insertions(+), 6 deletions(-)

M go.mod
M main.go
M go.mod => go.mod +1 -1
@@ 2,7 2,7 @@ module git.sr.ht/~m15o/kiosk

go 1.18

require git.sr.ht/~m15o/htmlj v0.0.0-20220708133931-8dda81d963cc
require git.sr.ht/~m15o/htmlj v0.0.0-20220709084050-c36dda5901f7

require golang.org/x/net v0.0.0-20220607020251-c690dde0001d // indirect


M main.go => main.go +9 -5
@@ 22,7 22,7 @@ var tpl string
type Entry struct {
	URL       string
	Author    string
	Published string
	Published time.Time
	Title     string
	Body      template.HTML
}


@@ 95,13 95,13 @@ func processContent(u, content string) (string, error) {
func build(urls []string, dst string) {
	var journals []Journal
	for _, u := range urls {
		fmt.Println("fetching", u)
		fmt.Print("Fetching: ", u)
		j, err := fetchJournal(u)
		if err != nil {
			log.Println("Error fetching journal:", err)
			continue
		}
		fmt.Println(len(j.Entries), "found")
		fmt.Printf(" - %d entries found\n", len(j.Entries))
		journals = append(journals, Journal{
			URL: u,
			J:   j,


@@ 110,8 110,13 @@ func build(urls []string, dst string) {

	var entries []Entry

	lastMonth := time.Now().AddDate(0, -1, 0)

	for _, j := range journals {
		for _, e := range j.J.Entries {
			if !e.Published.After(lastMonth) {
				continue
			}
			c, err := processContent(j.URL, e.Content)
			if err != nil {
				continue


@@ 123,12 128,11 @@ func build(urls []string, dst string) {
				Title:     e.Title,
				Body:      template.HTML(c),
			})
			break
		}
	}

	sort.Slice(entries, func(i, j int) bool {
		return entries[i].Published > entries[j].Published
		return entries[i].Published.After(entries[j].Published)
	})

	t := template.Must(template.New("").Parse(tpl))