[RU]Sources Fixes and addition (#6904)

* fix lost name for idsearch, add sort, fix url 404

* more openOut
This commit is contained in:
Eugene 2021-05-09 03:09:12 +05:00 committed by GitHub
parent b146544ab2
commit 4906ee12e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 118 additions and 13 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'AllHentai'
pkgNameSuffix = 'ru.allhentai'
extClass = '.AllHentai'
extVersionCode = 3
extVersionCode = 4
libVersion = '1.2'
containsNsfw = true
}

View File

@ -66,7 +66,7 @@ class AllHentai : ParsedHttpSource() {
override fun latestUpdatesNextPageSelector() = "a.nextLink"
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
val url = "$baseUrl/search/advanced".toHttpUrlOrNull()!!.newBuilder()
var url = "$baseUrl/search/advanced".toHttpUrlOrNull()!!.newBuilder()
(if (filters.isEmpty()) getFilterList() else filters).forEach { filter ->
when (filter) {
is GenreList -> filter.state.forEach { genre ->
@ -74,6 +74,15 @@ class AllHentai : ParsedHttpSource() {
url.addQueryParameter(genre.id, arrayOf("=", "=in", "=ex")[genre.state])
}
}
is OrderBy -> {
if (filter.state == 0) {
url = "$baseUrl/search/advanced".toHttpUrlOrNull()!!.newBuilder()
} else {
val ord = arrayOf("not", "year", "name", "rate", "popularity", "votes", "created", "updated")[filter.state]
url = "$baseUrl/list?sortType=$ord".toHttpUrlOrNull()!!.newBuilder()
return GET(url.toString(), headers)
}
}
}
}
if (query.isNotEmpty()) {
@ -103,6 +112,7 @@ class AllHentai : ParsedHttpSource() {
if (authorElement == null) {
authorElement = infoElement.select("span.elem_screenwriter").first()?.text()
}
manga.title = infoElement.select("h1.names .name").text()
manga.author = authorElement
manga.artist = infoElement.select("span.elem_illustrator").first()?.text()
manga.genre = infoElement.select("span.elem_genre").text().split(",").plusElement(category).joinToString { it.trim() }
@ -243,7 +253,10 @@ class AllHentai : ParsedHttpSource() {
}.build()
return GET(page.imageUrl!!, imgHeader)
}
private class OrderBy : Filter.Select<String>(
"Сортировать",
arrayOf("Без(фильтры)", "По году", "По алфавиту", "По популярности", "Популярно сейчас", "По рейтингу", "Новинки", "По дате обновления")
)
private class Genre(name: String, val id: String) : Filter.TriState(name)
private class GenreList(genres: List<Genre>) : Filter.Group<Genre>("Genres", genres)
@ -253,6 +266,7 @@ class AllHentai : ParsedHttpSource() {
* on https://readmanga.me/search/advanced
*/
override fun getFilterList() = FilterList(
OrderBy(),
GenreList(getGenreList())
)

View File

@ -1,2 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="eu.kanade.tachiyomi.extension" />
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="eu.kanade.tachiyomi.extension">
<application>
<activity
android:name=".ru.desu.DesuActivity"
android:excludeFromRecents="true"
android:theme="@android:style/Theme.NoDisplay">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- DesuActivity sites can be added here. -->
<data
android:host="desu.me"
android:pathPattern="/manga/..*"
android:scheme="https" />
</intent-filter>
</activity>
</application>
</manifest>

View File

@ -5,7 +5,7 @@ ext {
extName = 'Desu'
pkgNameSuffix = 'ru.desu'
extClass = '.Desu'
extVersionCode = 6
extVersionCode = 7
libVersion = '1.2'
}

View File

@ -177,6 +177,32 @@ class Desu : HttpSource() {
override fun imageUrlParse(response: Response) =
throw UnsupportedOperationException("This method should not be called!")
private fun searchMangaByIdRequest(id: String): Request {
return GET("$baseUrl/$id", headers)
}
override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> {
return if (query.startsWith(PREFIX_SLUG_SEARCH)) {
val realQuery = query.removePrefix(PREFIX_SLUG_SEARCH)
client.newCall(searchMangaByIdRequest(realQuery))
.asObservableSuccess()
.map { response ->
val details = mangaDetailsParse(response)
details.url = "/$realQuery"
MangasPage(listOf(details), false)
}
} else {
client.newCall(searchMangaRequest(page, query, filters))
.asObservableSuccess()
.map { response ->
searchMangaParse(response)
}
}
}
companion object {
const val PREFIX_SLUG_SEARCH = "slug:"
}
private class OrderBy : Filter.Select<String>(
"Сортировка",
arrayOf("Популярность", "Дата", "Имя")

View File

@ -0,0 +1,40 @@
package eu.kanade.tachiyomi.extension.ru.desu
import android.app.Activity
import android.content.ActivityNotFoundException
import android.content.Intent
import android.os.Bundle
import android.util.Log
import kotlin.system.exitProcess
/**
* Springboard that accepts https://desu.me/manga/xxx intents and redirects them to
* the main tachiyomi process. The idea is to not install the intent filter unless
* you have this extension installed, but still let the main tachiyomi app control
* things.
*/
class DesuActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val pathSegments = intent?.data?.pathSegments
if (pathSegments != null && pathSegments.size > 1) {
val titleid = pathSegments[1]
val mainIntent = Intent().apply {
action = "eu.kanade.tachiyomi.SEARCH"
putExtra("query", "${Desu.PREFIX_SLUG_SEARCH}$titleid")
putExtra("filter", packageName)
}
try {
startActivity(mainIntent)
} catch (e: ActivityNotFoundException) {
Log.e("RemangaActivity", e.toString())
}
} else {
Log.e("RemangaActivity", "could not parse uri from intent $intent")
}
finish()
exitProcess(0)
}
}

View File

@ -5,7 +5,7 @@ ext {
extName = 'Mintmanga'
pkgNameSuffix = 'ru.mintmanga'
extClass = '.Mintmanga'
extVersionCode = 27
extVersionCode = 28
libVersion = '1.2'
}

View File

@ -135,6 +135,7 @@ class Mintmanga : ParsedHttpSource() {
if (authorElement == null) {
authorElement = infoElement.select("span.elem_screenwriter").first()?.text()
}
manga.title = infoElement.select("h1.names .name").text()
manga.author = authorElement
manga.artist = infoElement.select("span.elem_illustrator").first()?.text()
manga.genre = infoElement.select("span.elem_genre").text().split(",").plusElement(category).joinToString { it.trim() }
@ -304,7 +305,7 @@ class Mintmanga : ParsedHttpSource() {
}
private class OrderBy : Filter.Select<String>(
"Сортировать\n(отдельно от фильтров)",
"Сортировать",
arrayOf("Без(фильтры)", "По году", "По алфавиту", "По популярности", "Популярно сейчас", "По рейтингу", "Новинки", "По дате обновления")
)

View File

@ -5,7 +5,7 @@ ext {
extName = 'Readmanga'
pkgNameSuffix = 'ru.readmanga'
extClass = '.Readmanga'
extVersionCode = 26
extVersionCode = 27
libVersion = '1.2'
}

View File

@ -135,6 +135,7 @@ class Readmanga : ParsedHttpSource() {
if (authorElement == null) {
authorElement = infoElement.select("span.elem_screenwriter").first()?.text()
}
manga.title = infoElement.select("h1.names .name").text()
manga.author = authorElement
manga.artist = infoElement.select("span.elem_illustrator").first()?.text()
manga.genre = infoElement.select("span.elem_genre").text().split(",").plusElement(category).joinToString { it.trim() }
@ -305,7 +306,7 @@ class Readmanga : ParsedHttpSource() {
}
private class OrderBy : Filter.Select<String>(
"Сортировать\n(отдельно от фильтров)",
"Сортировать",
arrayOf("Без(фильтры)", "По алфавиту", "По популярности", "Популярно сейчас", "По рейтингу", "Новинки", "По дате обновления")
)

View File

@ -5,7 +5,7 @@ ext {
extName = 'Remanga'
pkgNameSuffix = 'ru.remanga'
extClass = '.Remanga'
extVersionCode = 21
extVersionCode = 22
libVersion = '1.2'
}

View File

@ -350,7 +350,7 @@ class Remanga : ConfigurableSource, HttpSource() {
.asObservableSuccess()
.map { response ->
val details = mangaDetailsParse(response)
details.url = "/$realQuery"
details.url = "/api/titles/$realQuery"
MangasPage(listOf(details), false)
}
} else {

View File

@ -5,7 +5,7 @@ ext {
extName = 'Selfmanga'
pkgNameSuffix = 'ru.selfmanga'
extClass = '.Selfmanga'
extVersionCode = 7
extVersionCode = 8
libVersion = '1.2'
}

View File

@ -22,7 +22,7 @@ class Selfmanga : ParsedHttpSource() {
override val name = "Selfmanga"
override val baseUrl = "https://selfmanga.ru"
override val baseUrl = "https://selfmanga.live"
override val lang = "ru"
@ -88,6 +88,7 @@ class Selfmanga : ParsedHttpSource() {
val infoElement = document.select("div.leftContent").first()
val manga = SManga.create()
manga.title = infoElement.select("h1.names .name").text()
manga.author = infoElement.select("span.elem_author").first()?.text()
manga.genre = infoElement.select("span.elem_genre").text().replace(" ,", ",")
manga.description = infoElement.select("div.manga-description").text()