diff --git a/app/src/main/java/xyz/fycz/myreader/common/APPCONST.java b/app/src/main/java/xyz/fycz/myreader/common/APPCONST.java index 28988a2..94c6960 100644 --- a/app/src/main/java/xyz/fycz/myreader/common/APPCONST.java +++ b/app/src/main/java/xyz/fycz/myreader/common/APPCONST.java @@ -127,6 +127,7 @@ public class APPCONST { }.getType(); public static final Pattern JS_PATTERN = Pattern.compile("([\\w\\W]*?|@js:[\\w\\W]*$)", Pattern.CASE_INSENSITIVE); + public static final Pattern JS_PATTERN_3 = Pattern.compile("([\\w\\W]*?)|@js:([\\w\\W]*)", Pattern.CASE_INSENSITIVE); public static final Pattern EXP_PATTERN = Pattern.compile("\\{\\{([\\w\\W]*?)\\}\\}"); // public static final Pattern IMG_PATTERN = Pattern.compile("", Pattern.CASE_INSENSITIVE); diff --git a/app/src/main/java/xyz/fycz/myreader/greendao/entity/Chapter.java b/app/src/main/java/xyz/fycz/myreader/greendao/entity/Chapter.java index ace97b7..427bd41 100644 --- a/app/src/main/java/xyz/fycz/myreader/greendao/entity/Chapter.java +++ b/app/src/main/java/xyz/fycz/myreader/greendao/entity/Chapter.java @@ -23,11 +23,6 @@ import java.io.File; import java.util.HashMap; import java.util.Map; -/** - * 章节 - * Created by zhao on 2017/7/24. - */ - @Entity public class Chapter implements RuleDataInterface { @Id diff --git a/app/src/main/java/xyz/fycz/myreader/greendao/entity/rule/BookSource.java b/app/src/main/java/xyz/fycz/myreader/greendao/entity/rule/BookSource.java index b6ca3ce..1fd1785 100644 --- a/app/src/main/java/xyz/fycz/myreader/greendao/entity/rule/BookSource.java +++ b/app/src/main/java/xyz/fycz/myreader/greendao/entity/rule/BookSource.java @@ -74,12 +74,12 @@ public class BookSource implements Parcelable, Cloneable { @Convert(converter = FindRuleConvert.class, columnType = String.class) private FindRule findRule; - @Generated(hash = 906128088) + @Generated(hash = 798251066) public BookSource(String sourceUrl, String sourceEName, String sourceName, String sourceGroup, String sourceCharset, String sourceType, String sourceHeaders, String loginUrl, - String sourceComment, String concurrentRate, Long lastUpdateTime, int orderNum, int weight, - boolean enable, SearchRule searchRule, InfoRule infoRule, TocRule tocRule, - ContentRule contentRule, FindRule findRule) { + String loginCheckJs, String sourceComment, String concurrentRate, Long lastUpdateTime, + int orderNum, int weight, boolean enable, SearchRule searchRule, InfoRule infoRule, + TocRule tocRule, ContentRule contentRule, FindRule findRule) { this.sourceUrl = sourceUrl; this.sourceEName = sourceEName; this.sourceName = sourceName; @@ -88,6 +88,7 @@ public class BookSource implements Parcelable, Cloneable { this.sourceType = sourceType; this.sourceHeaders = sourceHeaders; this.loginUrl = loginUrl; + this.loginCheckJs = loginCheckJs; this.sourceComment = sourceComment; this.concurrentRate = concurrentRate; this.lastUpdateTime = lastUpdateTime; diff --git a/app/src/main/java/xyz/fycz/myreader/greendao/service/ChapterService.java b/app/src/main/java/xyz/fycz/myreader/greendao/service/ChapterService.java index 46b52e9..a16bb44 100644 --- a/app/src/main/java/xyz/fycz/myreader/greendao/service/ChapterService.java +++ b/app/src/main/java/xyz/fycz/myreader/greendao/service/ChapterService.java @@ -39,12 +39,13 @@ public class ChapterService extends BaseService { chapter.setBookId(cursor.getString(1)); chapter.setNumber(cursor.getInt(2)); chapter.setTitle(cursor.getString(3)); - chapter.setIsVip(cursor.getInt(4) != 0); - chapter.setIsPay(cursor.getInt(5) != 0); - chapter.setUpdateTime(cursor.getString(6)); - chapter.setContent(cursor.getString(7)); - chapter.setStart(cursor.getInt(8)); - chapter.setEnd(cursor.getInt(9)); + chapter.setUrl(cursor.getString(4)); + chapter.setIsVip(cursor.getInt(5) != 0); + chapter.setIsPay(cursor.getInt(6) != 0); + chapter.setUpdateTime(cursor.getString(7)); + chapter.setContent(cursor.getString(8)); + chapter.setStart(cursor.getInt(9)); + chapter.setEnd(cursor.getInt(10)); chapters.add(chapter); } } catch (Exception e) { diff --git a/app/src/main/java/xyz/fycz/myreader/model/third3/analyzeRule/AnalyzeRule.kt b/app/src/main/java/xyz/fycz/myreader/model/third3/analyzeRule/AnalyzeRule.kt index a866cbe..e91f98c 100644 --- a/app/src/main/java/xyz/fycz/myreader/model/third3/analyzeRule/AnalyzeRule.kt +++ b/app/src/main/java/xyz/fycz/myreader/model/third3/analyzeRule/AnalyzeRule.kt @@ -6,7 +6,7 @@ import androidx.annotation.Keep import kotlinx.coroutines.runBlocking import org.jsoup.nodes.Entities import org.mozilla.javascript.NativeObject -import xyz.fycz.myreader.common.APPCONST.JS_PATTERN +import xyz.fycz.myreader.common.APPCONST.JS_PATTERN_3 import xyz.fycz.myreader.common.APPCONST.SCRIPT_ENGINE import xyz.fycz.myreader.greendao.entity.Book import xyz.fycz.myreader.greendao.entity.Chapter @@ -394,7 +394,7 @@ class AnalyzeRule( mMode = Mode.Regex } var tmp: String - val jsMatcher = JS_PATTERN.matcher(ruleStr) + val jsMatcher = JS_PATTERN_3.matcher(ruleStr) while (jsMatcher.find()) { if (jsMatcher.start() > start) { tmp = ruleStr.substring(start, jsMatcher.start()).trim { it <= ' ' } diff --git a/app/src/main/java/xyz/fycz/myreader/model/third3/analyzeRule/AnalyzeUrl.kt b/app/src/main/java/xyz/fycz/myreader/model/third3/analyzeRule/AnalyzeUrl.kt index 2889963..597013b 100644 --- a/app/src/main/java/xyz/fycz/myreader/model/third3/analyzeRule/AnalyzeUrl.kt +++ b/app/src/main/java/xyz/fycz/myreader/model/third3/analyzeRule/AnalyzeUrl.kt @@ -98,7 +98,7 @@ class AnalyzeUrl( private fun analyzeJs() { var start = 0 var tmp: String - val jsMatcher = JS_PATTERN.matcher(ruleUrl) + val jsMatcher = JS_PATTERN_3.matcher(ruleUrl) while (jsMatcher.find()) { if (jsMatcher.start() > start) { tmp = diff --git a/app/src/main/java/xyz/fycz/myreader/model/third3/webBook/BookChapterList.kt b/app/src/main/java/xyz/fycz/myreader/model/third3/webBook/BookChapterList.kt index 77d379d..d5a4e0c 100644 --- a/app/src/main/java/xyz/fycz/myreader/model/third3/webBook/BookChapterList.kt +++ b/app/src/main/java/xyz/fycz/myreader/model/third3/webBook/BookChapterList.kt @@ -116,6 +116,7 @@ object BookChapterList { /*if (!book.getReverseToc()) { list.reverse() }*/ + list.reverse() Log.d(book.source, "◇目录总数:${list.size}") list.forEachIndexed { index, bookChapter -> bookChapter.number = index diff --git a/app/src/main/java/xyz/fycz/myreader/model/third3/webBook/BookContent.kt b/app/src/main/java/xyz/fycz/myreader/model/third3/webBook/BookContent.kt index 5a98cd0..7e4c823 100644 --- a/app/src/main/java/xyz/fycz/myreader/model/third3/webBook/BookContent.kt +++ b/app/src/main/java/xyz/fycz/myreader/model/third3/webBook/BookContent.kt @@ -45,7 +45,12 @@ object BookContent { val mNextChapterUrl = if (!nextChapterUrl.isNullOrEmpty()) { nextChapterUrl } else { - ChapterService.getInstance().findBookAllChapterByBookId(book.id)[bookChapter.number + 1].url + val chapters = ChapterService.getInstance().findBookAllChapterByBookId(book.id) + if (chapters.size > bookChapter.number + 1) { + chapters[bookChapter.number + 1].url + } else { + null + } } val content = StringBuilder() val nextUrlList = arrayListOf(baseUrl) diff --git a/app/src/main/java/xyz/fycz/myreader/model/third3/webBook/BookInfo.kt b/app/src/main/java/xyz/fycz/myreader/model/third3/webBook/BookInfo.kt index 0df0d36..f0508a4 100644 --- a/app/src/main/java/xyz/fycz/myreader/model/third3/webBook/BookInfo.kt +++ b/app/src/main/java/xyz/fycz/myreader/model/third3/webBook/BookInfo.kt @@ -62,7 +62,8 @@ object BookInfo { scope.ensureActive() Log.d(bookSource.sourceUrl, "┌获取书名") BookList.formatBookName(analyzeRule.getString(infoRule.name)).let { - if (it.isNotEmpty() && (mCanReName || book.name.isEmpty())) { + //if (it.isNotEmpty() && (mCanReName || book.name.isEmpty())) { + if (it.isNotEmpty()) { book.name = it } Log.d(bookSource.sourceUrl, "└${it}") @@ -70,7 +71,8 @@ object BookInfo { scope.ensureActive() Log.d(bookSource.sourceUrl, "┌获取作者") BookList.formatBookAuthor(analyzeRule.getString(infoRule.author)).let { - if (it.isNotEmpty() && (mCanReName || book.author.isEmpty())) { + //if (it.isNotEmpty() && (mCanReName || book.author.isEmpty())) { + if (it.isNotEmpty()) { book.author = it } Log.d(bookSource.sourceUrl, "└${it}")