Patchfriday various updates and fixes (#6805)
* Update PatchFriday.kt * Update build.gradle
This commit is contained in:
parent
1cbd654453
commit
f8ad86da6c
|
@ -5,7 +5,7 @@ ext {
|
||||||
extName = 'Patch Friday'
|
extName = 'Patch Friday'
|
||||||
pkgNameSuffix = 'en.patchfriday'
|
pkgNameSuffix = 'en.patchfriday'
|
||||||
extClass = '.PatchFriday'
|
extClass = '.PatchFriday'
|
||||||
extVersionCode = 1
|
extVersionCode = 2
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package eu.kanade.tachiyomi.extension.en.patchfriday
|
package eu.kanade.tachiyomi.extension.en.patchfriday
|
||||||
|
|
||||||
import eu.kanade.tachiyomi.network.GET
|
import eu.kanade.tachiyomi.network.GET
|
||||||
|
import eu.kanade.tachiyomi.network.asObservableSuccess
|
||||||
import eu.kanade.tachiyomi.source.model.FilterList
|
import eu.kanade.tachiyomi.source.model.FilterList
|
||||||
import eu.kanade.tachiyomi.source.model.MangasPage
|
import eu.kanade.tachiyomi.source.model.MangasPage
|
||||||
import eu.kanade.tachiyomi.source.model.Page
|
import eu.kanade.tachiyomi.source.model.Page
|
||||||
|
@ -29,7 +30,10 @@ class PatchFriday : HttpSource() {
|
||||||
return SManga.create().apply {
|
return SManga.create().apply {
|
||||||
initialized = true
|
initialized = true
|
||||||
title = "Patch Friday"
|
title = "Patch Friday"
|
||||||
|
status = SManga.ONGOING
|
||||||
url = ""
|
url = ""
|
||||||
|
author = "Patch Friday"
|
||||||
|
artist = author
|
||||||
thumbnail_url = "https://patchfriday.com/patches/68.png"
|
thumbnail_url = "https://patchfriday.com/patches/68.png"
|
||||||
description = "The IT security webcomic"
|
description = "The IT security webcomic"
|
||||||
}
|
}
|
||||||
|
@ -69,23 +73,41 @@ class PatchFriday : HttpSource() {
|
||||||
|
|
||||||
// Chapters
|
// Chapters
|
||||||
|
|
||||||
override fun chapterListParse(response: Response): List<SChapter> {
|
override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> {
|
||||||
val last = response.asJsoup().select("ul.strip_toolbar li a[rel=next]").attr("href")
|
return client.newCall(GET("$baseUrl/search/?search=;", headers))
|
||||||
.removeSurrounding("/").toInt()
|
.asObservableSuccess()
|
||||||
|
.map { parseChapters(it) }
|
||||||
return listOf(1..last).flatten().reversed().map {
|
|
||||||
SChapter.create().apply {
|
|
||||||
name = "#$it - "
|
|
||||||
url = "/$it/"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun prepareNewChapter(chapter: SChapter, manga: SManga) {
|
private fun parseChapters (response: Response): List<SChapter>{
|
||||||
val cName = client.newCall(GET(baseUrl + chapter.url)).execute().asJsoup().select("div#strip_title").text()
|
val chapters = mutableListOf<SChapter>()
|
||||||
|
var document = response.asJsoup()
|
||||||
chapter.apply { name += cName }
|
var page = document.select("div > div:first-of-type > div:first-of-type > a").attr("abs:href").replace(baseUrl,"").replace("/","").trim().toInt()
|
||||||
|
while (page > 0) {
|
||||||
|
val element = document.select("div > div > div:first-of-type > a")
|
||||||
|
element.forEach {
|
||||||
|
val chapter = SChapter.create()
|
||||||
|
chapter.url = it.attr("abs:href").replace(baseUrl,"").trim()
|
||||||
|
chapter.chapter_number = chapter.url.replace("/", "").trim().toFloat()
|
||||||
|
chapter.name = "#${chapter.chapter_number.toInt()} - ${it.text()}"
|
||||||
|
chapter.date_upload = System.currentTimeMillis()
|
||||||
|
chapters.add(chapter)
|
||||||
}
|
}
|
||||||
|
page -= 10
|
||||||
|
document = client.newCall(GET("$baseUrl/search/?search=;id=$page", headers)).execute().asJsoup()
|
||||||
|
}
|
||||||
|
//Add First Chapter becouse for some reason it does not show up in chapter search
|
||||||
|
chapters.add(SChapter.create().apply {
|
||||||
|
url = "/1/"
|
||||||
|
chapter_number = url.replace("/", "").trim().toFloat()
|
||||||
|
name = "#${chapter_number.toInt()} - The One"
|
||||||
|
date_upload = System.currentTimeMillis()
|
||||||
|
})
|
||||||
|
return chapters
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun chapterListParse(response: Response): List<SChapter> = throw UnsupportedOperationException("Not used")
|
||||||
|
|
||||||
|
|
||||||
// Pages
|
// Pages
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue