Fix wrong title in details parse. (#4848)

This commit is contained in:
Alessandro Jean 2020-11-12 10:11:52 -03:00 committed by GitHub
parent 685a266de5
commit b2eb532944
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 12 deletions

View File

@ -13,6 +13,10 @@
android:scheme="https"
android:host="unionleitor.top"
android:pathPattern="/perfil-manga/..*" />
<data
android:scheme="https"
android:host="unionmangas.top"
android:pathPattern="/perfil-manga/..*" />
</intent-filter>
</activity>
</application>

View File

@ -5,7 +5,7 @@ ext {
extName = 'Union Mangás'
pkgNameSuffix = 'pt.unionmangas'
extClass = '.UnionMangas'
extVersionCode = 16
extVersionCode = 17
libVersion = '1.2'
}

View File

@ -50,7 +50,7 @@ class UnionMangas : ParsedHttpSource() {
override fun headersBuilder(): Headers.Builder = Headers.Builder()
.add("User-Agent", USER_AGENT)
.add("Origin", baseUrl)
.add("Referer", "$baseUrl/ayx")
.add("Referer", baseUrl)
override fun popularMangaRequest(page: Int): Request {
val listPath = if (page == 1) "" else "/visualizacoes/${page - 1}"
@ -99,9 +99,9 @@ class UnionMangas : ParsedHttpSource() {
override fun latestUpdatesNextPageSelector() = "div#linha-botao-mais"
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
if (query.startsWith(PREFIX_ID_SEARCH)) {
val id = query.removePrefix(PREFIX_ID_SEARCH)
return GET("$baseUrl/perfil-manga/$id", headers)
if (query.startsWith(PREFIX_SLUG_SEARCH)) {
val slug = query.removePrefix(PREFIX_SLUG_SEARCH)
return GET("$baseUrl/perfil-manga/$slug", headers)
}
val newHeaders = headersBuilder()
@ -119,9 +119,9 @@ class UnionMangas : ParsedHttpSource() {
val requestUrl = response.request().url().toString()
if (requestUrl.contains("perfil-manga")) {
val id = requestUrl.substringAfter("perfil-manga/")
val slug = requestUrl.substringAfter("perfil-manga/")
val manga = mangaDetailsParse(response)
.apply { url = "/perfil-manga/$id" }
.apply { url = "/perfil-manga/$slug" }
return MangasPage(listOf(manga), false)
}
@ -143,7 +143,7 @@ class UnionMangas : ParsedHttpSource() {
val infoElement = document.select("div.tamanho-bloco-perfil").first()
val rowInfo = infoElement.select("div.row:eq(2)").first()
title = infoElement.select("h2").text().withoutLanguage()
title = infoElement.select("h2").first().text().withoutLanguage()
author = rowInfo.select("div.col-md-8:eq(4)").first().textWithoutLabel()
artist = rowInfo.select("div.col-md-8:eq(5)").first().textWithoutLabel()
genre = rowInfo.select("div.col-md-8:eq(3)").first().textWithoutLabel()
@ -215,7 +215,8 @@ class UnionMangas : ParsedHttpSource() {
private fun Response.asJsonObject(): JsonObject = JSON_PARSER.parse(body()!!.string()).obj
companion object {
private const val USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36"
private const val USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) " +
"AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.193 Safari/537.36"
private val JSON_PARSER by lazy { JsonParser() }
@ -223,6 +224,6 @@ class UnionMangas : ParsedHttpSource() {
SimpleDateFormat("(dd/MM/yyyy)", Locale.ENGLISH)
}
const val PREFIX_ID_SEARCH = "id:"
const val PREFIX_SLUG_SEARCH = "slug:"
}
}

View File

@ -16,10 +16,10 @@ class UnionMangasUrlActivity : Activity() {
super.onCreate(savedInstanceState)
val pathSegments = intent?.data?.pathSegments
if (pathSegments != null && pathSegments.size > 1) {
val id = pathSegments[1]
val slug = pathSegments[1]
val mainIntent = Intent().apply {
action = "eu.kanade.tachiyomi.SEARCH"
putExtra("query", "${UnionMangas.PREFIX_ID_SEARCH}$id")
putExtra("query", "${UnionMangas.PREFIX_SLUG_SEARCH}$slug")
putExtra("filter", packageName)
}