MMRCMS - fix Mangas.pw chapters (#3892)
This commit is contained in:
parent
69ba77f792
commit
83c6ec46db
|
@ -5,7 +5,7 @@ ext {
|
||||||
extName = 'My Manga Reader CMS (Many sources)'
|
extName = 'My Manga Reader CMS (Many sources)'
|
||||||
pkgNameSuffix = 'all.mmrcms'
|
pkgNameSuffix = 'all.mmrcms'
|
||||||
extClass = '.MyMangaReaderCMSSources'
|
extClass = '.MyMangaReaderCMSSources'
|
||||||
extVersionCode = 44
|
extVersionCode = 45
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -280,6 +280,11 @@ class MyMangaReaderCMSSource(
|
||||||
private fun chapterListSelector() = "ul[class^=chapters] > li:not(.btn), table.table tr"
|
private fun chapterListSelector() = "ul[class^=chapters] > li:not(.btn), table.table tr"
|
||||||
// Some websites add characters after "chapters" thus the need of checking classes that starts with "chapters"
|
// Some websites add characters after "chapters" thus the need of checking classes that starts with "chapters"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* titleWrapper can have multiple "a" elements, filter to the first that contains letters (i.e. not "" or # as is possible)
|
||||||
|
*/
|
||||||
|
private val urlRegex = Regex("""[a-zA-z]""")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a chapter from the given element.
|
* Returns a chapter from the given element.
|
||||||
*
|
*
|
||||||
|
@ -291,7 +296,9 @@ class MyMangaReaderCMSSource(
|
||||||
try {
|
try {
|
||||||
val titleWrapper = element.select("[class^=chapter-title-rtl]").first()
|
val titleWrapper = element.select("[class^=chapter-title-rtl]").first()
|
||||||
// Some websites add characters after "..-rtl" thus the need of checking classes that starts with that
|
// Some websites add characters after "..-rtl" thus the need of checking classes that starts with that
|
||||||
val url = titleWrapper.getElementsByTag("a").attr("href")
|
val url = titleWrapper.getElementsByTag("a")
|
||||||
|
.first { it.attr("href").contains(urlRegex) }
|
||||||
|
.attr("href")
|
||||||
|
|
||||||
// Ensure chapter actually links to a manga
|
// Ensure chapter actually links to a manga
|
||||||
// Some websites use the chapters box to link to post announcements
|
// Some websites use the chapters box to link to post announcements
|
||||||
|
@ -327,7 +334,7 @@ class MyMangaReaderCMSSource(
|
||||||
|
|
||||||
private fun parseDate(dateText: String): Long {
|
private fun parseDate(dateText: String): Long {
|
||||||
return try {
|
return try {
|
||||||
DATE_FORMAT.parse(dateText).time
|
DATE_FORMAT.parse(dateText)?.time ?: 0
|
||||||
} catch (e: ParseException) {
|
} catch (e: ParseException) {
|
||||||
0L
|
0L
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue