feeds

package module
v0.0.0-...-e4207ad Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: MIT Imports: 15 Imported by: 0

README


Project license

Pull Requests welcome code with love by joshuar

Table of Contents

About

go-syndication is Go package for dealing with various feed syndication formats. It supports:

  • RSS
  • Atom
  • JSONFeed
  • Sitemaps
  • OPML
  • Various RSS/Atom extensions such as media, dublin core, itunes, and googleplay.

The package can read and write all formats. It includes built-in validation and sanitisation of elements.

Built With

Getting Started

Prerequisites

TBA.

Installation

TBA.

Usage

TBA.

Roadmap

See the open issues for a list of proposed features (and known issues).

Support

Reach out to the maintainer at one of the following places:

Project assistance

If you want to say thank you or/and support active development of go-syndication:

  • Add a GitHub Star to the project.
  • Tweet about the go-syndication.
  • Write interesting articles about the project on Dev.to, Medium or your personal blog.

Together, we can make go-syndication better!

Contributing

First off, thanks for taking the time to contribute! Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make will benefit everybody else and are greatly appreciated.

Please read our contribution guidelines, and thank you for being involved!

Authors & contributors

The original setup of this repository is by joshuar.

For a full list of all authors and contributors, see the contributors page.

Security

go-syndication follows good practices of security, but 100% security cannot be assured. go-syndication is provided "as is" without any warranty. Use at your own risk.

For more information and to report security issues, please refer to our security documentation.

License

This project is licensed under the MIT license.

See LICENSE for more information.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrParseBytes indicates an error occurred trying to parse a byte array as a feed.
	ErrParseBytes = errors.New("unable to parse bytes as feed")
)
View Source
var ErrUnmarshal = errors.New("unmarshaling object failed")

ErrUnmarshal indicates an error occurred trying to unmarshal data into a given feed object.

Functions

func Decode

func Decode[T any](namespace string, rd io.Reader) (T, error)

Decode will decode the byte array into the given type T, and assign values without a namespace with the given namespace.

func DetectSourceType

func DetectSourceType(r io.Reader) (types.SourceType, error)

DetectSourceType determines the feed source by extracting key signatures from the data. It can detect supported feed formats as well as HTML.

func Encode

func Encode[T any](feed T) ([]byte, error)

Encode will encode the given type T into a byte array.

Types

type Feed

type Feed struct {
	types.FeedSource `json:"source"`

	SourceType types.SourceType `json:"type"`
}

Feed represents any feed type containing a number of items.

func NewDecoder

func NewDecoder[T any](data io.Reader) (*Feed, error)

NewDecoder will create a new Feed of the given type from the given io.Reader.

func NewFeedFromSource

func NewFeedFromSource[T types.FeedSource](source T) *Feed

NewFeedFromSource will create a new Feed from the given source that satisfies the FeedSource interface. This can be used to create a Feed from an existing rss.RSS or atom.Feed object.

func (*Feed) GetItems

func (f *Feed) GetItems() []Item

GetItems retrieves a slice of Item for the Feed.

func (*Feed) UnmarshalJSON

func (f *Feed) UnmarshalJSON(v []byte) error

UnmarshalJSON handles unmarshaling of a Feed from JSON.

type Item

type Item struct {
	types.ItemSource `json:"source"`

	SourceType types.SourceType `json:"type"`
	FeedTitle  string           `json:"feed_title"`
}

Item represents a single item or entry (or article) in a feed.

func (*Item) UnmarshalJSON

func (i *Item) UnmarshalJSON(v []byte) error

UnmarshalJSON handles unmarshaling of an Item from JSON.

Directories

Path Synopsis
Package atom provides primitives to interact with the openapi HTTP API.
Package atom provides primitives to interact with the openapi HTTP API.
extensions
dc
Package dc provides primitives to interact with the openapi HTTP API.
Package dc provides primitives to interact with the openapi HTTP API.
googleplay
Package googleplay provides primitives to interact with the openapi HTTP API.
Package googleplay provides primitives to interact with the openapi HTTP API.
itunes
Package itunes provides primitives to interact with the openapi HTTP API.
Package itunes provides primitives to interact with the openapi HTTP API.
media
Package media provides primitives to interact with the openapi HTTP API.
Package media provides primitives to interact with the openapi HTTP API.
rss
Package rss provides primitives to interact with the openapi HTTP API.
Package rss provides primitives to interact with the openapi HTTP API.
Package jsonfeed provides primitives to interact with the openapi HTTP API.
Package jsonfeed provides primitives to interact with the openapi HTTP API.
Package opengraph provides primitives to interact with the openapi HTTP API.
Package opengraph provides primitives to interact with the openapi HTTP API.
Package opml provides primitives to interact with the openapi HTTP API.
Package opml provides primitives to interact with the openapi HTTP API.
Package rss provides primitives to interact with the openapi HTTP API.
Package rss provides primitives to interact with the openapi HTTP API.
Package schema contains the OpenAPI schema definitions for go-syndication.
Package schema contains the OpenAPI schema definitions for go-syndication.
Package sitemap provides primitives to interact with the openapi HTTP API.
Package sitemap provides primitives to interact with the openapi HTTP API.
Package types provides primitives to interact with the openapi HTTP API.
Package types provides primitives to interact with the openapi HTTP API.

Jump to

Keyboard shortcuts

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