Parse content:encoded element in RSS1 items

This commit is contained in:
Shinokuni 2020-09-25 14:34:19 +02:00
parent de383d5e7d
commit a4d6139848
3 changed files with 5 additions and 2 deletions

View File

@ -1,6 +1,6 @@
<rdf:RDF xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/"
xmlns="http://purl.org/rss/1.0/">
xmlns="http://purl.org/rss/1.0/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel rdf:about="https://slashdot.org/">
<title>Slashdot</title>
@ -95,6 +95,7 @@
src="https://slashdot.org/slashdot-it.pl?op=discuss&amp;amp;id=17251868&amp;amp;smallembed=1"
style="height: 300px; width: 100%; border: none;"&gt;&lt;/iframe&gt;
</description>
<content:encoded>content:encoded</content:encoded>
<dc:creator>msmash</dc:creator>
<dc:date>2020-09-23T16:15:00+00:00</dc:date>
<dc:subject>programming</dc:subject>

View File

@ -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

View File

@ -29,6 +29,7 @@ class RSS1ItemsAdapter : XmlAdapter<List<Item>> {
"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<List<Item>> {
}
companion object {
val names = Names.of("title", "description", "date", "link", "creator")
val names = Names.of("title", "description", "date", "link", "creator", "encoded")
}
}