pull/21/head
fengyuecanzhu 3 years ago
parent 42ccafde13
commit 7d17796e55
  1. 1
      app/src/main/java/xyz/fycz/myreader/common/APPCONST.java
  2. 5
      app/src/main/java/xyz/fycz/myreader/greendao/entity/Chapter.java
  3. 9
      app/src/main/java/xyz/fycz/myreader/greendao/entity/rule/BookSource.java
  4. 13
      app/src/main/java/xyz/fycz/myreader/greendao/service/ChapterService.java
  5. 4
      app/src/main/java/xyz/fycz/myreader/model/third3/analyzeRule/AnalyzeRule.kt
  6. 2
      app/src/main/java/xyz/fycz/myreader/model/third3/analyzeRule/AnalyzeUrl.kt
  7. 1
      app/src/main/java/xyz/fycz/myreader/model/third3/webBook/BookChapterList.kt
  8. 7
      app/src/main/java/xyz/fycz/myreader/model/third3/webBook/BookContent.kt
  9. 6
      app/src/main/java/xyz/fycz/myreader/model/third3/webBook/BookInfo.kt

@ -127,6 +127,7 @@ public class APPCONST {
}.getType();
public static final Pattern JS_PATTERN = Pattern.compile("(<js>[\\w\\W]*?</js>|@js:[\\w\\W]*$)", Pattern.CASE_INSENSITIVE);
public static final Pattern JS_PATTERN_3 = Pattern.compile("<js>([\\w\\W]*?)</js>|@js:([\\w\\W]*)", Pattern.CASE_INSENSITIVE);
public static final Pattern EXP_PATTERN = Pattern.compile("\\{\\{([\\w\\W]*?)\\}\\}");
// public static final Pattern IMG_PATTERN = Pattern.compile("<img .*?src.*?=.*?\"(.*?(?:,\\{.*\\})?)\".*?>", Pattern.CASE_INSENSITIVE);

@ -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

@ -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;

@ -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) {

@ -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 <= ' ' }

@ -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 =

@ -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

@ -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)

@ -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}")

Loading…
Cancel
Save