CommitStrip: fix parsing single page entries (#8951)

* Fix pages that can be null

* bump commitstrip.extvercode
This commit is contained in:
nicki 2021-09-04 23:29:23 +05:30 committed by GitHub
parent 025a1b9d39
commit 47f5ac549f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'Commit Strip'
pkgNameSuffix = 'all.commitstrip'
extClass = '.CommitStripFactory'
extVersionCode = 2
extVersionCode = 3
libVersion = '1.2'
}

View File

@ -87,7 +87,7 @@ abstract class CommitStrip(
// create a new call to parse the no of pages in the site
// example responseString - Page 1 of 11
val responseString = client.newCall(GET("${manga.url}", headers)).execute().run {
asJsoup().select(".wp-pagenavi .pages").first().text()
asJsoup().selectFirst(".wp-pagenavi .pages")?.text() ?: "1"
}
// use regex to get the last number (i.e. 11 above)
val pages = Regex("\\d+").findAll(responseString).last().value.toInt()