fix(all/googledrive): Fix nextPageToken (#2687)
This commit is contained in:
parent
845a62c557
commit
3e485f9b41
@ -8,7 +8,7 @@ ext {
|
|||||||
extName = 'Google Drive'
|
extName = 'Google Drive'
|
||||||
pkgNameSuffix = 'all.googledrive'
|
pkgNameSuffix = 'all.googledrive'
|
||||||
extClass = '.GoogleDrive'
|
extClass = '.GoogleDrive'
|
||||||
extVersionCode = 12
|
extVersionCode = 13
|
||||||
libVersion = '13'
|
libVersion = '13'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ class GoogleDrive : ConfigurableAnimeSource, AnimeHttpSource() {
|
|||||||
// Get cover
|
// Get cover
|
||||||
|
|
||||||
val coverResponse = client.newCall(
|
val coverResponse = client.newCall(
|
||||||
createPost(driveDocument, folderId, searchReqWithType(folderId, "cover", IMAGE_MIMETYPE)),
|
createPost(driveDocument, folderId, nextPageToken, searchReqWithType(folderId, "cover", IMAGE_MIMETYPE)),
|
||||||
).execute().parseAs<PostResponse> { JSON_REGEX.find(it)!!.groupValues[1] }
|
).execute().parseAs<PostResponse> { JSON_REGEX.find(it)!!.groupValues[1] }
|
||||||
|
|
||||||
coverResponse.items?.firstOrNull()?.let {
|
coverResponse.items?.firstOrNull()?.let {
|
||||||
@ -213,7 +213,7 @@ class GoogleDrive : ConfigurableAnimeSource, AnimeHttpSource() {
|
|||||||
// Get details
|
// Get details
|
||||||
|
|
||||||
val detailsResponse = client.newCall(
|
val detailsResponse = client.newCall(
|
||||||
createPost(driveDocument, folderId, searchReqWithType(folderId, "details.json", "")),
|
createPost(driveDocument, folderId, nextPageToken, searchReqWithType(folderId, "details.json", "")),
|
||||||
).execute().parseAs<PostResponse> { JSON_REGEX.find(it)!!.groupValues[1] }
|
).execute().parseAs<PostResponse> { JSON_REGEX.find(it)!!.groupValues[1] }
|
||||||
|
|
||||||
detailsResponse.items?.firstOrNull()?.let {
|
detailsResponse.items?.firstOrNull()?.let {
|
||||||
@ -302,7 +302,7 @@ class GoogleDrive : ConfigurableAnimeSource, AnimeHttpSource() {
|
|||||||
|
|
||||||
while (pageToken != null) {
|
while (pageToken != null) {
|
||||||
val response = client.newCall(
|
val response = client.newCall(
|
||||||
createPost(driveDocument, folderId),
|
createPost(driveDocument, folderId, pageToken),
|
||||||
).execute()
|
).execute()
|
||||||
|
|
||||||
val parsed = response.parseAs<PostResponse> {
|
val parsed = response.parseAs<PostResponse> {
|
||||||
@ -386,6 +386,7 @@ class GoogleDrive : ConfigurableAnimeSource, AnimeHttpSource() {
|
|||||||
private fun createPost(
|
private fun createPost(
|
||||||
document: Document,
|
document: Document,
|
||||||
folderId: String,
|
folderId: String,
|
||||||
|
pageToken: String?,
|
||||||
getMultiFormPath: (String, String, String) -> String = { folderIdStr, nextPageTokenStr, keyStr ->
|
getMultiFormPath: (String, String, String) -> String = { folderIdStr, nextPageTokenStr, keyStr ->
|
||||||
defaultGetRequest(folderIdStr, nextPageTokenStr, keyStr)
|
defaultGetRequest(folderIdStr, nextPageTokenStr, keyStr)
|
||||||
},
|
},
|
||||||
@ -404,7 +405,7 @@ class GoogleDrive : ConfigurableAnimeSource, AnimeHttpSource() {
|
|||||||
it.name == "SAPISID" || it.name == "__Secure-3PAPISID"
|
it.name == "SAPISID" || it.name == "__Secure-3PAPISID"
|
||||||
}?.value ?: ""
|
}?.value ?: ""
|
||||||
|
|
||||||
val requestUrl = getMultiFormPath(folderId, nextPageToken ?: "", key)
|
val requestUrl = getMultiFormPath(folderId, pageToken ?: "", key)
|
||||||
val body = """--$BOUNDARY
|
val body = """--$BOUNDARY
|
||||||
|content-type: application/http
|
|content-type: application/http
|
||||||
|content-transfer-encoding: binary
|
|content-transfer-encoding: binary
|
||||||
@ -455,11 +456,12 @@ class GoogleDrive : ConfigurableAnimeSource, AnimeHttpSource() {
|
|||||||
|
|
||||||
if (page == 1) nextPageToken = ""
|
if (page == 1) nextPageToken = ""
|
||||||
val post = if (genMultiFormReq == null) {
|
val post = if (genMultiFormReq == null) {
|
||||||
createPost(driveDocument, folderId)
|
createPost(driveDocument, folderId, nextPageToken)
|
||||||
} else {
|
} else {
|
||||||
createPost(
|
createPost(
|
||||||
driveDocument,
|
driveDocument,
|
||||||
folderId,
|
folderId,
|
||||||
|
nextPageToken,
|
||||||
genMultiFormReq,
|
genMultiFormReq,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user