pull/32/head
parent
245d168598
commit
3052c467b9
@ -1,23 +1,45 @@ |
|||||||
package io.legado.app.model.webbook |
package io.legado.app.model.webbook |
||||||
|
|
||||||
|
import io.legado.app.App |
||||||
|
import io.legado.app.R |
||||||
import io.legado.app.data.entities.Book |
import io.legado.app.data.entities.Book |
||||||
import io.legado.app.data.entities.BookChapter |
import io.legado.app.data.entities.BookChapter |
||||||
import io.legado.app.data.entities.BookSource |
import io.legado.app.data.entities.BookSource |
||||||
|
import io.legado.app.data.entities.rule.ContentRule |
||||||
import io.legado.app.model.analyzeRule.AnalyzeUrl |
import io.legado.app.model.analyzeRule.AnalyzeUrl |
||||||
|
import io.legado.app.utils.NetworkUtils |
||||||
|
import kotlinx.coroutines.CoroutineScope |
||||||
import retrofit2.Response |
import retrofit2.Response |
||||||
|
|
||||||
object BookContent { |
object BookContent { |
||||||
|
|
||||||
fun analyzeContent( |
@Throws(Exception::class) |
||||||
|
suspend fun analyzeContent( |
||||||
|
coroutineScope: CoroutineScope, |
||||||
response: Response<String>, |
response: Response<String>, |
||||||
book: Book, |
book: Book, |
||||||
bookChapter: BookChapter, |
bookChapter: BookChapter, |
||||||
bookSource: BookSource, |
bookSource: BookSource, |
||||||
analyzeUrl: AnalyzeUrl |
analyzeUrl: AnalyzeUrl |
||||||
): String { |
): String { |
||||||
|
val baseUrl: String = NetworkUtils.getUrl(response) |
||||||
|
val body: String? = response.body() |
||||||
|
body ?: throw Exception( |
||||||
|
App.INSTANCE.getString( |
||||||
|
R.string.get_web_content_error, |
||||||
|
baseUrl |
||||||
|
) |
||||||
|
) |
||||||
|
val contentRule = bookSource.getContentRule() |
||||||
|
|
||||||
return "" |
return "" |
||||||
} |
} |
||||||
|
|
||||||
|
fun analyzeContent( |
||||||
|
body: String, |
||||||
|
contentRule: ContentRule |
||||||
|
): ContentData<String> { |
||||||
|
|
||||||
|
return ContentData("", "") |
||||||
|
} |
||||||
} |
} |
@ -0,0 +1,6 @@ |
|||||||
|
package io.legado.app.model.webbook |
||||||
|
|
||||||
|
data class ContentData<T>( |
||||||
|
var content: String, |
||||||
|
var nextUrl: T |
||||||
|
) |
Loading…
Reference in new issue