podfeed

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

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

Go to latest
Published: May 4, 2021 License: MIT Imports: 6 Imported by: 0

README

podfeed

Podcast Feed Golang Parser

Forked because of missing go.mod

Usage


package main

import (
  "fmt"
  "log"

  "github.com/CDNHammer/podfeed"
)

func main() {
  podcast, err := podfeed.Fetch("http://feeds.soundcloud.com/users/soundcloud:users:212089450/sounds.rss")
  if err != nil {
    log.Fatal(err)
  }

  fmt.Println(podcast.Title)
  // => CapyCast

  fmt.Println(podcast.Items[0].Title)
  // => Capycast #4 Solopreneur, Entrepreneur, Intrapreneur

  fmt.Println(podcast.Owner.Name)
  // => Ship It
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Category

type Category struct {
	Text string `xml:"text,attr"`
}

type Enclosure

type Enclosure struct {
	Type   string `xml:"type,attr"`
	Url    string `xml:"url,attr"`
	Length uint64 `xml:"length,attr"`
}

type Image

type Image struct {
	Href  string `xml:"href,attr"`
	Url   string `xml:"url"`
	Title string `xml:"title"`
}

type Item

type Item struct {
	GUID        string    `xml:"guid"`
	Title       string    `xml:"title"`
	PubDate     Time      `xml:"pubDate"`
	Link        string    `xml:"link"`
	Duration    string    `xml:"duration"`
	Author      string    `xml:"author"`
	Summary     string    `xml:"summary"`
	Subtitle    string    `xml:"subtitle"`
	Description string    `xml:"description"`
	Enclosure   Enclosure `xml:"enclosure"`
	Image       Image     `xml:"image"`
}

type Owner

type Owner struct {
	Name  string `xml:"name"`
	Email string `xml:"email"`
}

type Podcast

type Podcast struct {
	Title       string   `xml:"channel>title"`
	Subtitle    string   `xml:"channel>subtitle"`
	Description string   `xml:"channel>description"`
	Link        string   `xml:"channel>link"`
	Language    string   `xml:"channel>language"`
	Author      string   `xml:"channel>author"`
	Image       Image    `xml:"channel>image"`
	Owner       Owner    `xml:"channel>owner"`
	Category    Category `xml:"channel>category"`
	Items       []Item   `xml:"channel>item"`
}

func Fetch

func Fetch(url string) (pd Podcast, err error)

func Parse

func Parse(blob []byte) (pd Podcast, err error)

func (Podcast) ReleasesByWeekday

func (p Podcast) ReleasesByWeekday() (map[string]int, error)

type Time

type Time struct {
	Value time.Time
}

func (Time) MarshalText

func (t Time) MarshalText() ([]byte, error)

func (*Time) UnmarshalText

func (t *Time) UnmarshalText(data []byte) (err error)

Jump to

Keyboard shortcuts

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