Fallback to RSS item content when article fetching fails
This commit is contained in:
parent
eaa463f2c0
commit
0ebaca4a83
|
@ -93,8 +93,16 @@ defmodule Frenzy.UpdateFeeds do
|
|||
|
||||
url = get_real_url(entry)
|
||||
|
||||
content =
|
||||
case get_article_content(url) do
|
||||
{:ok, content} ->
|
||||
content
|
||||
|
||||
{:err, reason} ->
|
||||
Logger.warn("Unable to fetch article for #{url}: #{reason}")
|
||||
entry.content || entry.summary
|
||||
end
|
||||
|
||||
changeset =
|
||||
Ecto.build_assoc(feed, :items, %{
|
||||
guid: entry.id,
|
||||
|
@ -106,10 +114,6 @@ defmodule Frenzy.UpdateFeeds do
|
|||
})
|
||||
|
||||
Repo.insert(changeset)
|
||||
|
||||
{:err, reason} ->
|
||||
Logger.error("Unable to create item for #{url}: #{reason}")
|
||||
end
|
||||
end
|
||||
|
||||
defp parse_date(str) do
|
||||
|
|
Loading…
Reference in New Issue