diff --git a/lib/podcast_feed/provider/archive/parser.ex b/lib/podcast_feed/provider/archive/parser.ex
index 5b0e0aa..63069e3 100644
--- a/lib/podcast_feed/provider/archive/parser.ex
+++ b/lib/podcast_feed/provider/archive/parser.ex
@@ -43,12 +43,12 @@ defmodule PodcastFeed.Provider.Archive.Parser do
metadata_json |> Poison.decode!()
end
- def parse(identifier, %{"metadata" => metadata, "files" => files}, extra) do
+ def parse(identifier, metadata = %{"files" => files}, extra) do
extra = files
|> fetch_cover(identifier)
|> enrich_extra_metadata_with_cover(extra)
- %{podcast: podcast_data(metadata, extra), items: items_data(files, identifier)}
+ %{podcast: podcast_data(metadata, extra), items: items_data(metadata, identifier)}
end
# cover is nil
@@ -62,7 +62,7 @@ defmodule PodcastFeed.Provider.Archive.Parser do
# image is already set in the extra_metadata
defp enrich_extra_metadata_with_cover(_cover, extra), do: extra
- defp podcast_data(metadata, extra) do
+ defp podcast_data(%{"metadata" => metadata, "item_last_updated" => last_updated}, extra) do
%{
title: metadata["title"],
description: metadata["description"],
@@ -74,7 +74,7 @@ defmodule PodcastFeed.Provider.Archive.Parser do
},
keywords: metadata["subject"],
pubDate: metadata["publicdate"] |> NaiveDateTime.from_iso8601!() |> DateTime.from_naive!("Etc/UTC"),
- lastBuildDate: metadata["addeddate"] |> NaiveDateTime.from_iso8601!() |> DateTime.from_naive!("Etc/UTC"),
+ lastBuildDate: last_updated |> DateTime.from_unix!(:second),
author: metadata["creator"],
language: metadata["language"],
image: %{
@@ -88,7 +88,8 @@ defmodule PodcastFeed.Provider.Archive.Parser do
}
end
- defp items_data(files, identifier) do
+
+ defp items_data(%{"files" => files}, identifier) do
files
|> filter_audio_files()
|> Enum.map(fn f -> to_feed_item(f, identifier, files) end)
diff --git a/lib/podcast_feed_web/templates/feed/feed.xml.eex b/lib/podcast_feed_web/templates/feed/feed.xml.eex
index a111dd5..d11be5f 100644
--- a/lib/podcast_feed_web/templates/feed/feed.xml.eex
+++ b/lib/podcast_feed_web/templates/feed/feed.xml.eex
@@ -28,7 +28,7 @@
]]>
]]>
List.last() %>]]>
- <%= @podcast.pubDate |> Calendar.DateTime.Format.rfc2822 %>
+ <%= @podcast.lastBuildDate |> Calendar.DateTime.Format.rfc2822 %>
<%= for item <- @items do %>
-
]]>
@@ -47,4 +47,4 @@
<% end %>
-
\ No newline at end of file
+