Manhwa latino (#13054)
* First commit Mahnwa-Latino Extension. * manhwa-latino: Implementing find function TODO: only works with text, filter not implemented yet * manhwa-latino Add Parser to finde the information of Manhwa-Latino The parser 'ManhwaLatinoSiteParser.kt' make the whole magic to find the information of the Website. Mudularize The code and adding documentation * manhwa-latino: Adding Logos der Extension TODO: I am not to happy, i will check it later. * manhwa-latino: Adding Tags to Genre Combobox * manhwa-latino: Adding Headers to prevent error 404 The headers are necesary to prevent error 403 by downloading images. * manhwa-latino: Tags addded into Manga Description Page Status from Manga readed from Tags * manhwa-latino: Modularize Code * manhwa-latino: Adding Uploaddate for Chapters * manhwa-latino: Bug to get Chapter Number fixed * manhwa-latino: Logo 0.2 * manhwa-latino: Versionb 1.2.10 Adding Comments to ManhwaLatinoSiteParser * manhwa-latino: Remove logo_model directory * manhwa-latino: Show Seconds after Release a new Chapter * manhwa-latino: Fix for Cloudflare * manhwa-latino: Try to fix Cloudflare ByPass Adding isNsfw to build.gradle * manhwa-latino: Update from parser after website update * manhwa-latino: Deactivate lastest manga and new Client The new website from Manhwa-Latino doesnt show lastest mangas. * manhwa-latino: Adding Manifest to load url-adress The extesion will bi able to open and find mangas with the url. TODO: first version. NOT READY YET. * manhwa-latino: Fix to find Manga Status information * Manhwa-Latino: The Extension can open a Link Now the extension can recognize a link from Manhwa-Latino and show the manga from the link in the app. * Manhwa-Latino: Modularize Code and Activity for Url added * Manhwa-Latino: Add Constant-File. This file contain all contants for this extension. * manhwa-latino Url from the Website has changed. from https://manhwa-latino.com => https://manhwa-es.com * manhwa-latino Url update on manifest * manhwa-latino Fix to get ThumbnailUrl and Url from Slider The Slider from Manhwa-Latino was updated and the parser was updated as well. * manhwa-latino: Using Cloudflare Client to connect. Manhwa-Latino now Manhwa-Es are using cloudflare right now. This workaround fix make possible the connection from the app to the Website. * Update the address to every image * Update Manhwa-Latino Address * Updating popularMangaNextPageSelector * Remove CLoudFlare Client * Manhwa-Latino: Update Image Src-Tag The website has changed the attribute where the adress to the images are. * Mahnwa-Latino: Remove client, because it is not overwritten Original Client is: override val client: OkHttpClient = network.client.newBuilder().build() it is not overwritten, that is why it can remove. * manhwa-latino: Remove Comments Co-authored-by: Luis Beroiza <luisalberto.beroizaosses@intern.osp-dd.de> Co-authored-by: AlberyKous <extreme_rvd@hotmail.com>
This commit is contained in:
parent
0739496f50
commit
a13b3ffce6
@ -5,7 +5,7 @@ ext {
|
||||
extName = 'Manhwa-Latino'
|
||||
pkgNameSuffix = 'es.manhwalatino'
|
||||
extClass = '.ManhwaLatino'
|
||||
extVersionCode = 19
|
||||
extVersionCode = 20
|
||||
isNsfw = true
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ object MLConstants {
|
||||
const val searchMangaNextPageSelector = "link[rel=next]"
|
||||
const val latestUpdatesSelector = "div.slider__item"
|
||||
const val searchMangaSelector = "div.page-item-detail.manga"
|
||||
const val popularMangaNextPageSelector = "nav.navigation-ajax"
|
||||
const val popularMangaNextPageSelector = "a.nextpostslink"
|
||||
const val latestUpdatesNextPageSelector = "div[role=navigation] a.last"
|
||||
|
||||
const val popularMangaSelector = "div.page-item-detail.manga"
|
||||
@ -36,4 +36,5 @@ object MLConstants {
|
||||
const val chapterReleaseDateLinkParser = "span.chapter-release-date a"
|
||||
const val chapterReleaseDateIParser = "span.chapter-release-date i"
|
||||
const val pageListParseSelector = "div.page-break.no-gaps img"
|
||||
const val imageAttribute = "abs:data-src"
|
||||
}
|
||||
|
@ -11,13 +11,11 @@ import eu.kanade.tachiyomi.source.model.SManga
|
||||
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
||||
import eu.kanade.tachiyomi.util.asJsoup
|
||||
import okhttp3.Headers
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import okhttp3.Response
|
||||
import org.jsoup.nodes.Document
|
||||
import org.jsoup.nodes.Element
|
||||
import rx.Observable
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
class ManhwaLatino : ParsedHttpSource() {
|
||||
|
||||
@ -37,14 +35,6 @@ class ManhwaLatino : ParsedHttpSource() {
|
||||
*/
|
||||
override fun headersBuilder() = Headers.Builder().add("Referer", "$baseUrl")
|
||||
|
||||
/**
|
||||
* Http Client with Cloudflare
|
||||
*/
|
||||
override val client: OkHttpClient = network.cloudflareClient.newBuilder()
|
||||
.connectTimeout(10, TimeUnit.SECONDS)
|
||||
.readTimeout(30, TimeUnit.SECONDS)
|
||||
.build()
|
||||
|
||||
/**
|
||||
* Parser for The WebSite
|
||||
*/
|
||||
|
@ -75,9 +75,11 @@ class ManhwaLatinoSiteParser(
|
||||
fun getMangaFromLastTranslatedSlide(element: Element): SManga {
|
||||
val manga = SManga.create()
|
||||
manga.url =
|
||||
getUrlWithoutDomain(element.select(MLConstants.latestUpdatesSelectorUrl).first().attr("abs:href"))
|
||||
getUrlWithoutDomain(
|
||||
element.select(MLConstants.latestUpdatesSelectorUrl).first().attr("abs:href")
|
||||
)
|
||||
manga.title = element.select(MLConstants.latestUpdatesSelectorTitle).text().trim()
|
||||
manga.thumbnail_url = element.select(MLConstants.latestUpdatesSelectorThumbnailUrl).attr("abs:src").replace("//", "/")
|
||||
manga.thumbnail_url = getImage(element.select(MLConstants.latestUpdatesSelectorThumbnailUrl)).replace("//", "/")
|
||||
return manga
|
||||
}
|
||||
|
||||
@ -113,9 +115,11 @@ class ManhwaLatinoSiteParser(
|
||||
private fun getMangasFromSearchSite(document: Document): List<SManga> {
|
||||
return document.select(MLConstants.searchSiteMangasHTMLSelector).map {
|
||||
val manga = SManga.create()
|
||||
manga.url = getUrlWithoutDomain(it.select(MLConstants.searchPageUrlHTMLSelector).attr("abs:href"))
|
||||
manga.url = getUrlWithoutDomain(
|
||||
it.select(MLConstants.searchPageUrlHTMLSelector).attr("abs:href")
|
||||
)
|
||||
manga.title = it.select(MLConstants.searchPageTitleHTMLSelector).text().trim()
|
||||
manga.thumbnail_url = it.select(MLConstants.searchPageThumbnailUrlMangaHTMLSelector).attr("abs:src")
|
||||
manga.thumbnail_url = getImage(it.select(MLConstants.searchPageThumbnailUrlMangaHTMLSelector))
|
||||
manga
|
||||
}
|
||||
}
|
||||
@ -133,9 +137,11 @@ class ManhwaLatinoSiteParser(
|
||||
*/
|
||||
fun getMangaFromList(element: Element): SManga {
|
||||
val manga = SManga.create()
|
||||
manga.url = getUrlWithoutDomain(element.select(MLConstants.popularGenreUrlHTMLSelector).attr("abs:href"))
|
||||
manga.url = getUrlWithoutDomain(
|
||||
element.select(MLConstants.popularGenreUrlHTMLSelector).attr("abs:href")
|
||||
)
|
||||
manga.title = element.select(MLConstants.popularGenreTitleHTMLSelector).text().trim()
|
||||
manga.thumbnail_url = element.select(MLConstants.popularGenreThumbnailUrlMangaHTMLSelector).attr("abs:src")
|
||||
manga.thumbnail_url = getImage(element.select(MLConstants.popularGenreThumbnailUrlMangaHTMLSelector))
|
||||
return manga
|
||||
}
|
||||
|
||||
@ -149,7 +155,8 @@ class ManhwaLatinoSiteParser(
|
||||
|
||||
val titleElements = document.select("#manga-title h1")
|
||||
val mangaType = getMangaBadges(titleElements)
|
||||
val descriptionList = document.select(MLConstants.mangaDetailsDescriptionHTMLSelector).map { it.text() }
|
||||
val descriptionList =
|
||||
document.select(MLConstants.mangaDetailsDescriptionHTMLSelector).map { it.text() }
|
||||
val author = document.select(MLConstants.mangaDetailsAuthorHTMLSelector).text()
|
||||
val artist = document.select(MLConstants.mangaDetailsArtistHTMLSelector).text()
|
||||
|
||||
@ -158,8 +165,7 @@ class ManhwaLatinoSiteParser(
|
||||
val genreTagList = genrelist + tagList
|
||||
|
||||
manga.title = titleElements.last().ownText().trim()
|
||||
manga.thumbnail_url =
|
||||
document.select(MLConstants.mangaDetailsThumbnailUrlHTMLSelector).attr("abs:src")
|
||||
manga.thumbnail_url = getImage(document.select(MLConstants.mangaDetailsThumbnailUrlHTMLSelector))
|
||||
manga.description = descriptionList.joinToString("\n")
|
||||
manga.author = author.ifBlank { "Autor Desconocido" }
|
||||
manga.artist = artist
|
||||
@ -238,7 +244,8 @@ class ManhwaLatinoSiteParser(
|
||||
* Get The String with the information about the Release date of the Chapter
|
||||
*/
|
||||
private fun getChapterReleaseDate(element: Element): String {
|
||||
val chapterReleaseDateLink = element.select(MLConstants.chapterReleaseDateLinkParser).attr("title")
|
||||
val chapterReleaseDateLink =
|
||||
element.select(MLConstants.chapterReleaseDateLinkParser).attr("title")
|
||||
val chapterReleaseDateI = element.select(MLConstants.chapterReleaseDateIParser).text()
|
||||
return when {
|
||||
chapterReleaseDateLink.isNotEmpty() -> chapterReleaseDateLink
|
||||
@ -296,9 +303,10 @@ class ManhwaLatinoSiteParser(
|
||||
*/
|
||||
fun getPageListParse(response: Response): List<Page> {
|
||||
val list =
|
||||
response.asJsoup().select(MLConstants.pageListParseSelector).mapIndexed { index, imgElement ->
|
||||
Page(index, "", imgElement.attr("abs:src"))
|
||||
}
|
||||
response.asJsoup().select(MLConstants.pageListParseSelector)
|
||||
.mapIndexed { index, imgElement ->
|
||||
Page(index, "", getImage(imgElement))
|
||||
}
|
||||
return list
|
||||
}
|
||||
|
||||
@ -357,4 +365,28 @@ class ManhwaLatinoSiteParser(
|
||||
* Create a Address url without the base url.
|
||||
*/
|
||||
private fun getUrlWithoutDomain(url: String) = url.substringAfter(baseUrl)
|
||||
|
||||
/**
|
||||
* Extract the Image from the Html Element
|
||||
* The website changes often the attr of the images
|
||||
* data-src or src
|
||||
*/
|
||||
private fun getImage(elements: Elements): String {
|
||||
var imageUrl: String = elements.attr(MLConstants.imageAttribute)
|
||||
if (imageUrl.isEmpty())
|
||||
imageUrl = elements.attr("abs:src")
|
||||
return imageUrl
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the Image from the Html Element
|
||||
* The website changes often the attr of the images
|
||||
* data-src or src
|
||||
*/
|
||||
private fun getImage(element: Element): String {
|
||||
var imageUrl = element.attr(MLConstants.imageAttribute)
|
||||
if (imageUrl.isEmpty())
|
||||
imageUrl = element.attr("abs:src")
|
||||
return imageUrl
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user