pull/49/head
kunfei 5 years ago
parent e5055dca50
commit 4cd47d8cc1
  1. 15
      app/src/main/java/io/legado/app/model/rss/RssParser.kt
  2. 4
      app/src/main/java/io/legado/app/model/rss/RssParserByRule.kt

@ -2,6 +2,7 @@ package io.legado.app.model.rss
import io.legado.app.constant.RSSKeywords
import io.legado.app.data.entities.RssArticle
import io.legado.app.model.Debug
import org.xmlpull.v1.XmlPullParser
import org.xmlpull.v1.XmlPullParserException
import org.xmlpull.v1.XmlPullParserFactory
@ -98,6 +99,20 @@ object RssParser {
articleList.reverse()
for ((index: Int, item: RssArticle) in articleList.withIndex()) {
item.order = System.currentTimeMillis() + index
if (index == 0) {
Debug.log(sourceUrl, "┌获取标题")
Debug.log(sourceUrl, "${item.title}")
Debug.log(sourceUrl, "┌获取时间")
Debug.log(sourceUrl, "${item.pubDate}")
Debug.log(sourceUrl, "┌获取类别")
Debug.log(sourceUrl, "${item.categories}")
Debug.log(sourceUrl, "┌获取描述")
Debug.log(sourceUrl, "${item.description}")
Debug.log(sourceUrl, "┌获取图片url")
Debug.log(sourceUrl, "${item.image}")
Debug.log(sourceUrl, "┌获取文章链接")
Debug.log(sourceUrl, "${item.link}")
}
}
return articleList
}

@ -24,7 +24,7 @@ object RssParserByRule {
var ruleArticles = rssSource.ruleArticles
if (ruleArticles.isNullOrBlank()) {
Debug.log(sourceUrl, "列表规则为空, 使用默认规则解析")
return RssParser.parseXML(body, rssSource.sourceUrl)
return RssParser.parseXML(body, sourceUrl)
} else {
val articleList = mutableListOf<RssArticle>()
val analyzeRule = AnalyzeRule()
@ -85,7 +85,9 @@ object RssParserByRule {
Debug.log(sourceUrl, "┌获取类别", log)
rssArticle.categories = analyzeRule.getString(ruleCategories)
Debug.log(sourceUrl, "${rssArticle.categories}", log)
Debug.log(sourceUrl, "┌获取描述", log)
rssArticle.description = analyzeRule.getString(ruleDescription)
Debug.log(sourceUrl, "${rssArticle.description}", log)
Debug.log(sourceUrl, "┌获取图片url", log)
rssArticle.image = analyzeRule.getString(ruleImage, true)
Debug.log(sourceUrl, "${rssArticle.image}", log)

Loading…
Cancel
Save