ProductPromotion
Logo

Elixir

made by https://0x3d.site

GitHub - michaelnisi/feeder: Parse RSS and Atom feeds
Parse RSS and Atom feeds. Contribute to michaelnisi/feeder development by creating an account on GitHub.
Visit Site

GitHub - michaelnisi/feeder: Parse RSS and Atom feeds

GitHub - michaelnisi/feeder: Parse RSS and Atom feeds

Build Status

feeder - parse RSS and Atom

The feeder Erlang library parses RSS and Atom formatted XML feeds. It is a stream based parser that sends its events through a callback interface.

Usage

Parse a file and accumulate parser events:

-module(acc).
-export([file/1]).

event({entry, Entry}, {Feed, Entries}) ->
  {Feed, [Entry|Entries]};
event({feed, Feed}, {[], Entries}) ->
  {Feed, Entries};
event(endFeed, {Feed, Entries}) ->
  {Feed, lists:reverse(Entries)}.

opts() ->
  [{event_state, {[],[]}}, {event_fun, fun event/2}].

file(Filename) ->
  {ok, EventState, _Rest} = feeder:file(Filename, opts()),
  EventState.

Example

To try HTTP streaming do:

cd example
make
erl -pa ebin deps/*/ebin
fedex:start().
fedex:fetch("http://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml").

Types

feed()

The channel or feed tuple.

enclosure()

The enclosure tuple for an item or entry.

entry()

An item or entry tuple.

option()

Options to setup the parser.

{continuation_fun, ContinuationFun} ContinuationFun is a call back function to decide what to do if the parser runs into EOF before the document is complete.

{continuation_state, term()} State that is accessible in the continuation call back function.

{event_fun, EventFun} EventFun is the call back function for parser events.

{event_state, term()} State that is accessible in the event call back function.

event()

The events that are sent to the user via the callback.

{feed, Feed}
  • Feed = feed()

Receive notification when the meta information of the feed or channel has been parsed.

{entry, Entry}
  • Entry = entry()

Receive notification for each entry or article in the feed.

endFeed

Receive notification of the end of a document. feeder will send this event only once, and it will be the last event during the parse.

Exports

Parsing feeds

feeder:file(Filename, Opts) -> Result
  • Filename = string()
  • Opts = [option()]
  • Result = {ok, EventState, Rest}
  • Rest = unicode_binary() | latin1_binary()
  • EventState = term()
feeder:stream(Xml, Opts) -> Result
  • Xml = unicode_binary() | latin1_binary() | [unicode_char()]
  • Opts = [option()]
  • Result = {ok, EventState, Rest}
  • Rest = unicode_binary() | latin1_binary()
  • EventState = term()

Accessing values

feeder_feeds:get(Key, Feed) -> Value
  • Key = author | id | image | language | link | subtitle | summary | title | updated | url
  • Feed = feed()
  • Value = binary() | undefined
feeder_enclosures:get(Key, Enclosure) -> Value
  • Key = url | length | type
  • Enclosure = enclosure()
  • Value = binary() | undefined
feeder_entries:get(Key, Entry) -> Value
  • Key = author | categories | duration | enclosure | id | image | link | subtitle | summary | title | updated
  • Entry = entry()
  • Value = binary() | enclosure() | undefined

Tests

$ make tests

Install

You can install feeder with Rebar3, of course, and there are hex and erlang.mk packages.

License

MIT License

Articles
to learn more about the elixir concepts.

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here 🔥.

FAQ's
to know more about the topic.

mail [email protected] to add your project or resources here 🔥.

Queries
or most google FAQ's about Elixir.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory