Add extractor for ericasadun.com
This commit is contained in:
parent
6f568a03e1
commit
d476839fce
|
@ -0,0 +1,27 @@
|
||||||
|
defmodule Frenzy.Pipeline.Extractor.EricaSadun do
|
||||||
|
@moduledoc """
|
||||||
|
Extractor for https://ericasadun.com
|
||||||
|
"""
|
||||||
|
|
||||||
|
alias Frenzy.Pipeline.Extractor
|
||||||
|
@behaviour Extractor
|
||||||
|
|
||||||
|
@impl Extractor
|
||||||
|
def extract(body) do
|
||||||
|
html_tree = Floki.parse(body)
|
||||||
|
|
||||||
|
case Floki.find(html_tree, ".post-content") do
|
||||||
|
[content_elem | _] ->
|
||||||
|
# content element includes social media buttons and related posts
|
||||||
|
content =
|
||||||
|
content_elem
|
||||||
|
|> Floki.filter_out("div.sharedaddy, div#jp-relatedposts")
|
||||||
|
|> Floki.raw_html()
|
||||||
|
|
||||||
|
{:ok, content}
|
||||||
|
|
||||||
|
_ ->
|
||||||
|
{:error, "no matching elements"}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue