Compare commits
No commits in common. "b9be2879ed2a92217106c13208c0dfffd102af28" and "b443afcbf2c520ac2964d6281331534d4044ac3f" have entirely different histories.
b9be2879ed
...
b443afcbf2
|
@ -1,19 +0,0 @@
|
||||||
defmodule Frenzy.Pipeline.Extractor.Birchtree do
|
|
||||||
@moduledoc """
|
|
||||||
Extractor for https://birchtree.me
|
|
||||||
"""
|
|
||||||
|
|
||||||
alias Frenzy.Pipeline.Extractor
|
|
||||||
@behaviour Extractor
|
|
||||||
|
|
||||||
@impl Extractor
|
|
||||||
def extract(html_tree) do
|
|
||||||
case Floki.find(html_tree, "section.post-content") do
|
|
||||||
[content_elem | _] ->
|
|
||||||
{:ok, content_elem}
|
|
||||||
|
|
||||||
_ ->
|
|
||||||
{:error, "no matching elements"}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -158,16 +158,6 @@ defmodule Frenzy.Pipeline.ScrapeStage do
|
||||||
attr
|
attr
|
||||||
end)
|
end)
|
||||||
|
|
||||||
has_src = Enum.find(new_attrs, fn {name, _} -> name == "src" end)
|
|
||||||
|
|
||||||
# remove srcsets because our transformation only applies to the src attribute, so that should always be used
|
|
||||||
new_attrs =
|
|
||||||
if has_src do
|
|
||||||
Enum.reject(new_attrs, fn {name, _} -> name == "srcset" end)
|
|
||||||
else
|
|
||||||
new_attrs
|
|
||||||
end
|
|
||||||
|
|
||||||
{"img", new_attrs}
|
{"img", new_attrs}
|
||||||
|
|
||||||
elem ->
|
elem ->
|
||||||
|
@ -201,5 +191,5 @@ defmodule Frenzy.Pipeline.ScrapeStage do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defp image_to_data_uri(src, site_uri, false), do: to_string(URI.merge(site_uri, src))
|
defp image_to_data_uri(src, _site_uri, false), do: src
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,7 +6,6 @@ defmodule FrenzyWeb.ConfigureStage.ScrapeStageLive do
|
||||||
{"512 Pixels", Frenzy.Pipeline.Extractor.FiveTwelvePixels},
|
{"512 Pixels", Frenzy.Pipeline.Extractor.FiveTwelvePixels},
|
||||||
{"Ars Technica", Frenzy.Pipeline.Extractor.ArsTechnica},
|
{"Ars Technica", Frenzy.Pipeline.Extractor.ArsTechnica},
|
||||||
{"beckyhansmeyer.com", Frenzy.Pipeline.Extractor.BeckyHansmeyer},
|
{"beckyhansmeyer.com", Frenzy.Pipeline.Extractor.BeckyHansmeyer},
|
||||||
{"birchtree.me", Frenzy.Pipeline.Extractor.Birchtree},
|
|
||||||
{"daringfireball.net", Frenzy.Pipeline.Extractor.DaringFireball},
|
{"daringfireball.net", Frenzy.Pipeline.Extractor.DaringFireball},
|
||||||
{"ericasadun.com", Frenzy.Pipeline.Extractor.EricaSadun},
|
{"ericasadun.com", Frenzy.Pipeline.Extractor.EricaSadun},
|
||||||
{"finertech.com", Frenzy.Pipeline.Extractor.FinerTech},
|
{"finertech.com", Frenzy.Pipeline.Extractor.FinerTech},
|
||||||
|
|
Loading…
Reference in New Issue