Content fetch and aggregation bot for hugo data-driven websites
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

36 lines
639 B

package main
import (
"git.sp4ke.com/sp4ke/hugobot/v3/handlers"
"fmt"
"os"
"testing"
"time"
)
const (
rssTestFeed = "https://bitcointechweekly.com/index.xml"
rssTestFeed2 = "https://bitcoinops.org/feed.xml"
)
func TestFetch(t *testing.T) {
handler := handlers.NewRSSHandler()
when, _ := time.Parse("Jan 2006", "Jun 2018")
res, err := handler.FetchSince(rssTestFeed2, when)
if err != nil {
t.Error(err)
}
for i, post := range res {
f, err := os.Create(fmt.Sprintf("%d.html", i))
if err != nil {
t.Error(err)
}
defer f.Close()
_, err = f.WriteString(post.Content)
if err != nil {
t.Error(err)
}
}
}