Fix MangaTown licensed chapters
This commit is contained in:
@@ -53,8 +53,10 @@ abstract class RemoteMangaRepository(
|
|||||||
if (subdomain != null) {
|
if (subdomain != null) {
|
||||||
append(subdomain)
|
append(subdomain)
|
||||||
append('.')
|
append('.')
|
||||||
|
append(conf.getDomain(defaultDomain).removePrefix("www."))
|
||||||
|
} else {
|
||||||
|
append(conf.getDomain(defaultDomain))
|
||||||
}
|
}
|
||||||
append(conf.getDomain(defaultDomain))
|
|
||||||
append(this@withDomain)
|
append(this@withDomain)
|
||||||
}
|
}
|
||||||
else -> this
|
else -> this
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ class MangaTownRepository(loaderContext: MangaLoaderContext) :
|
|||||||
scanlator = null,
|
scanlator = null,
|
||||||
branch = null,
|
branch = null,
|
||||||
)
|
)
|
||||||
}
|
} ?: bypassLicensedChapters(manga)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,6 +191,32 @@ class MangaTownRepository(loaderContext: MangaLoaderContext) :
|
|||||||
map[SourceSettings.KEY_USE_SSL] = true
|
map[SourceSettings.KEY_USE_SSL] = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private suspend fun bypassLicensedChapters(manga: Manga): List<MangaChapter> {
|
||||||
|
val doc = loaderContext.httpGet(manga.url.withDomain("m")).parseHtml()
|
||||||
|
val list = doc.body().selectFirst("ul.detail-ch-list") ?: return emptyList()
|
||||||
|
val dateFormat = SimpleDateFormat("MMM dd,yyyy", Locale.US)
|
||||||
|
return list.select("li").asReversed().mapIndexedNotNull { i, li ->
|
||||||
|
val a = li.selectFirst("a") ?: return@mapIndexedNotNull null
|
||||||
|
val href = a.relUrl("href")
|
||||||
|
val name = a.selectFirst("span.vol")?.text().orEmpty().ifEmpty {
|
||||||
|
a.ownText()
|
||||||
|
}
|
||||||
|
MangaChapter(
|
||||||
|
id = generateUid(href),
|
||||||
|
url = href,
|
||||||
|
source = MangaSource.MANGATOWN,
|
||||||
|
number = i + 1,
|
||||||
|
uploadDate = parseChapterDate(
|
||||||
|
dateFormat,
|
||||||
|
li.selectFirst("span.time")?.text()
|
||||||
|
),
|
||||||
|
name = name.ifEmpty { "${manga.title} - ${i + 1}" },
|
||||||
|
scanlator = null,
|
||||||
|
branch = null,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun String.parseTagKey() = split('/').findLast { TAG_REGEX matches it }
|
private fun String.parseTagKey() = split('/').findLast { TAG_REGEX matches it }
|
||||||
|
|
||||||
private companion object {
|
private companion object {
|
||||||
|
|||||||
Reference in New Issue
Block a user