From a4d6139848302434a90496238310656eebe8be91 Mon Sep 17 00:00:00 2001 From: Shinokuni Date: Fri, 25 Sep 2020 14:34:19 +0200 Subject: [PATCH] Parse content:encoded element in RSS1 items --- api/src/androidTest/assets/localfeed/rss1/rss1_feed.xml | 3 ++- .../com/readrops/api/localfeed/rss1/RSS1ItemsAdapterTest.kt | 1 + .../java/com/readrops/api/localfeed/rss1/RSS1ItemsAdapter.kt | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/api/src/androidTest/assets/localfeed/rss1/rss1_feed.xml b/api/src/androidTest/assets/localfeed/rss1/rss1_feed.xml index 2dae7a51..3c60e50e 100644 --- a/api/src/androidTest/assets/localfeed/rss1/rss1_feed.xml +++ b/api/src/androidTest/assets/localfeed/rss1/rss1_feed.xml @@ -1,6 +1,6 @@ + xmlns="http://purl.org/rss/1.0/" xmlns:content="http://purl.org/rss/1.0/modules/content/"> Slashdot @@ -95,6 +95,7 @@ src="https://slashdot.org/slashdot-it.pl?op=discuss&amp;id=17251868&amp;smallembed=1" style="height: 300px; width: 100%; border: none;"></iframe> + content:encoded msmash 2020-09-23T16:15:00+00:00 programming diff --git a/api/src/androidTest/java/com/readrops/api/localfeed/rss1/RSS1ItemsAdapterTest.kt b/api/src/androidTest/java/com/readrops/api/localfeed/rss1/RSS1ItemsAdapterTest.kt index 178220da..c5dcb452 100644 --- a/api/src/androidTest/java/com/readrops/api/localfeed/rss1/RSS1ItemsAdapterTest.kt +++ b/api/src/androidTest/java/com/readrops/api/localfeed/rss1/RSS1ItemsAdapterTest.kt @@ -34,6 +34,7 @@ class RSS1ItemsAdapterTest { assertEquals(item.pubDate, DateUtils.stringToLocalDateTime("2020-09-23T16:15:00+00:00")) assertEquals(item.author, "msmash") assertNotNull(item.description) + assertEquals(item.content, "content:encoded") } @Test diff --git a/api/src/main/java/com/readrops/api/localfeed/rss1/RSS1ItemsAdapter.kt b/api/src/main/java/com/readrops/api/localfeed/rss1/RSS1ItemsAdapter.kt index 9b040cfb..d5134784 100644 --- a/api/src/main/java/com/readrops/api/localfeed/rss1/RSS1ItemsAdapter.kt +++ b/api/src/main/java/com/readrops/api/localfeed/rss1/RSS1ItemsAdapter.kt @@ -29,6 +29,7 @@ class RSS1ItemsAdapter : XmlAdapter> { "dc:date" -> pubDate = DateUtils.stringToLocalDateTime(nonNullText()) "dc:creator" -> authors += nullableText() "description" -> description = nullableTextRecursively() + "content:encoded" -> content = nullableTextRecursively() else -> skipContents() } } @@ -60,6 +61,6 @@ class RSS1ItemsAdapter : XmlAdapter> { } companion object { - val names = Names.of("title", "description", "date", "link", "creator") + val names = Names.of("title", "description", "date", "link", "creator", "encoded") } } \ No newline at end of file