pull/35/head^2
kunfei 5 years ago
parent fa1c8ce18e
commit a6d2165887
  1. 10
      app/src/main/java/io/legado/app/model/rss/RssParserByRule.kt

@ -23,10 +23,9 @@ object RssParserByRule {
) )
} }
rssSource.ruleArticles?.let { ruleArticles ->
val analyzeRule = AnalyzeRule() val analyzeRule = AnalyzeRule()
analyzeRule.setContent(xml) analyzeRule.setContent(xml)
rssSource.ruleArticles?.let { ruleArticles ->
val collections = analyzeRule.getElements(ruleArticles) val collections = analyzeRule.getElements(ruleArticles)
val ruleGuid = analyzeRule.splitSourceRule(rssSource.ruleGuid ?: "") val ruleGuid = analyzeRule.splitSourceRule(rssSource.ruleGuid ?: "")
val ruleTitle = analyzeRule.splitSourceRule(rssSource.ruleTitle ?: "") val ruleTitle = analyzeRule.splitSourceRule(rssSource.ruleTitle ?: "")
@ -51,7 +50,9 @@ object RssParserByRule {
ruleImage, ruleImage,
ruleContent, ruleContent,
ruleLink ruleLink
) )?.let {
articleList.add(it)
}
} }
} ?: let { } ?: let {
return RssParser.parseXML(xml, rssSource.sourceUrl) return RssParser.parseXML(xml, rssSource.sourceUrl)
@ -84,6 +85,9 @@ object RssParserByRule {
rssArticle.image = analyzeRule.getString(ruleImage) rssArticle.image = analyzeRule.getString(ruleImage)
rssArticle.content = analyzeRule.getString(ruleContent) rssArticle.content = analyzeRule.getString(ruleContent)
rssArticle.link = analyzeRule.getString(ruleLink) rssArticle.link = analyzeRule.getString(ruleLink)
if (rssArticle.title.isNullOrBlank()) {
return null
}
return rssArticle return rssArticle
} }
} }
Loading…
Cancel
Save