Merge pull request #526 from Gilfar/mangasee-seasonal

Update for seasonal manga from Mangasee
This commit is contained in:
inorichi 2016-11-14 20:49:07 +01:00 committed by GitHub
commit 979a5c8c16

View file

@ -30,6 +30,8 @@ class Mangasee(override val id: Int) : ParsedOnlineSource() {
private val recentUpdatesPattern = Pattern.compile("(.*?)\\s(\\d+)") private val recentUpdatesPattern = Pattern.compile("(.*?)\\s(\\d+)")
private val indexPattern = Pattern.compile("-index-(.*?)-")
override fun popularMangaInitialUrl() = "$baseUrl/search/request.php?sortBy=popularity&sortOrder=descending" override fun popularMangaInitialUrl() = "$baseUrl/search/request.php?sortBy=popularity&sortOrder=descending"
override fun popularMangaSelector() = "div.requested > div.row" override fun popularMangaSelector() = "div.requested > div.row"
@ -141,13 +143,21 @@ class Mangasee(override val id: Int) : ParsedOnlineSource() {
override fun pageListParse(response: Response, pages: MutableList<Page>) { override fun pageListParse(response: Response, pages: MutableList<Page>) {
val document = response.asJsoup() val document = response.asJsoup()
val url = response.request().url().toString().substringBeforeLast('/') val fullUrl = response.request().url().toString()
val url = fullUrl.substringBeforeLast('/')
val series = document.select("input.IndexName").first().attr("value") val series = document.select("input.IndexName").first().attr("value")
val chapter = document.select("span.CurChapter").first().text() val chapter = document.select("span.CurChapter").first().text()
var index = ""
val m = indexPattern.matcher(fullUrl)
if (m.find()) {
val indexNumber = m.group(1)
index = "-index-$indexNumber"
}
document.select("div.ContainerNav").first().select("select.PageSelect > option").forEach { document.select("div.ContainerNav").first().select("select.PageSelect > option").forEach {
pages.add(Page(pages.size, "$url/$series-chapter-$chapter-page-${pages.size + 1}.html")) pages.add(Page(pages.size, "$url/$series-chapter-$chapter$index-page-${pages.size + 1}.html"))
} }
pages.getOrNull(0)?.imageUrl = imageUrlParse(document) pages.getOrNull(0)?.imageUrl = imageUrlParse(document)
} }