Help us shape the future of Go! Take the 2026 Go Developer Survey

feedparse

package
v0.0.0-...-2ee7fec Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package feedparse converts raw feed bytes (RSS, Atom, JSON Feed) into ready-to-store model.Entry values. It is a pure-function library with no I/O of its own — fetching is the caller's responsibility.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EntryHash

func EntryHash(rawURL, title string, publishedAt *int64) string

EntryHash is the dedup key used by store.EntryRepo (unique per feed_id):

sha256( normalize(url) + "\n" + title + "\n" + publishedAtRFC3339 )

normalize(url) lowercases scheme+host but leaves path/query untouched, so that "HTTPS://Example.COM/Post" hashes the same as "https://example.com/Post" while "/Post" and "/POST" stay distinct. If publishedAt is nil, the time component is the empty string.

Types

type Result

type Result struct {
	Title       string
	SiteURL     string
	Description string
	Entries     []model.Entry
}

Result is what Parse returns for callers (the polling worker, OPML import, etc.). Entries have Hash, Title, URL, Author, Summary, PublishedAt set; the caller is responsible for filling FeedID, UserID, CreatedAt and inserting.

func Parse

func Parse(ctx context.Context, body []byte, sourceURL string) (*Result, error)

Parse parses RSS, Atom, or JSON Feed bytes. sourceURL is used to resolve relative entry links against the feed's origin.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL