Input the URLs of the feeds you wish to archive below. You can add as many as needed, and access them through the website or API. Alternatively, include links to .opml files, and the feeds within will be archived.
You can also upload .opml files containing the feeds you wish to archive:
`
FAQ := `
FAQ
What are web feeds?
Web feeds are a way to distribute content on the web. They allow users to access updates from websites without having to visit them directly. Feeds are typically used for news websites, blogs, and other sites that frequently update content.
You can read more about web feeds on Wikipedia.
What is FeedVault?
FeedVault is a service that archives web It allows users to access and search for historical content from various websites. The service is designed to preserve the history of the web and provide a reliable source for accessing content that may no longer be available on the original websites.
Why archive feeds?
Web feeds are a valuable source of information, and archiving them ensures that the content is preserved for future reference. By archiving feeds, we can ensure that historical content is available for research, analysis, and other purposes. Additionally, archiving feeds can help prevent the loss of valuable information due to website changes, outages, or other issues.
How does it work?
FeedVault is written in Go and uses the gofeed library to parse The service periodically checks for new content in the feeds and stores it in a database. Users can access the archived feeds through the website or API.
How can I access the archived feeds?
You can access the archived feeds through the website or API. The website provides a user interface for searching and browsing the feeds, while the API allows you to access the feeds programmatically. You can also download the feeds in various formats, such as JSON, XML, or RSS.
`
content += FAQ
htmlData := HTMLData{
Title: "FeedVault",
Description: "FeedVault - A feed archive",
Keywords: "RSS, Atom, Feed, Archive",
Author: "TheLovinator",
CanonicalURL: "http://localhost:8000/",
Content: content,
}
html := FullHTML(htmlData)
_, err := w.Write([]byte(html))
if err != nil {
log.Println("Error writing response:", err)
}
}
func UploadOpmlHandler(w http.ResponseWriter, r *http.Request) {
// Parse the form and get the file
err := r.ParseMultipartForm(10 << 20) // 10 MB
if err != nil {
http.Error(w, "Error parsing form", http.StatusInternalServerError)
return
}
file, _, err := r.FormFile("file")
if err != nil {
http.Error(w, "No file provided", http.StatusBadRequest)
return
}
defer file.Close()
// Read the file
all, err := io.ReadAll(file)
if err != nil {
http.Error(w, "Failed to read file", http.StatusInternalServerError)
return
}
// Parse the OPML file
parseResult := []ParseResult{}
links, err := ParseOpml(string(all))
if err != nil {
parseResult = append(parseResult, ParseResult{FeedURL: "/upload_opml", Msg: err.Error(), IsError: true})
} else {
// Add the feeds to the database
for _, feed_url := range links.XMLLinks {
log.Println("Adding feed:", feed_url)
// Validate the URL
err := ValidateFeedURL(feed_url)
if err != nil {
parseResult = append(parseResult, ParseResult{FeedURL: feed_url, Msg: err.Error(), IsError: true})
continue
}
parseResult = append(parseResult, ParseResult{FeedURL: feed_url, Msg: "Added", IsError: false})
}
}
// Return the results
htmlData := HTMLData{
Title: "FeedVault",
Description: "FeedVault - A feed archive",
Keywords: "RSS, Atom, Feed, Archive",
Author: "TheLovinator",
CanonicalURL: "http://localhost:8000/",
Content: "
Feeds added.
",
ParseResult: parseResult,
}
html := FullHTML(htmlData)
_, err = w.Write([]byte(html))
if err != nil {
log.Println("Error writing response:", err)
}
}
func FeedHandler(w http.ResponseWriter, r *http.Request) {
// Get the feed ID from the URL
parts := strings.Split(r.URL.Path, "/")
if len(parts) < 3 {
http.Error(w, "No feed ID provided", http.StatusBadRequest)
return
}
feedID, err := strconv.ParseInt(parts[2], 10, 64)
if err != nil {
http.Error(w, "Invalid feed ID", http.StatusBadRequest)
return
}
// Get the feed from the database
feed, err := DB.GetFeed(context.Background(), feedID)
if err != nil {
http.Error(w, "Error getting feed", http.StatusInternalServerError)
return
}
// Get the items for the feed
items, err := DB.GetItems(context.Background(), db.GetItemsParams{
FeedID: feedID,
Limit: 100,
})
if err != nil {
http.Error(w, "Error getting items", http.StatusInternalServerError)
return
}
// Build the HTML
fb := strings.Builder{}
for _, item := range items {
// Get authors for the item
authors, err := DB.GetItemAuthors(context.Background(), db.GetItemAuthorsParams{
ItemID: item.ID,
Limit: 100,
})
if err != nil {
http.Error(w, "Error getting authors", http.StatusInternalServerError)
return
}
// Get extensions for the item
extensions, err := DB.GetItemExtensions(context.Background(), db.GetItemExtensionsParams{
ItemID: item.ID,
Limit: 100,
})
if err != nil {
http.Error(w, "Error getting extensions", http.StatusInternalServerError)
return
}
fb.WriteString("