RSS
RSS
Mix.install([
:kino,
{:req, github: "wojtekmach/req"},
{:easyxml, github: "wojtekmach/easyxml"}
])
defmodule RSS do
def new(url) do
doc = Req.get!(url).body |> EasyXML.parse!()
title = doc["/feed/title"]
entries = doc |> EasyXML.xpath("/feed/entry") |> Enum.take(10)
Kino.Markdown.new("""
## #{title}
#{for entry <- entries, do: "* [#{entry["title"]}](#{entry["link/@href"]})\n"}
""")
end
end
RSS.new("https://dashbit.co/feed")