All Projects â†’ Betree â†’ atomex

Betree / atomex

Licence: MIT license
🌊 Elixir RSS/ATOM feed builder with a focus on standards compliance, security and extensibility

Programming Languages

elixir
2628 projects

Labels

Projects that are alternatives of or similar to atomex

Feedparser
feedparser gem - (universal) web feed parser and normalizer (XML w/ Atom or RSS, JSON Feed, HTML w/ Microformats e.g. h-entry/h-feed or Feed.HTML, Feed.TXT w/ YAML, JSON or INI & Markdown, etc.)
Stars: ✭ 156 (+310.53%)
Mutual labels:  atom, rss
Pluto
pluto gems - planet feed reader and (static) website generator - auto-build web pages from published web feeds
Stars: ✭ 174 (+357.89%)
Mutual labels:  atom, rss
Leed
Leed (contraction de Light Feed) est un agrégateur RSS libre et minimaliste qui permet la consultation de flux RSS de manière rapide et non intrusive.
Stars: ✭ 160 (+321.05%)
Mutual labels:  atom, rss
Rss Atom Bundle
RSS and Atom Bundle for Symfony
Stars: ✭ 123 (+223.68%)
Mutual labels:  atom, rss
Gorss
Go Terminal Feed Reader
Stars: ✭ 191 (+402.63%)
Mutual labels:  atom, rss
Gofeed
Parse RSS, Atom and JSON feeds in Go
Stars: ✭ 1,762 (+4536.84%)
Mutual labels:  atom, rss
Node Feedsub
Subscribes to RSS/Atom/JSON feeds and notifies on new items.
Stars: ✭ 170 (+347.37%)
Mutual labels:  atom, rss
Discord feedbot
Moved to https://gitlab.com/ffreiheit/discord_feedbot
Stars: ✭ 67 (+76.32%)
Mutual labels:  atom, rss
Brief
RSS reader extension for Firefox
Stars: ✭ 184 (+384.21%)
Mutual labels:  atom, rss
Feed Module
Everyone deserves RSS, ATOM and JSON feeds!
Stars: ✭ 182 (+378.95%)
Mutual labels:  atom, rss
Feedbag
Ruby's favorite feed auto-discovery library/tool
Stars: ✭ 115 (+202.63%)
Mutual labels:  atom, rss
V2
Minimalist and opinionated feed reader
Stars: ✭ 3,239 (+8423.68%)
Mutual labels:  atom, rss
Simplepie
A simple Atom/RSS parsing library for PHP.
Stars: ✭ 1,389 (+3555.26%)
Mutual labels:  atom, rss
Feedme.js
RSS/Atom/JSON feed parser
Stars: ✭ 132 (+247.37%)
Mutual labels:  atom, rss
Feedparser
Parse feeds in Python
Stars: ✭ 1,200 (+3057.89%)
Mutual labels:  atom, rss
Posidonlauncher
a one-page homescreen with a news feed
Stars: ✭ 163 (+328.95%)
Mutual labels:  atom, rss
Feeds2imap.clj
Pull RSS/Atom feeds to your IMAP folders with Clojure on JVM.
Stars: ✭ 31 (-18.42%)
Mutual labels:  atom, rss
Atoma
Atom, RSS and JSON feed parser for Python 3
Stars: ✭ 67 (+76.32%)
Mutual labels:  atom, rss
Feedreader
C# RSS and ATOM Feed reader library. Supports RSS 0.91, 0.92, 1.0, 2.0 and ATOM. Tested with multiple languages and feeds.
Stars: ✭ 180 (+373.68%)
Mutual labels:  atom, rss
Feed Io
A PHP library to read and write feeds in JSONFeed, RSS or Atom format
Stars: ✭ 200 (+426.32%)
Mutual labels:  atom, rss

Atomex

Coverage Status Build Status

Atomex is an ATOM 1.0 feed builder with a focus on RFC4287 compliance, security and extensibility. It is safe to use it with user content: everything is escaped by default. Built on top of xml_builder.

API reference is available here: https://hexdocs.pm/atomex/api-reference.html

TODO

  • Feed required params (id, title, updated)
  • Feed recommended params (author, link)
  • Feed optional params
    • category
    • contributor
    • generator
    • icon
    • logo
    • rights
    • subtitle
  • Entry required params (id, title, updated)
  • Entry recommended params (author, content, link, summary)
  • Entry optional params
    • category
    • contributor
    • published
    • rights
    • source
  • Validator

Installation

def deps do
  [
    {:atomex, "0.3.0"}
  ]
end

Basic usage

Required field are always passed in new functions. There are however recommended fields that you should not ignore. See Validating your feed below.

alias Atomex.{Feed, Entry}

def build_feed(comments) do
  Feed.new("https://example.com", DateTime.utc_now, "My incredible feed")
  |> Feed.author("John Doe", email: "[email protected]")
  |> Feed.link("https://example.com/feed", rel: "self")
  |> Feed.entries(Enum.map(comments, &get_entry/1))
  |> Feed.build()
  |> Atomex.generate_document()
end

defp get_entry(_comment = %{id, text, inserted_at, user}) do
  Entry.new("https://example.com/comments/#{id}", inserted_at, "New comment by #{user.name}")
  |> Entry.author(user.name, uri: "https://example.com/users/#{user.id}")
  |> Entry.content("<h1>Content here will be properly escaped! Text: #{text}</h1>", type: "html")
  |> Entry.build()
end

To avoid escaping, you can pass a tuple as value like this (be careful though, a user may break it with malicious content):

Entry.content(entry, {:cdata, "<h1>Amazing</h1>"}, type: "html")
# Render as => <content type="html"><![CDATA[<h1>Amazing</h1>]]></content>

Extending the default API

  • You can specify custom schemas
Feed.build(feed, %{"xmlns:georss" => "http://www.georss.org/georss"})
# <?xml version="1.0" encoding="UTF-8"?>
# <rss version="2.0" xmlns="http://www.w3.org/2005/Atom" xmlns:georss="http://www.georss.org/georss">
#...
  • And custom fields
Feed.new(...)
|> Feed.add_field(:custom_field, %{attribute: 42}, "Foobar")
|> Feed.build()
|> Atomex.generate_document()
# ...
# <custom_field attribute="42">Foobar</custom_field>

For more complicated use cases, content can also be given a xml element directly. Use XmlBuilder to achieve that.

Validating your feed

Use this tool from W3C

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].