Fixed cursor and increased timeout

This commit is contained in:
contusionglory 2022-12-24 10:42:59 +00:00 committed by GitHub
parent 041f8aa7a2
commit 2759e9c0bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -34,11 +34,14 @@ class SkillShareProvider : MainAPI() { // all providers must be an instance of M
private suspend fun queryMovieApi(payload: String): String {
val req = payload.toRequestBody(RequestBodyTypes.JSON.toMediaTypeOrNull())
return app.post(apiUrl, requestBody = req, referer = "$mainUrl/").text
return app.post(apiUrl, requestBody = req, referer = "$mainUrl/", timeout = 30).text
}
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse {
val sortAttribute = request.data
if (page == 1)
cursor[sortAttribute] = ""
val payload =
"""{ "query": "query GetClassesByType(${'$'}filter: ClassFilters!, ${'$'}pageSize: Int, ${'$'}cursor: String, ${'$'}type: ClassListType!, ${'$'}sortAttribute: ClassListByTypeSortAttribute) { classListByType(type: ${'$'}type, where: ${'$'}filter, first: ${'$'}pageSize, after: ${'$'}cursor, sortAttribute: ${'$'}sortAttribute) { nodes { id title url sku smallCoverUrl largeCoverUrl } } }", "variables": { "type": "TRENDING_CLASSES", "filter": { "subCategory": "", "classLength": [] }, "pageSize": 30, "cursor": "${cursor[sortAttribute]}", "sortAttribute": "$sortAttribute" }, "operationName": "GetClassesByType" }"""
val responseBody = queryMovieApi(payload)