Merge pull request #441 from icewind1991/more-eng-filter
Add genre filter support for the remaining English sources
Cette révision appartient à :
révision
8ffff44454
3 fichiers modifiés avec 135 ajouts et 6 suppressions
|
@ -1,6 +1,7 @@
|
|||
package eu.kanade.tachiyomi.data.source.online.english
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import eu.kanade.tachiyomi.data.database.models.Chapter
|
||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||
import eu.kanade.tachiyomi.data.source.EN
|
||||
|
@ -34,8 +35,7 @@ class Mangahere(context: Context, override val id: Int) : ParsedOnlineSource(con
|
|||
|
||||
override fun popularMangaNextPageSelector() = "div.next-page > a.next"
|
||||
|
||||
override fun searchMangaInitialUrl(query: String, filters: List<Filter>) =
|
||||
"$baseUrl/search.php?name=$query&page=1&sort=views&order=za"
|
||||
override fun searchMangaInitialUrl(query: String, filters: List<Filter>) = "$baseUrl/search.php?name=$query&page=1&sort=views&order=za&${filters.map { it.id + "=1" }.joinToString("&")}&advopts=1"
|
||||
|
||||
override fun searchMangaSelector() = "div.result_search > dl:has(dt)"
|
||||
|
||||
|
@ -110,4 +110,40 @@ class Mangahere(context: Context, override val id: Int) : ParsedOnlineSource(con
|
|||
|
||||
override fun imageUrlParse(document: Document) = document.getElementById("image").attr("src")
|
||||
|
||||
// [...document.querySelectorAll("select[id^='genres'")].map((el,i) => `Filter("${el.getAttribute('name')}", "${el.nextSibling.nextSibling.textContent.trim()}")`).join(',\n')
|
||||
// http://www.mangahere.co/advsearch.htm
|
||||
override fun getFilterList(): List<Filter> = listOf(
|
||||
Filter("genres[Action]", "Action"),
|
||||
Filter("genres[Adventure]", "Adventure"),
|
||||
Filter("genres[Comedy]", "Comedy"),
|
||||
Filter("genres[Doujinshi]", "Doujinshi"),
|
||||
Filter("genres[Drama]", "Drama"),
|
||||
Filter("genres[Ecchi]", "Ecchi"),
|
||||
Filter("genres[Fantasy]", "Fantasy"),
|
||||
Filter("genres[Gender Bender]", "Gender Bender"),
|
||||
Filter("genres[Harem]", "Harem"),
|
||||
Filter("genres[Historical]", "Historical"),
|
||||
Filter("genres[Horror]", "Horror"),
|
||||
Filter("genres[Josei]", "Josei"),
|
||||
Filter("genres[Martial Arts]", "Martial Arts"),
|
||||
Filter("genres[Mature]", "Mature"),
|
||||
Filter("genres[Mecha]", "Mecha"),
|
||||
Filter("genres[Mystery]", "Mystery"),
|
||||
Filter("genres[One Shot]", "One Shot"),
|
||||
Filter("genres[Psychological]", "Psychological"),
|
||||
Filter("genres[Romance]", "Romance"),
|
||||
Filter("genres[School Life]", "School Life"),
|
||||
Filter("genres[Sci-fi]", "Sci-fi"),
|
||||
Filter("genres[Seinen]", "Seinen"),
|
||||
Filter("genres[Shoujo]", "Shoujo"),
|
||||
Filter("genres[Shoujo Ai]", "Shoujo Ai"),
|
||||
Filter("genres[Shounen]", "Shounen"),
|
||||
Filter("genres[Shounen Ai]", "Shounen Ai"),
|
||||
Filter("genres[Slice of Life]", "Slice of Life"),
|
||||
Filter("genres[Sports]", "Sports"),
|
||||
Filter("genres[Supernatural]", "Supernatural"),
|
||||
Filter("genres[Tragedy]", "Tragedy"),
|
||||
Filter("genres[Yaoi]", "Yaoi"),
|
||||
Filter("genres[Yuri]", "Yuri")
|
||||
)
|
||||
}
|
|
@ -48,7 +48,7 @@ class Mangasee(context: Context, override val id: Int) : ParsedOnlineSource(cont
|
|||
override fun popularMangaNextPageSelector() = "ul.pagination > li > a:contains(Next)"
|
||||
|
||||
override fun searchMangaInitialUrl(query: String, filters: List<Filter>) =
|
||||
"$baseUrl/advanced-search/result.php?sortBy=alphabet&direction=ASC&textOnly=no&resPerPage=20&page=1&seriesName=$query"
|
||||
"$baseUrl/advanced-search/result.php?sortBy=alphabet&direction=ASC&textOnly=no&resPerPage=20&page=1&seriesName=$query&${filters.map { it.id + "=Yes" }.joinToString("&")}"
|
||||
|
||||
override fun searchMangaSelector() = "div.row > div > div > div > h1"
|
||||
|
||||
|
@ -122,4 +122,44 @@ class Mangasee(context: Context, override val id: Int) : ParsedOnlineSource(cont
|
|||
|
||||
override fun imageUrlParse(document: Document) = document.select("div > a > img").attr("src")
|
||||
|
||||
// [...document.querySelectorAll("label.triStateCheckBox input")].map(el => `Filter("${el.getAttribute('name')}", "${el.nextSibling.textContent.trim()}")`).join(',\n')
|
||||
// http://mangasee.co/advanced-search/
|
||||
override fun getFilterList(): List<Filter> = listOf(
|
||||
Filter("Action", "Action"),
|
||||
Filter("Adult", "Adult"),
|
||||
Filter("Adventure", "Adventure"),
|
||||
Filter("Comedy", "Comedy"),
|
||||
Filter("Doujinshi", "Doujinshi"),
|
||||
Filter("Drama", "Drama"),
|
||||
Filter("Ecchi", "Ecchi"),
|
||||
Filter("Fantasy", "Fantasy"),
|
||||
Filter("Gender_Bender", "Gender Bender"),
|
||||
Filter("Harem", "Harem"),
|
||||
Filter("Hentai", "Hentai"),
|
||||
Filter("Historical", "Historical"),
|
||||
Filter("Horror", "Horror"),
|
||||
Filter("Josei", "Josei"),
|
||||
Filter("Lolicon", "Lolicon"),
|
||||
Filter("Martial_Arts", "Martial Arts"),
|
||||
Filter("Mature", "Mature"),
|
||||
Filter("Mecha", "Mecha"),
|
||||
Filter("Mystery", "Mystery"),
|
||||
Filter("Psychological", "Psychological"),
|
||||
Filter("Romance", "Romance"),
|
||||
Filter("School_Life", "School Life"),
|
||||
Filter("Sci-fi", "Sci-fi"),
|
||||
Filter("Seinen", "Seinen"),
|
||||
Filter("Shotacon", "Shotacon"),
|
||||
Filter("Shoujo", "Shoujo"),
|
||||
Filter("Shoujo_Ai", "Shoujo Ai"),
|
||||
Filter("Shounen", "Shounen"),
|
||||
Filter("Shounen_Ai", "Shounen Ai"),
|
||||
Filter("Slice_of_Life", "Slice of Life"),
|
||||
Filter("Smut", "Smut"),
|
||||
Filter("Sports", "Sports"),
|
||||
Filter("Supernatural", "Supernatural"),
|
||||
Filter("Tragedy", "Tragedy"),
|
||||
Filter("Yaoi", "Yaoi"),
|
||||
Filter("Yuri", "Yuri")
|
||||
)
|
||||
}
|
|
@ -11,6 +11,7 @@ import eu.kanade.tachiyomi.data.source.model.MangasPage
|
|||
import eu.kanade.tachiyomi.data.source.model.Page
|
||||
import eu.kanade.tachiyomi.data.source.online.OnlineSource
|
||||
import eu.kanade.tachiyomi.data.source.online.ParsedOnlineSource
|
||||
import okhttp3.Headers
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import org.jsoup.nodes.Document
|
||||
|
@ -27,6 +28,14 @@ class Readmangatoday(context: Context, override val id: Int) : ParsedOnlineSourc
|
|||
|
||||
override val client: OkHttpClient get() = network.cloudflareClient
|
||||
|
||||
/**
|
||||
* Search only returns data with this set
|
||||
*/
|
||||
override fun headersBuilder() = Headers.Builder().apply {
|
||||
add("User-Agent", "Mozilla/5.0 (Windows NT 6.3; WOW64)")
|
||||
add("X-Requested-With", "XMLHttpRequest")
|
||||
}
|
||||
|
||||
override fun popularMangaInitialUrl() = "$baseUrl/hot-manga/"
|
||||
|
||||
override fun popularMangaSelector() = "div.hot-manga > div.style-list > div.box"
|
||||
|
@ -41,7 +50,7 @@ class Readmangatoday(context: Context, override val id: Int) : ParsedOnlineSourc
|
|||
override fun popularMangaNextPageSelector() = "div.hot-manga > ul.pagination > li > a:contains(»)"
|
||||
|
||||
override fun searchMangaInitialUrl(query: String, filters: List<Filter>) =
|
||||
"$baseUrl/search"
|
||||
"$baseUrl/service/advanced_search"
|
||||
|
||||
|
||||
override fun searchMangaRequest(page: MangasPage, query: String, filters: List<OnlineSource.Filter>): Request {
|
||||
|
@ -50,12 +59,17 @@ class Readmangatoday(context: Context, override val id: Int) : ParsedOnlineSourc
|
|||
}
|
||||
|
||||
val builder = okhttp3.FormBody.Builder()
|
||||
builder.add("query", query)
|
||||
builder.add("manga-name", query)
|
||||
builder.add("type", "all")
|
||||
builder.add("status", "both")
|
||||
for (filter in filters) {
|
||||
builder.add("include[]", filter.id)
|
||||
}
|
||||
|
||||
return POST(page.url, headers, builder.build())
|
||||
}
|
||||
|
||||
override fun searchMangaSelector() = "div.content-list > div.style-list > div.box"
|
||||
override fun searchMangaSelector() = "div.style-list > div.box"
|
||||
|
||||
override fun searchMangaFromElement(element: Element, manga: Manga) {
|
||||
element.select("div.title > h2 > a").first().let {
|
||||
|
@ -129,4 +143,43 @@ class Readmangatoday(context: Context, override val id: Int) : ParsedOnlineSourc
|
|||
|
||||
override fun imageUrlParse(document: Document) = document.select("img.img-responsive-2").first().attr("src")
|
||||
|
||||
// [...document.querySelectorAll("ul.manga-cat span")].map(el => `Filter("${el.getAttribute('data-id')}", "${el.nextSibling.textContent.trim()}")`).join(',\n')
|
||||
// http://www.readmanga.today/advanced-search
|
||||
override fun getFilterList(): List<Filter> = listOf(
|
||||
Filter("2", "Action"),
|
||||
Filter("4", "Adventure"),
|
||||
Filter("5", "Comedy"),
|
||||
Filter("6", "Doujinshi"),
|
||||
Filter("7", "Drama"),
|
||||
Filter("8", "Ecchi"),
|
||||
Filter("9", "Fantasy"),
|
||||
Filter("10", "Gender Bender"),
|
||||
Filter("11", "Harem"),
|
||||
Filter("12", "Historical"),
|
||||
Filter("13", "Horror"),
|
||||
Filter("14", "Josei"),
|
||||
Filter("15", "Lolicon"),
|
||||
Filter("16", "Martial Arts"),
|
||||
Filter("17", "Mature"),
|
||||
Filter("18", "Mecha"),
|
||||
Filter("19", "Mystery"),
|
||||
Filter("20", "One shot"),
|
||||
Filter("21", "Psychological"),
|
||||
Filter("22", "Romance"),
|
||||
Filter("23", "School Life"),
|
||||
Filter("24", "Sci-fi"),
|
||||
Filter("25", "Seinen"),
|
||||
Filter("26", "Shotacon"),
|
||||
Filter("27", "Shoujo"),
|
||||
Filter("28", "Shoujo Ai"),
|
||||
Filter("29", "Shounen"),
|
||||
Filter("30", "Shounen Ai"),
|
||||
Filter("31", "Slice of Life"),
|
||||
Filter("32", "Smut"),
|
||||
Filter("33", "Sports"),
|
||||
Filter("34", "Supernatural"),
|
||||
Filter("35", "Tragedy"),
|
||||
Filter("36", "Yaoi"),
|
||||
Filter("37", "Yuri")
|
||||
)
|
||||
}
|
Référencer dans un nouveau ticket