pull/49/head
kunfei 5 years ago
parent 468daf86f4
commit 52153e825d
  1. 23
      app/src/main/java/io/legado/app/ui/rss/read/ReadRssViewModel.kt

@ -54,18 +54,21 @@ class ReadRssViewModel(application: Application) : BaseViewModel(application) {
private fun loadContent(rssArticle: RssArticle, ruleContent: String) {
execute {
AnalyzeUrl(rssArticle.link, baseUrl = rssArticle.origin).getResponseAwait().body()
?.let { body ->
AnalyzeRule().apply {
setContent(
body,
NetworkUtils.getAbsoluteURL(rssArticle.origin, rssArticle.link)
)
getString(ruleContent).let { content ->
contentLiveData.postValue(content)
}
val analyzeUrl = AnalyzeUrl(rssArticle.link, baseUrl = rssArticle.origin)
val content = if (analyzeUrl.useWebView) {
analyzeUrl.getResultByWebView(rssArticle.origin).content
} else analyzeUrl.getResponseAwait().body()
content?.let { body ->
AnalyzeRule().apply {
setContent(
body,
NetworkUtils.getAbsoluteURL(rssArticle.origin, rssArticle.link)
)
getString(ruleContent).let { content ->
contentLiveData.postValue(content)
}
}
}
}
}

Loading…
Cancel
Save