|
|
@ -3,6 +3,7 @@ package io.legado.app.model.rss |
|
|
|
import io.legado.app.data.entities.RssArticle |
|
|
|
import io.legado.app.data.entities.RssArticle |
|
|
|
import io.legado.app.data.entities.RssSource |
|
|
|
import io.legado.app.data.entities.RssSource |
|
|
|
import io.legado.app.help.coroutine.Coroutine |
|
|
|
import io.legado.app.help.coroutine.Coroutine |
|
|
|
|
|
|
|
import io.legado.app.model.Debug |
|
|
|
import io.legado.app.model.analyzeRule.AnalyzeRule |
|
|
|
import io.legado.app.model.analyzeRule.AnalyzeRule |
|
|
|
import io.legado.app.model.analyzeRule.AnalyzeUrl |
|
|
|
import io.legado.app.model.analyzeRule.AnalyzeUrl |
|
|
|
import io.legado.app.model.analyzeRule.RuleData |
|
|
|
import io.legado.app.model.analyzeRule.RuleData |
|
|
@ -38,7 +39,7 @@ object Rss { |
|
|
|
scope: CoroutineScope, |
|
|
|
scope: CoroutineScope, |
|
|
|
rssArticle: RssArticle, |
|
|
|
rssArticle: RssArticle, |
|
|
|
ruleContent: String, |
|
|
|
ruleContent: String, |
|
|
|
rssSource: RssSource?, |
|
|
|
rssSource: RssSource, |
|
|
|
context: CoroutineContext = Dispatchers.IO |
|
|
|
context: CoroutineContext = Dispatchers.IO |
|
|
|
): Coroutine<String> { |
|
|
|
): Coroutine<String> { |
|
|
|
return Coroutine.async(scope, context) { |
|
|
|
return Coroutine.async(scope, context) { |
|
|
@ -46,9 +47,11 @@ object Rss { |
|
|
|
rssArticle.link, |
|
|
|
rssArticle.link, |
|
|
|
baseUrl = rssArticle.origin, |
|
|
|
baseUrl = rssArticle.origin, |
|
|
|
ruleData = rssArticle, |
|
|
|
ruleData = rssArticle, |
|
|
|
headerMapF = rssSource?.getHeaderMap() |
|
|
|
headerMapF = rssSource.getHeaderMap() |
|
|
|
) |
|
|
|
) |
|
|
|
val body = analyzeUrl.getStrResponse(rssArticle.origin).body |
|
|
|
val body = analyzeUrl.getStrResponse(rssArticle.origin).body |
|
|
|
|
|
|
|
Debug.log(rssSource.sourceUrl, "≡获取成功:${rssSource.sourceUrl}") |
|
|
|
|
|
|
|
Debug.log(rssSource.sourceUrl, body, state = 20) |
|
|
|
val analyzeRule = AnalyzeRule(rssArticle) |
|
|
|
val analyzeRule = AnalyzeRule(rssArticle) |
|
|
|
analyzeRule.setContent(body) |
|
|
|
analyzeRule.setContent(body) |
|
|
|
.setBaseUrl(NetworkUtils.getAbsoluteURL(rssArticle.origin, rssArticle.link)) |
|
|
|
.setBaseUrl(NetworkUtils.getAbsoluteURL(rssArticle.origin, rssArticle.link)) |
|
|
|