diff --git a/app/src/main/java/io/legado/app/model/Rss.kt b/app/src/main/java/io/legado/app/model/Rss.kt index d9f3da930..d962696eb 100644 --- a/app/src/main/java/io/legado/app/model/Rss.kt +++ b/app/src/main/java/io/legado/app/model/Rss.kt @@ -17,8 +17,13 @@ object Rss { context: CoroutineContext = Dispatchers.IO ): Coroutine> { return Coroutine.async(scope, context) { - val response = AnalyzeUrl(rssSource.sourceUrl).getResponseAwait() - RssParserByRule.parseXML(response, rssSource) + val analyzeUrl = AnalyzeUrl(rssSource.sourceUrl) + val body = if (analyzeUrl.useWebView()) { + analyzeUrl.getResultByWebView(rssSource.sourceUrl) + } else { + analyzeUrl.getResponseAwait().body() + } + RssParserByRule.parseXML(body, rssSource) } } } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/model/rss/RssParserByRule.kt b/app/src/main/java/io/legado/app/model/rss/RssParserByRule.kt index d5fea37fd..bdc7013b8 100644 --- a/app/src/main/java/io/legado/app/model/rss/RssParserByRule.kt +++ b/app/src/main/java/io/legado/app/model/rss/RssParserByRule.kt @@ -5,15 +5,12 @@ import io.legado.app.R import io.legado.app.data.entities.RssArticle import io.legado.app.data.entities.RssSource import io.legado.app.model.analyzeRule.AnalyzeRule -import retrofit2.Response object RssParserByRule { @Throws(Exception::class) - fun parseXML(response: Response, rssSource: RssSource): MutableList { - - val xml = response.body() - if (xml.isNullOrBlank()) { + fun parseXML(body: String?, rssSource: RssSource): MutableList { + if (body.isNullOrBlank()) { throw Exception( App.INSTANCE.getString( R.string.error_get_web_content, @@ -23,11 +20,11 @@ object RssParserByRule { } var ruleArticles = rssSource.ruleArticles if (ruleArticles.isNullOrBlank()) { - return RssParser.parseXML(xml, rssSource.sourceUrl) + return RssParser.parseXML(body, rssSource.sourceUrl) } else { val articleList = mutableListOf() val analyzeRule = AnalyzeRule() - analyzeRule.setContent(xml, rssSource.sourceUrl) + analyzeRule.setContent(body, rssSource.sourceUrl) var reverse = true if (ruleArticles.startsWith("-")) { reverse = false