feed/feed.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package feed import ( "log" "sort" "github.com/SlyMarbo/rss" ) var lovelyFeedList = []string{ "https://100r.co/links/rss.xml", "https://andrewkelley.me/rss.xml", "https://begriffs.com/atom.xml", "https://cyberia.club/blog/blog.xml", "https://davebucklin.com/feed.xml", "https://facklambda.dev/atom.xml", "https://icyphox.sh/blog/feed.xml", "https://katherine.cox-buday.com/rss.xml", "https://kattraxler.github.io/feed.xml", "https://sanine.net/rss.xml", "https://sequentialread.com/rss", "https://spencerkrum.com/index.xml", } func GetAllFeeds() []rss.Feed { var feeds []rss.Feed for _, f := range lovelyFeedList { feed, err := rss.Fetch(f) if err != nil { log.Println(err) continue } feeds = append(feeds, *feed) } return feeds } func SortItems(f []rss.Feed) []rss.Item { var posts []rss.Item for _, f := range f { for _, i := range f.Items { posts = append(posts, *i) } } // magick slice sorter by date sort.Slice(posts, func(i, j int) bool { return posts[i].Date.After(posts[j].Date) }) return posts }