Documentation ¶
Overview ¶
Package podcast generates a fully compliant iTunes and RSS 2.0 podcast feed for GoLang using a simple API.
Full documentation with detailed examples located at https://godoc.org/github.com/eduncan911/podcast
Usage ¶
To use, `go get` and `import` the package like your typical GoLang library.
$ go get -u github.com/eduncan911/podcast import "github.com/georgboe/rss-feed-generator"
The API exposes a number of method receivers on structs that implements the logic required to comply with the specifications and ensure a compliant feed. A number of overrides occur to help with iTunes visibility of your episodes.
Notably, the `Podcast.AddItem` function performs most of the heavy lifting by taking the `Item` input and performing validation, overrides and duplicate setters through the feed.
Full detailed Examples of the API are at https://godoc.org/github.com/eduncan911/podcast.
Contributing ¶
See the CONTRIBUTING.md for all the details.
Go Modules ¶
This library is supported on GoLang 1.7 and higher.
We have implemented Go Modules support and the CI pipeline shows it working with new installs, tested with Go 1.13. To keep 1.7 compatibility, we use `go mod vendor` to maintain the `vendor/` folder for older 1.7 and later runtimes.
If either runtime has an issue, please create an Issue and I will address.
Extensibility ¶
For version 1.x, you are not restricted in having full control over your feeds. You may choose to skip the API methods and instead use the structs directly. The fields have been grouped by RSS 2.0 and iTunes fields with iTunes specific fields all prefixed with the letter `I`.
However, do note that the 2.x version currently in progress will break this extensibility and enforce API methods going forward. This is to ensure that the feed can both be marshalled, and unmarshalled back and forth (current 1.x branch can only be unmarshalled - hence the work for 2.x).
Fuzzing Inputs ¶
`go-fuzz` has been added in 1.4.1, covering all exported API methods. They have been ran extensively and no issues have come out of them yet (most tests were ran overnight, over about 11 hours with zero crashes).
If you wish to help fuzz the inputs, with Go 1.13 or later you can run `go-fuzz` on any of the inputs.
go get -u github.com/dvyukov/go-fuzz/go-fuzz go get -u github.com/dvyukov/go-fuzz/go-fuzz-build go get -u github.com/eduncan911/podcast cd $GOPATH/src/github.com/eduncan911/podcast go-fuzz-build go-fuzz -func FuzzPodcastAddItem
To obtain a list of available funcs to pass, just run `go-fuzz` without any parameters:
$ go-fuzz 2020/02/13 07:27:32 -func flag not provided, but multiple fuzz functions available: FuzzItemAddDuration, FuzzItemAddEnclosure, FuzzItemAddImage, FuzzItemAddPubDate, FuzzItemAddSummary, FuzzPodcastAddAtomLink, FuzzPodcastAddAuthor, FuzzPodcastAddCategory, FuzzPodcastAddImage, FuzzPodcastAddItem, FuzzPodcastAddLastBuildDate, FuzzPodcastAddPubDate, FuzzPodcastAddSubTitle, FuzzPodcastAddSummary, FuzzPodcastBytes, FuzzPodcastEncode, FuzzPodcastNew
If you do find an issue, please raise an issue immediately and I will quickly address.
Roadmap ¶
The 1.x branch is now mostly in maintenance mode, open to PRs. This means no more planned features on the 1.x feature branch is expected. With the success of 6 iTunes-accepted podcasts I have published with this library, and with the feedback from the community, the 1.x releases are now considered stable.
The 2.x branch's primary focus is to allow for bi-direction marshalling both ways. Currently, the 1.x branch only allows unmarshalling to a serial feed. An attempt to marshall a serialized feed back into a Podcast form will error or not work correctly. Note that while the 2.x branch is targeted to remain backwards compatible, it is true if using the public API funcs to set parameters only. Several of the underlying public fields are being removed in order to accommodate the marshalling of serialized data. Therefore, a version 2.x is denoted for this release.
Versioning ¶
We use SemVer versioning schema. You can rest assured that pulling 1.x branches will remain backwards compatible now and into the future.
However, the new 2.x branch, while keeping the same API, is expected break those that bypass the API methods and use the underlying public properties instead.
Release Notes ¶
v1.4.2
- Slim down Go Modules for consumers (#32)
v1.4.1
- Implement fuzz logic testing of exported funcs (#31)
- Upgrade CICD Pipeline Tooling (#31)
- Update documentation for 1.x and 2.3 (#31)
- Allow godoc2ghmd to run without network (#31)
v1.4.0
- Add Go Modules, Update vendor folder (#26, #25)
- Add C.I. GitHub Actions (#25)
- Add additional error checks found by linters (#25)
- Go Fmt enclosure_test.go (#25)
v1.3.2
- Correct count len of UTF8 strings (#9)
- Implement duration parser (#8)
- Fix Github and GoDocs Markdown (#14)
- Move podcast.go Private Methods to Respected Files (#12)
- Allow providing GUID on Podcast (#15)
v1.3.1
- increased itunes compliance after feedback from Apple:
- specified what categories should be set with AddCategory().
- enforced title and link as part of Image.
- added Podcast.AddAtomLink() for more broad compliance to readers.
v1.3.0
- fixes Item.Duration being set incorrectly.
- changed Item.AddEnclosure() parameter definition (Bytes not Seconds!).
- added Item.AddDuration formatting and override.
- added more documentation surrounding Item.Enclosure{}
v1.2.1
- added Podcast.AddSubTitle() and truncating to 64 chars.
- added a number of Guards to protect against empty fields.
v1.2.0
- added Podcast.AddPubDate() and Podcast.AddLastBuildDate() overrides.
- added Item.AddImage() to mask some cumbersome addition of IImage.
- added Item.AddPubDate to simply datetime setters.
- added more examples (mostly around Item struct).
- tweaked some documentation.
v1.1.0
- Enabling CDATA in ISummary fields for Podcast and Channel.
v1.0.0
- Initial release.
- Full documentation, full examples and complete code coverage.
References ¶
RSS 2.0: https://cyber.harvard.edu/rss/rss.html
Podcasts: https://help.apple.com/itc/podcasts_connect/#/itca5b22233
Index ¶
- Constants
- func GenerateFeedString(str string) string
- func ParseCategories(categories []string) map[string][]string
- type AtomLink
- type Author
- type Description
- type Enclosure
- type EnclosureType
- type EncodedContent
- type GUID
- type GooglePlayCategory
- type GooglePlayImage
- type ICategory
- type IImage
- type ISummary
- type Image
- type Item
- func (i *Item) AddDescription(description Description)
- func (i *Item) AddDuration(durationInSeconds int64)
- func (i *Item) AddEnclosure(url string, enclosureType EnclosureType, enclosureTypeString string, ...)
- func (i *Item) AddEpisodeNumber(episodeNumber int64)
- func (i *Item) AddEpisodeType(episodeType string)
- func (i *Item) AddGUID(guid string)
- func (i *Item) AddImage(url string)
- func (i *Item) AddItunesBlock(block string)
- func (i *Item) AddItunesTitle(title string)
- func (i *Item) AddLink(link string)
- func (i *Item) AddParentalAdvisory(parentalAdvisory string)
- func (i *Item) AddPubDate(datetime string)
- func (i *Item) AddSeasonNumber(seasonNumber int64)
- func (i *Item) AddSummary(summary string)
- func (i *Item) AddTitle(title string)
- type Podcast
- func (p *Podcast) AddAtomLink(href string)
- func (p *Podcast) AddAuthor(authors []string)
- func (p *Podcast) AddCategory(category string, subCategories []string)
- func (p *Podcast) AddCopyright(copyright string)
- func (p *Podcast) AddDescription(description Description)
- func (p *Podcast) AddGenerator(generator string)
- func (p *Podcast) AddImage(url string)
- func (p *Podcast) AddItem(i Item) (int, error)
- func (p *Podcast) AddItunesBlock(block string)
- func (p *Podcast) AddItunesComplete(complete string)
- func (p *Podcast) AddItunesTitle(title string)
- func (p *Podcast) AddItunesType(showType string)
- func (p *Podcast) AddLanguage(language string)
- func (p *Podcast) AddLastBuildDate(datetime string)
- func (p *Podcast) AddLink(link string)
- func (p *Podcast) AddNewFeedURL(newFeedUrl string)
- func (p *Podcast) AddOwner(name, email string)
- func (p *Podcast) AddParentalAdvisory(parentalAdvisory string)
- func (p *Podcast) AddPubDate(datetime string)
- func (p *Podcast) AddSubTitle(subTitle string)
- func (p *Podcast) AddSummary(summary string)
- func (p *Podcast) AddTitle(title string)
- func (p *Podcast) Encode(w io.Writer) error
- func (p *Podcast) String() string
- type PodcastWrapper
- type TextInput
Examples ¶
Constants ¶
const ( ParentalAdvisoryClean = "clean" ParentalAdvisoryExplicit = "explicit" EpisodeTypeFull = "full" EpisodeTypeTrailer = "trailer" EpisodeTypeBonus = "bonus" )
Constants used across the RSS Feed Generation.
const ( HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" ATOMNS = "http://www.w3.org/2005/Atom" ITUNESNS = "http://www.itunes.com/dtds/podcast-1.0.dtd" GOOGLEPLAYNS = "http://www.google.com/schemas/play-podcasts/1.0" SPOTIFYNS = "http://www.spotify.com/ns/rss" CONTENT = "http://purl.org/rss/1.0/modules/content/" )
Constants to use while generating podcast feed.
Variables ¶
This section is empty.
Functions ¶
func GenerateFeedString ¶
* Ensures that the string passed in is compliant with RSS feed requirements specified in https://help.apple.com/itc/podcasts_connect/#/itc1723472cb
func ParseCategories ¶
Utility function to parse categories and divide them into
Types ¶
type AtomLink ¶
type AtomLink struct { XMLName xml.Name `xml:"atom:link"` HREF string `xml:"href,attr"` Rel string `xml:"rel,attr"` Type string `xml:"type,attr"` }
AtomLink represents the Atom reference link.
type Author ¶
type Author struct { XMLName xml.Name `xml:"itunes:owner"` Name string `xml:"itunes:name"` Email string `xml:"itunes:email"` }
Author represents a named author and email.
For iTunes compliance, both Name and Email are required.
type Description ¶
* * This description will be used at both the channel and item level to provide the ability to add hyperlinks, formatted text, etc.
type Enclosure ¶
type Enclosure struct { XMLName xml.Name `xml:"enclosure"` // URL is the downloadable url for the content. (Required) URL string `xml:"url,attr"` // Length is the size in Bytes of the download. (Required) Length int64 `xml:"-"` // LengthFormatted is the size in Bytes of the download. (Required) // // This field gets overwritten with the API when setting Length. LengthFormatted string `xml:"length,attr"` // Type is MIME type encoding of the download. (Required) Type EnclosureType `xml:"-"` // TypeFormatted is MIME type encoding of the download. (Required) // // This field gets overwritten with the API when setting Type. TypeFormatted string `xml:"type,attr"` }
Enclosure represents a download enclosure.
type EnclosureType ¶
type EnclosureType int
EnclosureType specifies the type of the enclosure.
const ( M4A EnclosureType = iota M4V MP4 MP3 MOV PDF EPUB )
EnclosureType specifies the type of the enclosure.
func (EnclosureType) GetEnclosureType ¶
func (et EnclosureType) GetEnclosureType(enclosureType string) EnclosureType
func (EnclosureType) String ¶
func (et EnclosureType) String() string
String returns the MIME type encoding of the specified EnclosureType.
type EncodedContent ¶
EncodedContent encapsulates the recommended way to add HTML content in the description that is properly formatted across all podcast distributors (<content:encoded>)
type GUID ¶
type GUID struct { XMLName xml.Name `xml:"guid"` IsPermaLink bool `xml:"isPermaLink,attr"` Value string `xml:",chardata"` }
EncodedContent encapsulates the recommended way to add HTML content in the description that is properly formatted across all podcast distributors (<content:encoded>)
type GooglePlayCategory ¶
type GooglePlayCategory struct { XMLName xml.Name `xml:"googleplay:category"` Text string `xml:"text,attr"` GooglePlayCategories []*GooglePlayCategory }
type GooglePlayImage ¶
type GooglePlayImage struct { XMLName xml.Name `xml:"googleplay:image"` HREF string `xml:"href,attr"` }
* * Represents a google play image. Is is a required tag according to https://support.google.com/podcast-publishers/answer/9889544?hl=en
type ICategory ¶
type ICategory struct { XMLName xml.Name `xml:"itunes:category"` Text string `xml:"text,attr"` ICategories []*ICategory }
ICategory is a 2-tier classification system for iTunes.
type IImage ¶
IImage represents an iTunes image.
Podcast feeds contain artwork that is a minimum size of 1400 x 1400 pixels and a maximum size of 3000 x 3000 pixels, 72 dpi, in JPEG or PNG format with appropriate file extensions (.jpg, .png), and in the RGB colorspace. To optimize images for mobile devices, Apple recommends compressing your image files.
type ISummary ¶
ISummary is a 4000 character rich-text field for the itunes:summary tag.
This is rendered as CDATA which allows for HTML tags such as `<a href="">`.
type Image ¶
type Image struct { XMLName xml.Name `xml:"image"` URL string `xml:"url"` Title string `xml:"title"` Link string `xml:"link,omitempty"` Description string `xml:"description,omitempty"` Width int `xml:"width,omitempty"` Height int `xml:"height,omitempty"` }
Image represents an image.
Podcast feeds contain artwork that is a minimum size of 1400 x 1400 pixels and a maximum size of 3000 x 3000 pixels, 72 dpi, in JPEG or PNG format with appropriate file extensions (.jpg, .png), and in the RGB colorspace. To optimize images for mobile devices, Apple recommends compressing your image files.
type Item ¶
type Item struct { XMLName xml.Name `xml:"item"` GUID *GUID Title string `xml:"title"` Link string `xml:"link"` Description *Description EncodedDescription *EncodedContent AuthorFormatted string `xml:"author,omitempty"` Category string `xml:"category,omitempty"` Comments string `xml:"comments,omitempty"` Source string `xml:"source,omitempty"` PubDate string `xml:"pubDate,omitempty"` Enclosure *Enclosure // https://help.apple.com/itc/podcasts_connect/#/itcb54353390 IAuthor string `xml:"itunes:author,omitempty"` ITitle string `xml:"itunes:title,omitempty"` SeasonNumber string `xml:"itunes:season,omitempty"` EpisodeNumber string `xml:"itunes:episode,omitempty"` EpisodeType string `xml:"itunes:episodeType,omitempty"` ISubtitle string `xml:"itunes:subtitle,omitempty"` ISummary *ISummary IImage *IImage IBlock string `xml:"itunes:block,omitempty"` IDuration string `xml:"itunes:duration,omitempty"` IExplicit string `xml:"itunes:explicit,omitempty"` IIsClosedCaptioned string `xml:"itunes:isClosedCaptioned,omitempty"` IOrder string `xml:"itunes:order,omitempty"` }
Item represents a single entry in a podcast.
Article minimal requirements are: - Title - Description - Link
Audio minimal requirements are: - Title - Description - Enclosure (HREF, Type and Length all required)
Recommendations: - Setting the minimal fields sets most of other fields, including iTunes. - Use the Published time.Time setting instead of PubDate. - Always set an Enclosure.Length, to be nice to your downloaders. - Use Enclosure.Type instead of setting TypeFormatted for valid extensions.
func (*Item) AddDescription ¶
func (i *Item) AddDescription(description Description)
func (*Item) AddDuration ¶
AddDuration adds the duration to the iTunes duration field.
Example ¶
package main import ( "fmt" podcast "github.com/georgboe/rss-feed-generator" ) func main() { i := podcast.Item{ Title: "item title", Description: &podcast.Description{Text: "item desc"}, Link: "item link", } d := int64(533) // add the Duration in Seconds i.AddDuration(d) fmt.Println(i.IDuration) }
Output: 533
func (*Item) AddEnclosure ¶
func (i *Item) AddEnclosure( url string, enclosureType EnclosureType, enclosureTypeString string, lengthInBytes int64)
AddEnclosure adds the downloadable asset to the podcast Item.
func (*Item) AddEpisodeNumber ¶
func (*Item) AddEpisodeType ¶
func (*Item) AddImage ¶
AddImage adds the image as an iTunes-only IImage. RSS 2.0 does not have the specification of Images at the Item level.
Podcast feeds contain artwork that is a minimum size of 1400 x 1400 pixels and a maximum size of 3000 x 3000 pixels, 72 dpi, in JPEG or PNG format with appropriate file extensions (.jpg, .png), and in the RGB colorspace. To optimize images for mobile devices, Apple recommends compressing your image files.
func (*Item) AddItunesBlock ¶
func (*Item) AddItunesTitle ¶
func (*Item) AddParentalAdvisory ¶
func (*Item) AddPubDate ¶
func (*Item) AddSeasonNumber ¶
func (*Item) AddSummary ¶
AddSummary adds the iTunes summary.
Limit: 4000 characters
Note that this field is a CDATA encoded field which allows for rich text such as html links: `<a href="http://www.apple.com">Apple</a>`.
type Podcast ¶
type Podcast struct { XMLName xml.Name `xml:"channel"` AtomLink *AtomLink Generator string `xml:"generator,omitempty"` Title string `xml:"title"` Link string `xml:"link,omitempty"` Description *Description Language string `xml:"language,omitempty"` Cloud string `xml:"cloud,omitempty"` Copyright string `xml:"copyright,omitempty"` Docs string `xml:"docs,omitempty"` PubDate string `xml:"pubDate,omitempty"` LastBuildDate string `xml:"lastBuildDate,omitempty"` ManagingEditor string `xml:"managingEditor,omitempty"` Rating string `xml:"rating,omitempty"` SkipHours string `xml:"skipHours,omitempty"` SkipDays string `xml:"skipDays,omitempty"` TTL int `xml:"ttl,omitempty"` WebMaster string `xml:"webMaster,omitempty"` Image *Image TextInput *TextInput // https://help.apple.com/itc/podcasts_connect/#/itcb54353390 ITitle string `xml:"itunes:title,omitempty"` IAuthor string `xml:"itunes:author,omitempty"` ISubtitle string `xml:"itunes:subtitle,omitempty"` IType string `xml:"itunes:type,omitempty"` ISummary *ISummary IBlock string `xml:"itunes:block,omitempty"` IImage *IImage IDuration string `xml:"itunes:duration,omitempty"` IExplicit string `xml:"itunes:explicit,omitempty"` IComplete string `xml:"itunes:complete,omitempty"` INewFeedURL string `xml:"itunes:new-feed-url,omitempty"` IOwner *Author // Author is formatted for itunes as-is ICategories []*ICategory Items []*Item // contains filtered or unexported fields }
Podcast represents a podcast.
func New ¶
func New(title, link string, description Description, pubDate, lastBuildDate *time.Time) Podcast
New instantiates a Podcast with required parameters.
Nil-able fields are optional but recommended as they are formatted to the expected proper formats.
Example ¶
ti, l, d := "title", "link", podcast.Description{Text: "description"} // instantiate a new Podcast p := podcast.New(ti, l, d, &pubDate, &updatedDate) p.AddLanguage("en-us") fmt.Println(p.Title, p.Link, p.Description.Text, p.Language)
Output: title link description en-us
func (*Podcast) AddAtomLink ¶
AddAtomLink adds a FQDN reference to an atom feed.
func (*Podcast) AddAuthor ¶
AddAuthor adds the specified Author to the podcast.
func (p *Podcast) AddAuthor(name, email string) { if len(email) == 0 { return } p.ManagingEditor = parseAuthorNameEmail(&Author{ Name: name, Email: email, }) p.IAuthor = p.ManagingEditor }
Example ¶
package main import ( "fmt" podcast "github.com/georgboe/rss-feed-generator" ) func main() { p := podcast.New("title", "link", podcast.Description{Text: "Description"}, nil, nil) // add the Author // p.AddAuthor("the name", "me@test.com") p.AddAuthor([]string{"the name"}) fmt.Println(p.ManagingEditor) fmt.Println(p.IAuthor) }
Output: the name
func (*Podcast) AddCategory ¶
AddCategory adds the category to the Podcast.
ICategory can be listed multiple times.
Calling this method multiple times will APPEND the category to the existing list, if any, including ICategory.
Note that Apple iTunes has a specific list of categories that only can be used and will invalidate the feed if deviated from the list. That list is as follows.
- Arts
- Design
- Fashion & Beauty
- Food
- Literature
- Performing Arts
- Visual Arts
- Business
- Business News
- Careers
- Investing
- Management & Marketing
- Shopping
- Comedy
- Education
- Education Technology
- Higher Education
- K-12
- Language Courses
- Training
- Games & Hobbies
- Automotive
- Aviation
- Hobbies
- Other Games
- Video Games
- Government & Organizations
- Local
- National
- Non-Profit
- Regional
- Health
- Alternative Health
- Fitness & Nutrition
- Self-Help
- Sexuality
- Kids & Family
- Music
- News & Politics
- Religion & Spirituality
- Buddhism
- Christianity
- Hinduism
- Islam
- Judaism
- Other
- Spirituality
- Science & Medicine
- Medicine
- Natural Sciences
- Social Sciences
- Society & Culture
- History
- Personal Journals
- Philosophy
- Places & Travel
- Sports & Recreation
- Amateur
- College & High School
- Outdoor
- Professional
- Technology
- Gadgets
- Podcasting
- Software How-To
- Tech News
- TV & Film
Example ¶
package main import ( "fmt" podcast "github.com/georgboe/rss-feed-generator" ) func main() { p := podcast.New("title", "link", podcast.Description{Text: "Description"}, nil, nil) // add the Category p.AddCategory("Bombay", nil) p.AddCategory("American", []string{"Longhair", "Shorthair"}) p.AddCategory("Siamese", nil) fmt.Println(len(p.ICategories), len(p.ICategories[1].ICategories)) }
Output: 3 2
func (*Podcast) AddCopyright ¶
func (*Podcast) AddDescription ¶
func (p *Podcast) AddDescription(description Description)
func (*Podcast) AddGenerator ¶
func (*Podcast) AddImage ¶
AddImage adds the specified Image to the Podcast.
Podcast feeds contain artwork that is a minimum size of 1400 x 1400 pixels and a maximum size of 3000 x 3000 pixels, 72 dpi, in JPEG or PNG format with appropriate file extensions (.jpg, .png), and in the RGB colorspace. To optimize images for mobile devices, Apple recommends compressing your image files.
Example ¶
package main import ( "fmt" podcast "github.com/georgboe/rss-feed-generator" ) func main() { p := podcast.New("title", "link", podcast.Description{Text: "Description"}, nil, nil) // add the Image p.AddImage("http://example.com/image.jpg") if p.Image != nil { fmt.Println(p.Image.URL) } }
Output: http://example.com/image.jpg
func (*Podcast) AddItem ¶
AddItem adds the podcast episode. It returns a count of Items added or any errors in validation that may have occurred.
This method takes the "itunes overrides" approach to populating itunes tags according to the overrides rules in the specification. This not only complies completely with iTunes parsing rules; but, it also displays what is possible to be set on an individual episode level – if you wish to have more fine grain control over your content.
This method imposes strict validation of the Item being added to confirm to Podcast and iTunes specifications.
Article minimal requirements are:
- Title
- Description
- Link
Audio, Video and Downloads minimal requirements are:
- Title
- Description
- Enclosure (HREF, Type and Length all required)
The following fields are always overwritten (don't set them):
- GUID
- PubDateFormatted
- AuthorFormatted
- Enclosure.TypeFormatted
- Enclosure.LengthFormatted
Recommendations:
- Just set the minimal fields: the rest get set for you.
- Always set an Enclosure.Length, to be nice to your downloaders.
- Follow Apple's best practices to enrich your podcasts: https://help.apple.com/itc/podcasts_connect/#/itc2b3780e76
- For specifications of itunes tags, see: https://help.apple.com/itc/podcasts_connect/#/itcb54353390
func (*Podcast) AddItunesBlock ¶
func (*Podcast) AddItunesComplete ¶
func (*Podcast) AddItunesTitle ¶
func (*Podcast) AddItunesType ¶
func (*Podcast) AddLanguage ¶
Podcast Language Codes. en: "English", af: "Afrikaans", sq: "Albanian", an: "Aragonese", ar: "Arabic", hy: "Armenian", as: "Assamese", az: "Azerbaijani", eu: "Basque", be: "Belarusian", bn: "Bengali", bs: "Bosnian", br: "Breton", bg: "Bulgarian", my: "Burmese", ca: "Catalan", ch: "Chamorro", ce: "Chechen", zh: "Chinese", cv: "Chuvash", co: "Corsican", cr: "Cree", hr: "Croatian", cs: "Czech", da: "Danish", nl: "Dutch", eo: "Esperanto", et: "Estonian", fo: "Faeroese", fj: "Fijian", fi: "Finnish", fr: "French", fy: "Frisian", gd: "Gaelic", gl: "Galacian", ka: "Georgian", de: "German", el: "Greek", gu: "Gujurati", ht: "Haitian", he: "Hebrew", hi: "Hindi", hu: "Hungarian", is: "Icelandic", id: "Indonesian", iu: "Inuktitut", ga: "Irish", it: "Italian", ja: "Japanese", kn: "Kannada", ks: "Kashmiri", kk: "Kazakh", km: "Khmer", ky: "Kirghiz", ko: "Korean", la: "Latin", lv: "Latvian", lt: "Lithuanian", lb: "Luxembourgish", mk: "FYRO Macedonian", ms: "Malay", ml: "Malayalam", mt: "Maltese", mi: "Maori", mr: "Marathi", mo: "Moldavian", nv: "Navajo", ng: "Ndonga", ne: "Nepali", no: "Norwegian", oc: "Occitan", or: "Oriya", om: "Oromo", fa: "Persian", pl: "Polish", pt: "Portuguese", pa: "Punjabi", qu: "Quechua", rm: "Rhaeto-Romanic", ro: "Romanian", ru: "Russian", sz: "Sami (Lappish)", sg: "Sango", sa: "Sanskrit", sc: "Sardinian", sd: "Sindhi", si: "Singhalese", sr: "Serbian", sk: "Slovak", sl: "Slovenian", so: "Somani", sb: "Sorbian", es: "Spanish", sx: "Sutu", sw: "Swahili", sv: "Swedish", ta: "Tamil", tt: "Tatar", te: "Teluga", th: "Thai", ts: "Tsonga", tn: "Tswana", tr: "Turkish", tk: "Turkmen", uk: "Ukrainian", ur: "Urdu", ve: "Venda", vi: "Vietnamese", vo: "Volapuk", wa: "Walloon", cy: "Welsh", xh: "Xhosa", ji: "Yiddish", zu: "Zulu",
func (*Podcast) AddLastBuildDate ¶
func (*Podcast) AddNewFeedURL ¶
func (*Podcast) AddParentalAdvisory ¶
func (*Podcast) AddPubDate ¶
func (*Podcast) AddSubTitle ¶
AddSubTitle adds the iTunes subtitle that is displayed with the title in iTunes.
Note that this field should be just a few words long according to Apple. This method will truncate the string to 64 chars if too long with "..."
func (*Podcast) AddSummary ¶
AddSummary adds the iTunes summary.
Limit: 4000 characters
Note that this field is a CDATA encoded field which allows for rich text such as html links: `<a href="http://www.apple.com">Apple</a>`.
Example ¶
if len(p.Items) != 1 { fmt.Println("expected 1 item in the collection") } pp := p.Items[0] fmt.Println( pp.GUID, pp.Title, pp.Link, pp.Description, pp.AuthorFormatted, pp.Category, pp.Comments, pp.Source, *pp.Enclosure, pp.IAuthor, pp.IDuration, pp.IExplicit, pp.IIsClosedCaptioned, pp.IOrder, pp.ISubtitle, pp.ISummary) // Output: // http://example.com/1.mp3 Episode 1 http://example.com/1.mp3 Description for Episode 1 {{ } http://example.com/1.mp3 183 183 audio/mpeg audio/mpeg} the name A simple episode 1 &{{ } See more at <a href="http://example.com">Here</a>} }
package main import ( "fmt" podcast "github.com/georgboe/rss-feed-generator" ) func main() { p := podcast.New("title", "link", podcast.Description{Text: "Description"}, nil, nil) // add a summary p.AddSummary(`A very cool podcast with a long summary! See more at our website: <a href="http://example.com">example.com</a> `) if p.ISummary != nil { fmt.Println(p.ISummary.Text) } }
Output: A very cool podcast with a long summary! See more at our website: <a href="http://example.com">example.com</a>
type PodcastWrapper ¶
type PodcastWrapper struct { XMLName xml.Name `xml:"rss"` Version string `xml:"version,attr"` ATOMNS string `xml:"xmlns:atom,attr,omitempty"` ITUNESNS string `xml:"xmlns:itunes,attr"` GOOGLEPLAYNS string `xml:"xmlns:googleplay,attr"` SPOTIFYNS string `xml:"xmlns:spotify,attr"` CONTENT string `xml:"xmlns:content,attr"` Channel *Podcast }
func NewWrapper ¶
func NewWrapper(p *Podcast) PodcastWrapper