Feederer (github) (docs) can fetch more than 17 Major singles titles from your RSS / Atom feeds.
Feederer is an Elixir wrapper for feedparser.
It parses XML syndication feeds such as RSS 0.90, Netscape RSS 0.91, Userland RSS 0.91, RSS 0.92, RSS 0.93, RSS 0.94, RSS 1.0, RSS 2.0, Atom 0.3, Atom 1.0 and CDF feeds from a URL (optionally by being respectful of both your bandwidth and the feed host's by using HTTP ETag and Last-Modified headers), a local file or a string.
Requirements: Python 2.6+ or Python 3+, *sh. (In other words, it should work on anything except Microsoft Windows provided you have a somewhat up-to-date Python version installed. If you'd like to support Microsoft Windows it's certainly doable, /priv/install.sh is a good starting point.)
Important notice: This package depends on an unpackaged version of erlport,
therefore mix
will not install it automatically.
It means you will have to manually add the following to your own mix.exs
:
{:erlport, git: "https://github.com/hdima/erlport.git", ref: "246b7722d62b87b48be66d9a871509a537728962"}
- Add
{:feederer, "~> 0.5.9"}
to yourmix.exs
dependencies. - Add
:feederer
to yourapplications
inmix.exs
:[applications: […, :feederer]]
- Install
erlport==0.6
andfeedparser==5.2.1
usingpip
oreasy_install
. Your Elixir application will need access to these so make sure they are either installed globally or add their location to your application PATH. - Make sure
python
will be available to the application as well. - Read the Configuration section below to customize the python env, path and command.
- Add
{:feederer, "~> 0.5.9"}
to yourmix.exs
dependencies. - Add
:feederer
to yourapplications
inmix.exs
:[applications: […, :feederer]]
- Run
mix feedparser.install
to install the python feedparser dependencies. - Configuration is not necessary at this point, Feederer comes with sensible defaults. Take a look at Configuration below anyway.
Configuration is optional, everything has default values.
- Configuration should go your application
config/
directory. erlport
keyword list: anything allowed bypython.start/1
. It's the right place to tell erlport about your python path, env, name.poolboy
keyword list: anything allowed as second argument (poolArgs
) topoolboy.child_spec/3
exceptname
andworker_module
(these two will be ignored and set to default values).supervisor_strategy
keyword: Supervisor strategy for Feederer worker pool.
Sample configuration:
# In your config/config.exs file
config :feederer,
erlport: [
python_path: to_char_list("/python/dependencies/folder/"),
compressed: 6,
python: 'python'
],
poolboy: [
size: 10,
max_overflow: 0
],
supervisor_strategy: :one_for_one
url = "http://www.rssboard.org/files/sample-rss-2.xml"
{:ok, parsed} = Feederer.parse(url)
feed_link = parsed[:feed][:link] # "http://liftoff.msfc.nasa.gov/"
file = File.read! @rss_file
{:ok, parsed} = Feederer.parse(file)
feed_title = parsed[:feed][:title] # the feed title
Use a keyword list as Feederer.parse
second argument. Allowed arguments are:
etag
, modified
, agent
, referrer
, request_headers
,
response_headers
.
See feedparser documentation for more information about these arguments.
{:ok, parsed} = Feederer.parse(file, etag: foo, request_headers: bar)
More usage examples: See /test/feederer_test.exs