Compare commits
No commits in common. "8c96a94cd3cb6d4fbc656ac7c17eccb34915265b" and "cfd9f7505a91f82dee8cbad730e5c0a87bd705c1" have entirely different histories.
8c96a94cd3
...
cfd9f7505a
|
@ -1,19 +0,0 @@
|
|||
defmodule Frenzy.Pipeline.Extractor.BeckyHansmeyer do
|
||||
@moduledoc """
|
||||
Extractor for https://beckyhansmeyer.com
|
||||
"""
|
||||
|
||||
alias Frenzy.Pipeline.Extractor
|
||||
@behaviour Extractor
|
||||
|
||||
@impl Extractor
|
||||
def extract(html_tree) do
|
||||
case Floki.find(html_tree, "div.entry-content") do
|
||||
[content_elem | _] ->
|
||||
{:ok, content_elem}
|
||||
|
||||
_ ->
|
||||
{:error, "no matching elements"}
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,39 +0,0 @@
|
|||
defmodule Frenzy.Pipeline.Extractor.FinerTech do
|
||||
@moduledoc """
|
||||
Extractor for https://finertech.com
|
||||
"""
|
||||
|
||||
alias Frenzy.Pipeline.Extractor
|
||||
@behaviour Extractor
|
||||
|
||||
@impl Extractor
|
||||
def extract(html_tree) do
|
||||
case Floki.find(html_tree, ".entry-content") do
|
||||
[content_elem | _] ->
|
||||
# remove patreon button
|
||||
content_elem = Floki.traverse_and_update(content_elem, &remove_patreon_banner/1)
|
||||
{:ok, content_elem}
|
||||
|
||||
_ ->
|
||||
{:error, "no matching element"}
|
||||
end
|
||||
end
|
||||
|
||||
@patreon_class_regex ~r/[a-z0-9_]patreon_button/i
|
||||
|
||||
defp remove_patreon_banner({"div", attrs, _children} = elem) do
|
||||
case Enum.find(attrs, fn {attr, _val} -> attr == "class" end) do
|
||||
nil ->
|
||||
elem
|
||||
|
||||
{"class", class} ->
|
||||
if Regex.match?(@patreon_class_regex, class) do
|
||||
nil
|
||||
else
|
||||
elem
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
defp remove_patreon_banner(elem), do: elem
|
||||
end
|
|
@ -1,19 +0,0 @@
|
|||
defmodule Frenzy.Pipeline.Extractor.FiveTwelvePixels do
|
||||
@moduledoc """
|
||||
Extractor for https://512pixels.net
|
||||
"""
|
||||
|
||||
alias Frenzy.Pipeline.Extractor
|
||||
@behaviour Extractor
|
||||
|
||||
@impl Extractor
|
||||
def extract(html_tree) do
|
||||
case Floki.find(html_tree, ".entry-content") do
|
||||
[content_elem | _] ->
|
||||
{:ok, content_elem}
|
||||
|
||||
_ ->
|
||||
{:error, "no matching elements"}
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,36 +0,0 @@
|
|||
defmodule Frenzy.Pipeline.Extractor.MacStories do
|
||||
@moduledoc """
|
||||
Extractor for https://macstories.net
|
||||
"""
|
||||
|
||||
alias Frenzy.Pipeline.Extractor
|
||||
@behaviour Extractor
|
||||
|
||||
@impl Extractor
|
||||
def extract(html_tree) do
|
||||
case Floki.find(html_tree, ".post-content") do
|
||||
[content_elem | _] ->
|
||||
content_elem =
|
||||
content_elem
|
||||
# some images have full size links, strip those out
|
||||
|> Floki.filter_out("a.view-full-size")
|
||||
# rewrite non-standard images captions to <figure>/<figcaption>
|
||||
|> Floki.map(&rewrite_element/1)
|
||||
|
||||
{:ok, content_elem}
|
||||
|
||||
_ ->
|
||||
{:error, "no matching elements"}
|
||||
end
|
||||
end
|
||||
|
||||
defp rewrite_element({"div", [{"class", "media-wrapper"}]}) do
|
||||
{"figure", []}
|
||||
end
|
||||
|
||||
defp rewrite_element({"p", [{"class", "image-caption"}]}) do
|
||||
{"figcaption", []}
|
||||
end
|
||||
|
||||
defp rewrite_element(elem), do: elem
|
||||
end
|
|
@ -1,5 +1,5 @@
|
|||
<h1>
|
||||
<a href="<%= @item.url %>" target="_blank" rel="noopener noreferrer"><%= @item.title || "(Untitled)" %></a>
|
||||
<a href="<%= @item.url %>" target="_blank" rel="noopener noreferrer"><%= @item.title %></a>
|
||||
</h1>
|
||||
|
||||
<%= if @item.read do %>
|
||||
|
|
Loading…
Reference in New Issue