frenzy/lib/frenzy/pipeline/extractor/om_malik.ex

25 lines
556 B
Elixir

defmodule Frenzy.Pipeline.Extractor.OmMalik do
@moduledoc """
Extractor for https://om.co
"""
alias Frenzy.Pipeline.Extractor
@behaviour Extractor
@impl Extractor
def extract(html_tree) do
case Floki.find(html_tree, ".entry-content") do
[content_elem | _] ->
{
:ok,
# remove related posts list
Floki.filter_out(content_elem, ".rpbt_shortcode, .newsletter-content")
}
_ ->
{:error, "no matching elements"}
end
|> Extractor.Util.strip_wp_lazy_loading()
end
end