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) { private fun loadContent(rssArticle: RssArticle, ruleContent: String) {
execute { execute {
AnalyzeUrl(rssArticle.link, baseUrl = rssArticle.origin).getResponseAwait().body() val analyzeUrl = AnalyzeUrl(rssArticle.link, baseUrl = rssArticle.origin)
?.let { body -> val content = if (analyzeUrl.useWebView) {
AnalyzeRule().apply { analyzeUrl.getResultByWebView(rssArticle.origin).content
setContent( } else analyzeUrl.getResponseAwait().body()
body, content?.let { body ->
NetworkUtils.getAbsoluteURL(rssArticle.origin, rssArticle.link) AnalyzeRule().apply {
) setContent(
getString(ruleContent).let { content -> body,
contentLiveData.postValue(content) NetworkUtils.getAbsoluteURL(rssArticle.origin, rssArticle.link)
} )
getString(ruleContent).let { content ->
contentLiveData.postValue(content)
} }
} }
}
} }
} }

Loading…
Cancel
Save