initial commit

This commit is contained in:
zongor 2024-08-19 21:54:33 -04:00
parent e412fd5aa0
commit 0dfbeea8d3
4 changed files with 109 additions and 0 deletions

15
go.mod Normal file
View File

@ -0,0 +1,15 @@
module git.alfrescocavern.com/zongor/rss2html
go 1.22.5
require (
github.com/PuerkitoBio/goquery v1.8.0 // indirect
github.com/andybalholm/cascadia v1.3.1 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mmcdole/gofeed v1.3.0 // indirect
github.com/mmcdole/goxpp v1.1.1-0.20240225020742-a0c311522b23 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
golang.org/x/net v0.4.0 // indirect
golang.org/x/text v0.5.0 // indirect
)

31
go.sum Normal file
View File

@ -0,0 +1,31 @@
github.com/PuerkitoBio/goquery v1.8.0 h1:PJTF7AmFCFKk1N6V6jmKfrNH9tV5pNE6lZMkG0gta/U=
github.com/PuerkitoBio/goquery v1.8.0/go.mod h1:ypIiRMtY7COPGk+I/YbZLbxsxn9g5ejnI2HSMtkjZvI=
github.com/andybalholm/cascadia v1.3.1 h1:nhxRkql1kdYCc8Snf7D5/D3spOX+dBgjA6u8x004T2c=
github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEqc0Sk8XGwHqvA=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/mmcdole/gofeed v1.3.0 h1:5yn+HeqlcvjMeAI4gu6T+crm7d0anY85+M+v6fIFNG4=
github.com/mmcdole/gofeed v1.3.0/go.mod h1:9TGv2LcJhdXePDzxiuMnukhV2/zb6VtnZt1mS+SjkLE=
github.com/mmcdole/goxpp v1.1.1-0.20240225020742-a0c311522b23 h1:Zr92CAlFhy2gL+V1F+EyIuzbQNbSgP4xhTODZtrXUtk=
github.com/mmcdole/goxpp v1.1.1-0.20240225020742-a0c311522b23/go.mod h1:v+25+lT2ViuQ7mVxcncQ8ch1URund48oH+jhjiwEgS8=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
golang.org/x/net v0.0.0-20210916014120-12bc252f5db8/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU=
golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM=
golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=

38
main.go Normal file
View File

@ -0,0 +1,38 @@
package main
import (
"context"
"fmt"
"log"
"os"
"time"
"bufio"
"github.com/mmcdole/gofeed"
)
func main () {
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
defer cancel()
fmt.Println("<!DOCTYPE html>")
fmt.Println("<html>")
fmt.Println("<body>")
fmt.Println("<ul>")
s := bufio.NewScanner(os.Stdin)
for s.Scan() {
fp := gofeed.NewParser()
feed, err := fp.ParseURLWithContext(s.Text(), ctx)
if err != nil {
log.Fatal(err)
} else {
for _, item := range feed.Items {
fmt.Printf("<li><a href=\"%s\">%s</a><p>%s</p></li>\n", item.Link, item.Title, item.Description)
}
}
}
fmt.Println("</ul>")
fmt.Println("</body>")
fmt.Println("</html>")
}

25
test/feeds.txt Normal file
View File

@ -0,0 +1,25 @@
https://lemmy.ml/feeds/local.xml?sort=Active
https://www.hexbear.net/feeds/all.xml?sort=Active
https://xkcd.com/atom.xml
https://www.existentialcomics.com/rss.xml
http://www.bay12games.com/dwarves/dev_release.rss
http://www.bay12games.com/dwarves/dev_now.rss
https://hackaday.com/blog/feed/
https://itsfoss.com/feed/
https://feeds.npr.org/1001/rss.xml
https://www.scmp.com/rss/91/feed
https://www.currentaffairs.org/feed
https://libcom.org/rss.xml/feed
https://itsgoingdown.org/feed
http://feeds.ancientfaith.com/AmonSul
https://feeds.transistor.fm/the-magnificast
https://anchor.fm/s/c38df04/podcast/rss
https://yogpod.libsyn.com/rss
https://revolutionspodcast.libsyn.com/rss
https://feeds.acast.com/public/shows/5e7b777ba085cbe7192b0607
https://www.omnycontent.com/d/playlist/aaea4e69-af51-495e-afc9-a9760146922b/48da3539-5da0-41ed-a1c3-aac50170b88f/f7810480-e2d3-4be5-a559-aac50170b8a6/podcast.rss
https://feeds.soundcloud.com/users/soundcloud:users:672423809/sounds.rss
https://www.omnycontent.com/d/playlist/aaea4e69-af51-495e-afc9-a9760146922b/4a3ca742-9a68-4850-a727-ab790176c0e9/d04153b0-fc4c-4191-ab18-ab790179c563/podcast.rss
https://feeds.soundcloud.com/users/soundcloud:users:211911700/sounds.rss
https://access.acast.com/rss/5fd1001d81367d4cb41fe325/Q6BVQ6VF
https://feeds.npr.org/344098539/podcast.xml