Madara - add Manga Byte (#2955)

This commit is contained in:
Mike 2020-05-01 04:55:30 -04:00 committed by GitHub
parent a73d8fbd8a
commit 312fdaa7e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 3 deletions

View File

@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: Madara (multiple sources)'
pkgNameSuffix = "all.madara"
extClass = '.MadaraFactory'
extVersionCode = 82
extVersionCode = 83
libVersion = '1.2'
}

View File

@ -355,7 +355,7 @@ abstract class Madara(
}
}
private fun getXhrChapters(mangaId: String): Document {
protected fun getXhrChapters(mangaId: String): Document {
val xhrHeaders = headersBuilder().add("Content-Type: application/x-www-form-urlencoded; charset=UTF-8").build()
val body = RequestBody.create(null, "action=manga_get_chapters&manga=$mangaId")
return client.newCall(POST("$baseUrl/wp-admin/admin-ajax.php", xhrHeaders, body)).execute().asJsoup()

View File

@ -112,7 +112,8 @@ class MadaraFactory : SourceFactory {
MangaRockTeam(),
MixedManga(),
ManhuasWorld(),
ArazNovel()
ArazNovel(),
MangaByte()
)
}
@ -597,4 +598,19 @@ class ManhuasWorld : Madara("Manhuas World", "https://manhuasworld.com", "en")
class ArazNovel : Madara("ArazNovel", "https://www.araznovel.com", "tr", SimpleDateFormat("dd/MM/yyyy", Locale.getDefault())) {
override fun formBuilder(page: Int, popular: Boolean): FormBody.Builder = super.formBuilder(page, popular)
.add("vars[meta_query][0][0][value]", "manga")
override fun chapterListParse(response: Response): List<SChapter> {
return getXhrChapters(response.asJsoup().select("div#manga-chapters-holder").attr("data-id")).let { document ->
document.select("li.parent").let { elements ->
if (!elements.isNullOrEmpty()) {
elements.reversed()
.map { volumeElement -> volumeElement.select(chapterListSelector()).map { chapterFromElement(it) } }
.flatten()
} else {
document.select(chapterListSelector()).map { chapterFromElement(it) }
}
}
}
}
}
class MangaByte : Madara("Manga Byte", "https://mangabyte.com", "en")