Add chapter view count back to TaoSect. (#9432)
This commit is contained in:
parent
258da29ffc
commit
c60e0e7831
@ -6,7 +6,7 @@ ext {
|
||||
extName = 'Tao Sect'
|
||||
pkgNameSuffix = 'pt.taosect'
|
||||
extClass = '.TaoSect'
|
||||
extVersionCode = 12
|
||||
extVersionCode = 13
|
||||
isNsfw = true
|
||||
}
|
||||
|
||||
|
@ -319,7 +319,7 @@ class TaoSect : HttpSource() {
|
||||
val apiUrl = "$baseUrl/$API_BASE_PATH/capitulos/".toHttpUrl().newBuilder()
|
||||
.addPathSegment(projectSlug)
|
||||
.addPathSegment(chapterSlug)
|
||||
.addQueryParameter("_fields", "paginas")
|
||||
.addQueryParameter("_fields", "id_capitulo,paginas,post_id")
|
||||
.toString()
|
||||
|
||||
return GET(apiUrl, apiHeaders)
|
||||
@ -342,6 +342,10 @@ class TaoSect : HttpSource() {
|
||||
Page(i, chapterUrl, pageUrl)
|
||||
}
|
||||
|
||||
// Count the project and chapter views, requested by the scanlator.
|
||||
val countViewRequest = countProjectViewRequest(result.projectId!!, result.id)
|
||||
runCatching { client.newCall(countViewRequest).execute().close() }
|
||||
|
||||
// Check if the pages have exceeded the view limit of Google Drive.
|
||||
val firstPage = pages[0]
|
||||
|
||||
@ -373,11 +377,16 @@ class TaoSect : HttpSource() {
|
||||
return GET(page.imageUrl!!, newHeaders)
|
||||
}
|
||||
|
||||
private fun countProjectViewRequest(projectId: String): Request {
|
||||
val formBody = FormBody.Builder()
|
||||
private fun countProjectViewRequest(projectId: String, chapterId: String? = null): Request {
|
||||
val formBodyBuilder = FormBody.Builder()
|
||||
.add("action", "update_views_v2")
|
||||
.add("projeto", projectId)
|
||||
.build()
|
||||
|
||||
if (chapterId != null) {
|
||||
formBodyBuilder.add("capitulo", chapterId)
|
||||
}
|
||||
|
||||
val formBody = formBodyBuilder.build()
|
||||
|
||||
val newHeaders = headersBuilder()
|
||||
.add("Content-Length", formBody.contentLength().toString())
|
||||
|
Loading…
x
Reference in New Issue
Block a user