rss

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2024 License: MIT Imports: 5 Imported by: 0

README

Simple RSS reader library for Go

Install

go get github.com/wmentor/rss

Usage

package main

import (
  "fmt"

  "github.com/wmentor/rss"
)

func main() {

  list, err := rss.Get("https://morphs.ru/rss.xml")
  if err != nil {
    panic(err)
  }

  for _, rec := range list {
    fmt.Printf("Title=%s\nLink=%s\nDecription=%s\n\n", rec.Title, rec.Link, rec.Description)
  }
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRequestFailed error = errors.New("http request failed")
)

Functions

This section is empty.

Types

type Rss

type Rss struct {
	Channel RssChannel `xml:"channel"`
}

type RssChannel

type RssChannel struct {
	Title       string     `xml:"title"`
	Link        string     `xml:"link"`
	Description string     `xml:"description"`
	Items       []*RssItem `xml:"item"`
}

type RssItem

type RssItem struct {
	Title       string `xml:"title"`
	Link        string `xml:"link"`
	Description string `xml:"description"`
}

func Get

func Get(url string) ([]*RssItem, error)

Jump to

Keyboard shortcuts

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