parent
41f326eb54
commit
8121c2063e
@ -5,7 +5,7 @@ ext {
|
|||||||
extName = 'The Property of Hate'
|
extName = 'The Property of Hate'
|
||||||
pkgNameSuffix = 'en.thepropertyofhate'
|
pkgNameSuffix = 'en.thepropertyofhate'
|
||||||
extClass = '.ThePropertyOfHate'
|
extClass = '.ThePropertyOfHate'
|
||||||
extVersionCode = 3
|
extVersionCode = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$rootDir/common.gradle"
|
apply from: "$rootDir/common.gradle"
|
||||||
|
@ -12,25 +12,21 @@ import okhttp3.Request
|
|||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
import rx.Observable
|
import rx.Observable
|
||||||
|
|
||||||
/**
|
/** @author Aria Moradi <aria.moradi007@gmail.com> */
|
||||||
* @author Aria Moradi <aria.moradi007@gmail.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
class ThePropertyOfHate : HttpSource() {
|
class ThePropertyOfHate : HttpSource() {
|
||||||
|
|
||||||
override val name = "The Property of Hate"
|
override val name = "The Property of Hate"
|
||||||
|
|
||||||
override val baseUrl = "http://jolleycomics.com"
|
override val baseUrl = "https://jolleycomics.com"
|
||||||
|
|
||||||
val firstChapterUrl = "/TPoH/The Hook/"
|
|
||||||
|
|
||||||
override val lang = "en"
|
override val lang = "en"
|
||||||
|
|
||||||
override val supportsLatest: Boolean = false
|
override val supportsLatest = false
|
||||||
|
|
||||||
|
private val firstChapterUrl = "/TPoH/The Hook/"
|
||||||
|
|
||||||
// the one and only manga entry
|
// the one and only manga entry
|
||||||
fun manga(): SManga {
|
private val manga: SManga
|
||||||
return SManga.create().apply {
|
get() = SManga.create().apply {
|
||||||
title = "The Property of Hate"
|
title = "The Property of Hate"
|
||||||
thumbnail_url = "https://pbs.twimg.com/media/DOBCcMiWkAA8Hvu.jpg"
|
thumbnail_url = "https://pbs.twimg.com/media/DOBCcMiWkAA8Hvu.jpg"
|
||||||
artist = "Sarah Jolley"
|
artist = "Sarah Jolley"
|
||||||
@ -38,78 +34,70 @@ class ThePropertyOfHate : HttpSource() {
|
|||||||
status = SManga.UNKNOWN
|
status = SManga.UNKNOWN
|
||||||
url = baseUrl
|
url = baseUrl
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
override fun fetchPopularManga(page: Int): Observable<MangasPage> {
|
override fun fetchPopularManga(page: Int) =
|
||||||
return Observable.just(MangasPage(listOf(manga()), false))
|
Observable.just(MangasPage(listOf(manga), false))!!
|
||||||
}
|
|
||||||
|
|
||||||
override fun popularMangaRequest(page: Int): Request = throw Exception("Not used")
|
// write the data again to avoid bugs in backup restore
|
||||||
|
override fun fetchMangaDetails(manga: SManga): Observable<SManga> =
|
||||||
|
Observable.just(this.manga.also { it.initialized = true })!!
|
||||||
|
|
||||||
override fun popularMangaParse(response: Response): MangasPage = throw Exception("Not used")
|
// needed for the webview
|
||||||
|
override fun mangaDetailsRequest(manga: SManga) = GET(baseUrl, headers)
|
||||||
|
|
||||||
// latest Updates not used
|
// no real base url for this comic so must read the first chapter's link
|
||||||
|
override fun chapterListRequest(manga: SManga) =
|
||||||
override fun latestUpdatesParse(response: Response): MangasPage = throw Exception("Not used")
|
GET(baseUrl + firstChapterUrl, headers)
|
||||||
|
|
||||||
override fun latestUpdatesRequest(page: Int): Request = throw Exception("Not used")
|
|
||||||
|
|
||||||
// the manga is one and only, but still write the data again to avoid bugs in backup restore
|
|
||||||
override fun fetchMangaDetails(manga: SManga): Observable<SManga> {
|
|
||||||
return Observable.just(manga())
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun mangaDetailsParse(response: Response): SManga = throw Exception("Not used")
|
|
||||||
|
|
||||||
// chapter list
|
|
||||||
|
|
||||||
override fun chapterListRequest(manga: SManga): Request {
|
|
||||||
return GET(baseUrl + firstChapterUrl, headers) // no real base url for this comic so must read the first chapter's link
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun chapterListParse(response: Response): List<SChapter> {
|
override fun chapterListParse(response: Response): List<SChapter> {
|
||||||
val document = response.asJsoup()
|
val document = response.asJsoup()
|
||||||
|
|
||||||
val chapters = mutableListOf<SChapter>(
|
val chapters = mutableListOf(
|
||||||
SChapter.create().apply() { // must hard code the first one
|
// must hard code the first one
|
||||||
|
SChapter.create().apply {
|
||||||
url = firstChapterUrl
|
url = firstChapterUrl
|
||||||
|
chapter_number = 1f
|
||||||
name = "The Hook"
|
name = "The Hook"
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
document.select("select > option").forEach { option ->
|
document.select("select > option:not(:first-child)")
|
||||||
if (!option.text().startsWith("-")) // ignore "jump to entry" option
|
.mapIndexed { num, opt ->
|
||||||
chapters.add(
|
SChapter.create().apply {
|
||||||
SChapter.create().apply {
|
setUrlWithoutDomain(opt.attr("value"))
|
||||||
url = option.attr("value")
|
chapter_number = num + 2f
|
||||||
name = option.text()
|
name = opt.text()
|
||||||
}
|
}
|
||||||
)
|
}.let(chapters::addAll)
|
||||||
}
|
|
||||||
|
|
||||||
return chapters.reversed()
|
return chapters.reversed()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun pageListParse(response: Response): List<Page> {
|
override fun pageListParse(response: Response) =
|
||||||
val document = response.asJsoup()
|
response.asJsoup().select("select > optgroup > option")
|
||||||
|
.mapIndexed { num, opt -> Page(num, opt.absUrl("value")) }
|
||||||
|
|
||||||
// parse the options for this chapter to get page links
|
override fun imageUrlParse(response: Response) =
|
||||||
val pages = document.select("select > optgroup > option").mapIndexed { pageNum, option ->
|
response.asJsoup().selectFirst(".comic_comic > img").absUrl("src")!!
|
||||||
Page(pageNum, baseUrl + option.attr("value"))
|
|
||||||
}
|
|
||||||
|
|
||||||
return pages
|
override fun popularMangaRequest(page: Int): Request =
|
||||||
}
|
throw UnsupportedOperationException("Not used")
|
||||||
|
|
||||||
override fun imageUrlParse(response: Response): String {
|
override fun popularMangaParse(response: Response): MangasPage =
|
||||||
val document = response.asJsoup()
|
throw UnsupportedOperationException("Not used")
|
||||||
|
|
||||||
return baseUrl + document.select(".comic_comic > img").first().attr("src")
|
override fun latestUpdatesParse(response: Response): MangasPage =
|
||||||
}
|
throw UnsupportedOperationException("Not used")
|
||||||
|
|
||||||
override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> = throw Exception("Search functionality is not available.")
|
override fun latestUpdatesRequest(page: Int): Request =
|
||||||
|
throw UnsupportedOperationException("Not used")
|
||||||
|
|
||||||
override fun searchMangaParse(response: Response): MangasPage = throw Exception("Not used")
|
override fun mangaDetailsParse(response: Response): SManga =
|
||||||
|
throw UnsupportedOperationException("Not used")
|
||||||
|
|
||||||
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request = throw Exception("Not used")
|
override fun searchMangaParse(response: Response): MangasPage =
|
||||||
|
throw UnsupportedOperationException("Not used")
|
||||||
|
|
||||||
|
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request =
|
||||||
|
throw UnsupportedOperationException("Search functionality is not available.")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user