From cf8f5b797f4ab3f8966974b170da9455863b057d Mon Sep 17 00:00:00 2001 From: fengyuecanzhu <1021300691@qq.com> Date: Thu, 13 May 2021 23:24:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B9=A6=E6=BA=90=E6=96=B0=E5=A2=9E=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E5=A4=B4=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 3 +- .../xyz/fycz/myreader/entity/JsonModel.java | 105 ---------- .../entity/sourceedit/EditEntityUtil.kt | 2 + .../xyz/fycz/myreader/enums/FindType.java | 35 ---- .../xyz/fycz/myreader/enums/ReadStyle.java | 22 --- .../greendao/entity/rule/BookSource.java | 21 +- .../ui/activity/SourceDebugActivity.java | 4 +- .../myreader/ui/dialog/DialogCreator.java | 38 +--- .../myreader/ui/fragment/FindFragment.java | 14 +- .../fycz/myreader/util/utils/OkHttpUtils.java | 4 + .../xyz/fycz/myreader/webapi/CommonApi.java | 22 +-- .../webapi/crawler/base/BaseLocalCrawler.java | 14 ++ .../crawler/base/BaseSourceCrawler.java | 26 +++ .../crawler/base/BaseSourceCrawlerNoInfo.java | 6 + .../webapi/crawler/base/ReadCrawler.java | 2 + .../crawler/find/Ben100FindCrawler.java | 179 ++++++++++++++++++ .../crawler/find/MiaoBiFindCrawler.java | 119 ++++++++++++ .../webapi/crawler/find/QB5FindCrawler.java | 158 ++++++++++++++++ .../webapi/crawler/find/XS7FindCrawler.java | 123 ++++++++++++ .../myreader/webapi/crawler/find/XS7Rank.java | 2 +- .../crawler/read/Ben100ReadCrawler.java | 133 +------------ .../crawler/read/BiJianReadCrawler.java | 3 +- .../crawler/read/BiQuGe44ReadCrawler.java | 3 +- .../crawler/read/BiQuGeReadCrawler.java | 3 +- .../crawler/read/CansShu99ReadCrawler.java | 3 +- .../crawler/read/ChaoXingReadCrawler.java | 3 +- .../crawler/read/ChuanQiReadCrawler.java | 3 +- .../webapi/crawler/read/DSTQReadCrawler.java | 3 +- .../webapi/crawler/read/Du1DuReadCrawler.java | 3 +- .../crawler/read/EWenXueReadCrawler.java | 3 +- .../webapi/crawler/read/FYReadCrawler.java | 3 +- .../crawler/read/HongChenReadCrawler.java | 3 +- .../crawler/read/JiuTaoReadCrawler.java | 3 +- .../crawler/read/LaoYaoReadCrawler.java | 3 +- .../crawler/read/LiuLangCatReadCrawler.java | 3 +- .../crawler/read/LuoQiuReadCrawler.java | 3 +- .../webapi/crawler/read/MiQuReadCrawler.java | 3 +- .../crawler/read/MiaoBiReadCrawler.java | 88 +-------- .../crawler/read/PiaoTianReadCrawler.java | 3 +- .../crawler/read/PinShuReadCrawler.java | 3 +- .../crawler/read/PinShuReadCrawler2.java | 3 +- .../webapi/crawler/read/QB5ReadCrawler.java | 136 +------------ .../webapi/crawler/read/QiQiReadCrawler.java | 3 +- .../crawler/read/QianDianReadCrawler.java | 3 +- .../crawler/read/QuanNovelReadCrawler.java | 3 +- .../webapi/crawler/read/ReXueReadCrawler.java | 3 +- .../crawler/read/ShiGuangReadCrawler.java | 3 +- .../crawler/read/ShuHaiGeReadCrawler.java | 14 +- .../crawler/read/SoNovelReadCrawler.java | 14 +- .../crawler/read/TianLaiReadCrawler.java | 3 +- .../crawler/read/WoLongReadCrawler.java | 3 +- .../crawler/read/XBiQuGeReadCrawler.java | 3 +- .../webapi/crawler/read/XS7ReadCrawler.java | 94 +-------- .../webapi/crawler/read/XS7ReadCrawler2.java | 3 +- .../webapi/crawler/read/XiaGuReadCrawler.java | 3 +- .../crawler/read/XingXingReadCrawler.java | 3 +- .../crawler/read/YanQingLouReadCrawler.java | 3 +- .../crawler/read/YunZhongReadCrawler.java | 3 +- .../webapi/crawler/read/ZW37ReadCrawler.java | 3 +- .../crawler/read/ZaiShuYuanReadCrawler.java | 3 +- .../crawler/read/ZuoPinReadCrawler.java | 3 +- app/src/main/res/values/strings.xml | 1 + 62 files changed, 778 insertions(+), 706 deletions(-) delete mode 100644 app/src/main/java/xyz/fycz/myreader/entity/JsonModel.java delete mode 100644 app/src/main/java/xyz/fycz/myreader/enums/FindType.java delete mode 100644 app/src/main/java/xyz/fycz/myreader/enums/ReadStyle.java create mode 100644 app/src/main/java/xyz/fycz/myreader/webapi/crawler/base/BaseLocalCrawler.java create mode 100644 app/src/main/java/xyz/fycz/myreader/webapi/crawler/find/Ben100FindCrawler.java create mode 100644 app/src/main/java/xyz/fycz/myreader/webapi/crawler/find/MiaoBiFindCrawler.java create mode 100644 app/src/main/java/xyz/fycz/myreader/webapi/crawler/find/QB5FindCrawler.java create mode 100644 app/src/main/java/xyz/fycz/myreader/webapi/crawler/find/XS7FindCrawler.java diff --git a/app/build.gradle b/app/build.gradle index 0932045..071ecaf 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -204,10 +204,11 @@ dependencies { //JS //noinspection GradleDependency implementation 'com.github.gedoor:rhino-android:1.3' + } greendao { - schemaVersion 23 + schemaVersion 24 daoPackage 'xyz.fycz.myreader.greendao.gen' // targetGenDir 'src/main/java' } diff --git a/app/src/main/java/xyz/fycz/myreader/entity/JsonModel.java b/app/src/main/java/xyz/fycz/myreader/entity/JsonModel.java deleted file mode 100644 index 16f3d4e..0000000 --- a/app/src/main/java/xyz/fycz/myreader/entity/JsonModel.java +++ /dev/null @@ -1,105 +0,0 @@ -package xyz.fycz.myreader.entity; - -import java.io.Serializable; - - - - -public class JsonModel implements Serializable { - - private static final long serialVersionUID = -7169864463597942730L; - - private int error;//错误码 - private boolean success;//请求是否成功 - private String result;//服务器返回的json数据存放与此 - private String token; - private int datasize; - private String publicKey; - - - private int visibleLastIndex = 0; - private int visibleItemCount; - - - public JsonModel() { - - } - - public String getPublicKey() { - return publicKey; - } - - public void setPublicKey(String publicKey) { - this.publicKey = publicKey; - } - - public int getError() { - return this.error; - } - - public void setError(int error) { - this.error = error; - } - - public String getResult() { - return this.result; - } - - public void setResult(String result) { - this.result = result; - } - - public String getToken() { - return this.token; - } - - public void setToken(String token) { - this.token = token; - } - - public boolean isSuccess() { - return this.success; - } - - public void setSuccess(boolean success) { - this.success = success; - } - - public int getVisibleLastIndex() { - return this.visibleLastIndex; - } - - public void setVisibleLastIndex(int visibleLastIndex) { - this.visibleLastIndex = visibleLastIndex; - } - - public int getVisibleItemCount() { - return this.visibleItemCount; - } - - public void setVisibleItemCount(int visibleItemCount) { - this.visibleItemCount = visibleItemCount; - } - - public int getDatasize() { - return this.datasize; - } - - public void setDatasize(int datasize) { - this.datasize = datasize; - } - - - @Override - public String toString() { - return "JsonModel{" + - "error=" + error + - ", success=" + success + - ", result='" + result + '\'' + - ", token='" + token + '\'' + - ", datasize=" + datasize + - ", visibleLastIndex=" + visibleLastIndex + - ", visibleItemCount=" + visibleItemCount + - '}'; - } -} diff --git a/app/src/main/java/xyz/fycz/myreader/entity/sourceedit/EditEntityUtil.kt b/app/src/main/java/xyz/fycz/myreader/entity/sourceedit/EditEntityUtil.kt index 4f54c51..bea6aea 100644 --- a/app/src/main/java/xyz/fycz/myreader/entity/sourceedit/EditEntityUtil.kt +++ b/app/src/main/java/xyz/fycz/myreader/entity/sourceedit/EditEntityUtil.kt @@ -16,6 +16,7 @@ object EditEntityUtil { add(EditEntity("sourceName", source?.sourceName, R.string.source_name, "不能为空")) add(EditEntity("sourceGroup", source?.sourceGroup, R.string.source_group, "不同分组以;/,隔开")) add(EditEntity("sourceCharset", source?.sourceCharset, R.string.source_charset, "默认UTF-8")) + add(EditEntity("sourceHeaders", source?.sourceHeaders, R.string.source_headers, "json格式")) add(EditEntity("sourceComment", source?.sourceComment, R.string.comment, "这是您留给使用者的说明")) } return sourceEntities @@ -104,6 +105,7 @@ object EditEntityUtil { "sourceName" -> source.sourceName = it.value "sourceGroup" -> source.sourceGroup = it.value "sourceCharset" -> source.sourceCharset = it.value + "sourceHeaders" -> source.sourceHeaders = it.value "sourceComment" -> source.sourceComment = it.value } } diff --git a/app/src/main/java/xyz/fycz/myreader/enums/FindType.java b/app/src/main/java/xyz/fycz/myreader/enums/FindType.java deleted file mode 100644 index 4b1d5ec..0000000 --- a/app/src/main/java/xyz/fycz/myreader/enums/FindType.java +++ /dev/null @@ -1,35 +0,0 @@ -package xyz.fycz.myreader.enums; - -import java.io.Serializable; - -public enum FindType implements Serializable { - - qidian("排行榜[起点中文网]", "https://www.qidian.com/rank"), - qidianns("排行榜[起点女生网]", "https://www.qidian.com/mm/rank"), - qb5("书城[全本小说]", "https://www.qb5.tw"), - biquge("书城[笔趣阁]", "https://www.52bqg.com"); - private String text; - private String url; - private static final long serialVersionUID = 1L; - - FindType(String text, String url) { - this.text = text; - this.url = url; - } - - public static FindType get(int var0) { - return values()[var0]; - } - - public static FindType fromString(String string) { - return valueOf(string); - } - - public String getText() { - return text; - } - - public String getUrl() { - return url; - } -} diff --git a/app/src/main/java/xyz/fycz/myreader/enums/ReadStyle.java b/app/src/main/java/xyz/fycz/myreader/enums/ReadStyle.java deleted file mode 100644 index 3457355..0000000 --- a/app/src/main/java/xyz/fycz/myreader/enums/ReadStyle.java +++ /dev/null @@ -1,22 +0,0 @@ -package xyz.fycz.myreader.enums; - -public enum ReadStyle { - - protectedEye,//护眼 - common,//普通 - blueDeep,//深蓝 - leather,//羊皮纸 - breen,// - custom; - - ReadStyle() { - } - - public static ReadStyle get(int var0) { - return values()[var0]; - } - - public static ReadStyle fromString(String string) { - return ReadStyle.valueOf(string); - } -} 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 cf5e9aa..e9615a6 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 @@ -42,6 +42,7 @@ public class BookSource implements Parcelable, Cloneable { private String sourceGroup; private String sourceCharset; private String sourceType; + private String sourceHeaders; private String sourceComment; private Long lastUpdateTime; @@ -71,17 +72,18 @@ public class BookSource implements Parcelable, Cloneable { @Convert(converter = FindRuleConvert.class, columnType = String.class) private FindRule findRule; - @Generated(hash = 441434718) + @Generated(hash = 1082429073) public BookSource(String sourceUrl, String sourceEName, String sourceName, String sourceGroup, - String sourceCharset, String sourceType, String sourceComment, Long lastUpdateTime, - int orderNum, int weight, boolean enable, SearchRule searchRule, InfoRule infoRule, - TocRule tocRule, ContentRule contentRule, FindRule findRule) { + String sourceCharset, String sourceType, String sourceHeaders, String sourceComment, + 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; this.sourceGroup = sourceGroup; this.sourceCharset = sourceCharset; this.sourceType = sourceType; + this.sourceHeaders = sourceHeaders; this.sourceComment = sourceComment; this.lastUpdateTime = lastUpdateTime; this.orderNum = orderNum; @@ -106,6 +108,7 @@ public class BookSource implements Parcelable, Cloneable { sourceGroup = in.readString(); sourceCharset = in.readString(); sourceType = in.readString(); + sourceHeaders = in.readString(); sourceComment = in.readString(); if (in.readByte() == 0) { lastUpdateTime = null; @@ -130,6 +133,7 @@ public class BookSource implements Parcelable, Cloneable { dest.writeString(sourceGroup); dest.writeString(sourceCharset); dest.writeString(sourceType); + dest.writeString(sourceHeaders); dest.writeString(sourceComment); if (lastUpdateTime == null) { dest.writeByte((byte) 0); @@ -176,6 +180,7 @@ public class BookSource implements Parcelable, Cloneable { stringEquals(sourceGroup, source.sourceGroup) && stringEquals(sourceCharset, source.sourceCharset) && stringEquals(sourceType, source.sourceType) && + stringEquals(sourceHeaders, source.sourceHeaders) && stringEquals(sourceComment, source.sourceComment) && Objects.equals(searchRule, source.searchRule) && Objects.equals(infoRule, source.infoRule) && @@ -370,4 +375,12 @@ public class BookSource implements Parcelable, Cloneable { public void setSourceType(String sourceType) { this.sourceType = sourceType; } + + public String getSourceHeaders() { + return this.sourceHeaders; + } + + public void setSourceHeaders(String sourceHeaders) { + this.sourceHeaders = sourceHeaders; + } } diff --git a/app/src/main/java/xyz/fycz/myreader/ui/activity/SourceDebugActivity.java b/app/src/main/java/xyz/fycz/myreader/ui/activity/SourceDebugActivity.java index a622b15..b43ba9a 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/activity/SourceDebugActivity.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/activity/SourceDebugActivity.java @@ -158,9 +158,9 @@ public class SourceDebugActivity extends BaseActivity { String body = urlInfo[1]; MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded"); RequestBody requestBody = RequestBody.create(mediaType, body); - debugEntity.setHtml(OkHttpUtils.getHtml(url, requestBody, rc.getCharset())); + debugEntity.setHtml(OkHttpUtils.getHtml(url, requestBody, rc.getCharset(), rc.getHeaders())); } else { - debugEntity.setHtml(OkHttpUtils.getHtml(NetworkUtils.getAbsoluteURL(rc.getNameSpace(), url), rc.getCharset())); + debugEntity.setHtml(OkHttpUtils.getHtml(NetworkUtils.getAbsoluteURL(rc.getNameSpace(), url), rc.getCharset(), rc.getHeaders())); } ListResult listResult = new ListResult(); switch (debugEntity.getDebugMode()) { diff --git a/app/src/main/java/xyz/fycz/myreader/ui/dialog/DialogCreator.java b/app/src/main/java/xyz/fycz/myreader/ui/dialog/DialogCreator.java index f44b19e..3eb605c 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/dialog/DialogCreator.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/dialog/DialogCreator.java @@ -5,20 +5,20 @@ import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.view.View; -import android.widget.*; +import android.widget.SeekBar; +import android.widget.TextView; import androidx.appcompat.app.AlertDialog; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; + import xyz.fycz.myreader.R; import xyz.fycz.myreader.application.App; -import xyz.fycz.myreader.enums.ReadStyle; import xyz.fycz.myreader.util.IOUtils; import xyz.fycz.myreader.util.StringHelper; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; - public class DialogCreator { /** @@ -280,32 +280,6 @@ public class DialogCreator { void onClick(Dialog dialog, View view); } - /** - * 白天黑夜切换监听 - */ - public interface OnClickNightAndDayListener { - void onClick(Dialog dialog, View view, boolean isDayStyle); - } - - /** - * 阅读style切换监听器 - */ - public interface OnReadStyleChangeListener { - void onChange(ReadStyle readStyle); - } - - public interface OnBrightFollowSystemChangeListener { - void onChange(boolean isFollowSystem); - } - - public interface OnClickDownloadAllChapterListener { - void onClick(Dialog dialog, View view,TextView tvDownloadProgress); - } - - public interface OnPageModeChangeListener { - void onChange(TextView tvPageMode); - } - public interface OnSkipChapterListener{ void onClick(TextView chapterTitle, TextView chapterUrl, SeekBar sbReadChapterProgress); } diff --git a/app/src/main/java/xyz/fycz/myreader/ui/fragment/FindFragment.java b/app/src/main/java/xyz/fycz/myreader/ui/fragment/FindFragment.java index eb696b0..037d9b9 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/fragment/FindFragment.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/fragment/FindFragment.java @@ -10,12 +10,10 @@ import xyz.fycz.myreader.common.APPCONST; import xyz.fycz.myreader.databinding.FragmentFindBinding; import xyz.fycz.myreader.ui.activity.BookstoreActivity; import xyz.fycz.myreader.webapi.crawler.base.FindCrawler; +import xyz.fycz.myreader.webapi.crawler.find.Ben100FindCrawler; +import xyz.fycz.myreader.webapi.crawler.find.MiaoBiFindCrawler; +import xyz.fycz.myreader.webapi.crawler.find.QB5FindCrawler; import xyz.fycz.myreader.webapi.crawler.find.QiDianMobileRank; -import xyz.fycz.myreader.webapi.crawler.find.XS7Rank; -import xyz.fycz.myreader.webapi.crawler.read.Ben100ReadCrawler; -import xyz.fycz.myreader.webapi.crawler.read.MiaoBiReadCrawler; -import xyz.fycz.myreader.webapi.crawler.read.QB5ReadCrawler; -import xyz.fycz.myreader.webapi.crawler.read.XS7ReadCrawler; /** * @author fengyue @@ -39,9 +37,9 @@ public class FindFragment extends BaseFragment { //binding.findRlXs7Top.setOnClickListener(v -> comeToBookstore(new XS7Rank())); binding.findRlQidianSort.setOnClickListener(v -> comeToBookstore(new QiDianMobileRank(false, true))); binding.findRlQidianNsSort.setOnClickListener(v -> comeToBookstore(new QiDianMobileRank(true, true))); - binding.findRlQb5Store.setOnClickListener(v -> comeToBookstore(new QB5ReadCrawler())); - binding.findRlBen100Store.setOnClickListener(v -> comeToBookstore(new Ben100ReadCrawler())); - binding.findRlMiaoquStore.setOnClickListener(v -> comeToBookstore(new MiaoBiReadCrawler())); + binding.findRlQb5Store.setOnClickListener(v -> comeToBookstore(new QB5FindCrawler())); + binding.findRlBen100Store.setOnClickListener(v -> comeToBookstore(new Ben100FindCrawler())); + binding.findRlMiaoquStore.setOnClickListener(v -> comeToBookstore(new MiaoBiFindCrawler())); //binding.findRlXs7Store.setOnClickListener(v -> comeToBookstore(new XS7ReadCrawler())); } diff --git a/app/src/main/java/xyz/fycz/myreader/util/utils/OkHttpUtils.java b/app/src/main/java/xyz/fycz/myreader/util/utils/OkHttpUtils.java index e0964c7..ea4c648 100644 --- a/app/src/main/java/xyz/fycz/myreader/util/utils/OkHttpUtils.java +++ b/app/src/main/java/xyz/fycz/myreader/util/utils/OkHttpUtils.java @@ -52,6 +52,10 @@ public class OkHttpUtils { return getHtml(url, null, encodeType); } + public static String getHtml(String url, String encodeType, Map headers) throws IOException { + return getHtml(url, null, encodeType, headers); + } + public static String getHtml(String url, RequestBody requestBody, String encodeType) throws IOException { return getHtml(url, requestBody, encodeType, null); } diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/CommonApi.java b/app/src/main/java/xyz/fycz/myreader/webapi/CommonApi.java index adde330..01eafdf 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/CommonApi.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/CommonApi.java @@ -32,7 +32,7 @@ public class CommonApi { url = NetworkUtils.getAbsoluteURL(rc.getNameSpace(), url); String finalUrl = url; return Observable.create(emitter -> { - emitter.onNext(rc.getChaptersFromHtml(OkHttpUtils.getHtml(finalUrl, charset))); + emitter.onNext(rc.getChaptersFromHtml(OkHttpUtils.getHtml(finalUrl, charset, rc.getHeaders()))); emitter.onComplete(); }); } @@ -48,7 +48,7 @@ public class CommonApi { url = NetworkUtils.getAbsoluteURL(rc.getNameSpace(), url); String finalUrl = url; return Observable.create(emitter -> { - emitter.onNext(rc.getContentFormHtml(OkHttpUtils.getHtml(finalUrl, charset))); + emitter.onNext(rc.getContentFormHtml(OkHttpUtils.getHtml(finalUrl, charset, rc.getHeaders()))); emitter.onComplete(); }); } @@ -84,20 +84,9 @@ public class CommonApi { String body = makeSearchUrl(urlInfo[1], key); MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded"); RequestBody requestBody = RequestBody.create(mediaType, body); - if (rc.getNameSpace().contains("soxs.cc") || - rc.getNameSpace().contains("xinshuhaige.org") || - rc.getNameSpace().contains("bxwxorg.com") || - rc.getNameSpace().contains("soshuw.com")) { - String cookie = "Hm_lvt_46329db612a10d9ae3a668a40c152e0e=1612793811,1612795781,1613200980,1613218588; " - + "__cfduid=d0ebd0275436b7b0c3ccf4c9eb7394abd1619231977 "; - Map headers = new HashMap<>(); - headers.put("Cookie", cookie); - emitter.onNext(rc.getBooksFromSearchHtml(OkHttpUtils.getHtml(url, requestBody, finalCharset, headers))); - } else { - emitter.onNext(rc.getBooksFromSearchHtml(OkHttpUtils.getHtml(url, requestBody, finalCharset))); - } + emitter.onNext(rc.getBooksFromSearchHtml(OkHttpUtils.getHtml(url, requestBody, finalCharset, rc.getHeaders()))); } else { - emitter.onNext(rc.getBooksFromSearchHtml(OkHttpUtils.getHtml(makeSearchUrl(rc.getSearchLink(), key), finalCharset))); + emitter.onNext(rc.getBooksFromSearchHtml(OkHttpUtils.getHtml(makeSearchUrl(rc.getSearchLink(), key), finalCharset, rc.getHeaders()))); } } catch (Exception e) { e.printStackTrace(); @@ -126,7 +115,8 @@ public class CommonApi { url = NetworkUtils.getAbsoluteURL(bic.getNameSpace(), url); String finalUrl = url; return Observable.create(emitter -> { - emitter.onNext(bic.getBookInfo(OkHttpUtils.getHtml(finalUrl, bic.getCharset()), book)); + emitter.onNext(bic.getBookInfo(OkHttpUtils.getHtml(finalUrl, bic.getCharset(), + ((ReadCrawler) bic).getHeaders()), book)); emitter.onComplete(); }); } diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/base/BaseLocalCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/base/BaseLocalCrawler.java new file mode 100644 index 0000000..9a4cf4d --- /dev/null +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/base/BaseLocalCrawler.java @@ -0,0 +1,14 @@ +package xyz.fycz.myreader.webapi.crawler.base; + +import java.util.Map; + +/** + * @author fengyue + * @date 2021/5/13 22:29 + */ +public abstract class BaseLocalCrawler implements ReadCrawler { + @Override + public Map getHeaders() { + return null; + } +} diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/base/BaseSourceCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/base/BaseSourceCrawler.java index 40ef69c..951f17c 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/base/BaseSourceCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/base/BaseSourceCrawler.java @@ -2,9 +2,15 @@ package xyz.fycz.myreader.webapi.crawler.base; import android.text.TextUtils; +import org.json.JSONException; +import org.json.JSONObject; + import java.io.IOException; import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; import java.util.List; +import java.util.Map; import xyz.fycz.myreader.entity.SearchBookBean; import xyz.fycz.myreader.greendao.entity.Book; @@ -339,6 +345,26 @@ public abstract class BaseSourceCrawler implements ReadCrawler, BookInfoCrawler return book; } + @Override + public Map getHeaders() { + if (!StringUtils.isJsonObject(source.getSourceHeaders())) + return null; + try { + JSONObject headersJson = new JSONObject(source.getSourceHeaders()); + Map headers = new HashMap<>(); + Iterator it = headersJson.keys(); + while (it.hasNext()){ + String key = it.next(); + String value = String.valueOf(headersJson.get(key)); + headers.put(key, value); + } + return headers; + } catch (JSONException e) { + e.printStackTrace(); + } + return null; + } + /** * 从列表中获取单个书籍/章节对象 * diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/base/BaseSourceCrawlerNoInfo.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/base/BaseSourceCrawlerNoInfo.java index 2848b07..797d421 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/base/BaseSourceCrawlerNoInfo.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/base/BaseSourceCrawlerNoInfo.java @@ -1,6 +1,7 @@ package xyz.fycz.myreader.webapi.crawler.base; import java.util.ArrayList; +import java.util.Map; import xyz.fycz.myreader.entity.SearchBookBean; import xyz.fycz.myreader.greendao.entity.Book; @@ -58,4 +59,9 @@ public class BaseSourceCrawlerNoInfo implements ReadCrawler { public String getContentFormHtml(String html) { return crawler.getContentFormHtml(html); } + + @Override + public Map getHeaders() { + return crawler.getHeaders(); + } } diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/base/ReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/base/ReadCrawler.java index 7df7a12..5a457b5 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/base/ReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/base/ReadCrawler.java @@ -6,6 +6,7 @@ import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; import java.util.ArrayList; +import java.util.Map; /** * @author fengyue @@ -18,6 +19,7 @@ public interface ReadCrawler { String getSearchCharset(); // 书源搜索关键字的字符编码,和书源的字符编码就行 String getNameSpace(); // 书源主页地址 Boolean isPost(); // 是否以post请求搜索 + Map getHeaders();// 自定义请求头,可添加cookie等 ConcurrentMultiValueMap getBooksFromSearchHtml(String html); // 搜索书籍规则 ArrayList getChaptersFromHtml(String html); // 获取书籍章节列表规则 String getContentFormHtml(String html); // 获取书籍内容规则 diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/find/Ben100FindCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/find/Ben100FindCrawler.java new file mode 100644 index 0000000..573d482 --- /dev/null +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/find/Ben100FindCrawler.java @@ -0,0 +1,179 @@ +package xyz.fycz.myreader.webapi.crawler.find; + +import android.text.Html; + +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; +import org.jsoup.nodes.Element; +import org.jsoup.select.Elements; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; + +import xyz.fycz.myreader.entity.SearchBookBean; +import xyz.fycz.myreader.entity.bookstore.BookType; +import xyz.fycz.myreader.enums.LocalBookSource; +import xyz.fycz.myreader.greendao.entity.Book; +import xyz.fycz.myreader.greendao.entity.Chapter; +import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; +import xyz.fycz.myreader.webapi.crawler.base.BookInfoCrawler; +import xyz.fycz.myreader.webapi.crawler.base.FindCrawler; +import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; + +@Deprecated +public class Ben100FindCrawler extends FindCrawler { + public static final String NAME_SPACE = "https://www.100ben.net"; + public static final String CHARSET = "UTF-8"; + public static final String SEARCH_CHARSET = "utf-8"; + public static final String FIND_NAME = "书城[100本书·实体]"; + private LinkedHashMap mBookTypes = new LinkedHashMap<>(); + + @Override + public String getCharset() { + return CHARSET; + } + + @Override + public String getFindName() { + return FIND_NAME; + } + + @Override + public String getFindUrl() { + return NAME_SPACE; + } + + @Override + public boolean hasImg() { + return true; + } + + @Override + public boolean needSearch() { + return false; + } + + /** + * 获取书籍详细信息 + * + * @param book + */ + public Book getBookInfo(String html, Book book) { + Document doc = Jsoup.parse(html); + Element img = doc.getElementById("fmimg"); + book.setImgUrl(img.getElementsByTag("img").get(0).attr("src")); + Element desc = doc.getElementById("intro"); + book.setDesc(desc.getElementsByTag("p").get(0).text()); + Element type = doc.getElementsByClass("con_top").get(0); + book.setType(type.getElementsByTag("a").get(2).text()); + return book; + } + + + @Override + public List getBookTypes(String html) { + List bookTypes = new ArrayList<>(); + Document doc = Jsoup.parse(html); + Element menu = doc.getElementsByClass("menu").first(); + for (Element a : menu.children()) { + String name = a.text(); + String url = a.attr("href"); + if ("首页".equals(name)) { + name = "100本书"; + } else if (name.contains("全部小说")) { + name = "全部小说"; + } + BookType bookType = new BookType(); + bookType.setTypeName(name); + bookType.setUrl(url); + bookTypes.add(bookType); + System.out.println("bookTypes.put(\"" + bookType.getTypeName() + "\", \"" + bookType.getUrl() + "\");"); + } + return bookTypes; + } + + @Override + public List getBookTypes() { + initBookTypes(); + List bookTypes = new ArrayList<>(); + for (String name : mBookTypes.keySet()) { + BookType bookType = new BookType(); + bookType.setTypeName(name); + bookType.setUrl(mBookTypes.get(name)); + bookTypes.add(bookType); + } + return bookTypes; + } + + private void initBookTypes() { + mBookTypes.put("世界名著", "https://www.100ben.net/shijiemingzhu/"); + mBookTypes.put("现代文学", "https://www.100ben.net/xiandaiwenxue/"); + mBookTypes.put("外国小说", "https://www.100ben.net/waiguoxiaoshuo/"); + mBookTypes.put("励志书籍", "https://www.100ben.net/lizhishuji/"); + mBookTypes.put("古典文学", "https://www.100ben.net/gudianwenxue/"); + mBookTypes.put("武侠小说", "https://www.100ben.net/wuxiaxiaoshuo/"); + mBookTypes.put("言情小说", "https://www.100ben.net/yanqingxiaoshuo/"); + mBookTypes.put("推理小说", "https://www.100ben.net/tuilixiaoshuo/"); + mBookTypes.put("科幻小说", "https://www.100ben.net/kehuanxiaoshuo/"); + mBookTypes.put("人物传记", "https://www.100ben.net/renwuzhuanji/"); + mBookTypes.put("盗墓悬疑", "https://www.100ben.net/daomuxuanyi/"); + mBookTypes.put("玄幻穿越", "https://www.100ben.net/xuanhuanchuanyue/"); + mBookTypes.put("科普书籍", "https://www.100ben.net/kepushuji/"); + mBookTypes.put("100本书", "https://www.100ben.net/"); + mBookTypes.put("全部小说", "https://www.100ben.net/all/"); + } + + @Override + public List getFindBooks(String html, BookType bookType) { + List books = new ArrayList<>(); + Document doc = Jsoup.parse(html); + + try { + Element pageDiv = doc.getElementsByClass("page").first(); + String page = pageDiv.getElementsByTag("a").last().text(); + String pageStr = page.replace("末页(", "").replace(")", ""); + bookType.setPageSize(Integer.parseInt(pageStr)); + } catch (Exception ignored) { + } + + Elements divs = doc.getElementsByClass("recommand"); + Element div = divs.get(0); + Elements elementsByTag = div.getElementsByTag("li"); + for (Element element : elementsByTag) { + Book book = new Book(); + String name = element.getElementsByClass("titles").first().getElementsByTag("a").first().text(); + book.setName(name); + String author = element.getElementsByClass("author").first().text().replace("作者:", ""); + book.setAuthor(author); + String imgUrl = element.getElementsByTag("img").first().attr("src"); + book.setImgUrl(imgUrl); + String chapterUrl = element.getElementsByClass("titles").first().getElementsByTag("a").first().attr("href"); + book.setChapterUrl(chapterUrl); + String desc = element.getElementsByClass("intro").first().text(); + book.setDesc(desc); + book.setNewestChapterTitle(""); + book.setType(bookType.getTypeName()); + book.setSource(LocalBookSource.ben100.toString()); + books.add(book); + } + return books; + } + + @Override + public boolean getTypePage(BookType curType, int page) { + if (curType.getPageSize() <= 0) { + curType.setPageSize(1); + } + if (page > curType.getPageSize()) { + return true; + } + if (curType.getTypeName().equals("100本书")) return false; + if (curType.getUrl().contains("list")) { + curType.setUrl(curType.getUrl().substring(0, curType.getUrl().lastIndexOf("_") + 1) + page + ".html"); + } else { + curType.setUrl(curType.getUrl() + "list_" + page + ".html"); + } + return false; + } +} diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/find/MiaoBiFindCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/find/MiaoBiFindCrawler.java new file mode 100644 index 0000000..bb9cd24 --- /dev/null +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/find/MiaoBiFindCrawler.java @@ -0,0 +1,119 @@ +package xyz.fycz.myreader.webapi.crawler.find; + +import android.text.Html; + +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; +import org.jsoup.nodes.Element; +import org.jsoup.select.Elements; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; + +import xyz.fycz.myreader.entity.SearchBookBean; +import xyz.fycz.myreader.entity.bookstore.BookType; +import xyz.fycz.myreader.enums.LocalBookSource; +import xyz.fycz.myreader.greendao.entity.Book; +import xyz.fycz.myreader.greendao.entity.Chapter; +import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; +import xyz.fycz.myreader.webapi.crawler.base.FindCrawler; +import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; + + +public class MiaoBiFindCrawler extends FindCrawler { + public static final String NAME_SPACE = "https://www.imiaobige.com"; + public static final String CHARSET = "UTF-8"; + public static final String SEARCH_CHARSET = "UTF-8"; + public static final String FIND_NAME = "书城[妙笔阁]"; + private final LinkedHashMap mBookTypes = new LinkedHashMap<>(); + + @Override + public String getCharset() { + return CHARSET; + } + + @Override + public String getFindName() { + return FIND_NAME; + } + + @Override + public String getFindUrl() { + return NAME_SPACE; + } + + @Override + public boolean hasImg() { + return true; + } + + @Override + public boolean needSearch() { + return false; + } + + @Override + public List getBookTypes() { + initBookTypes(); + List bookTypes = new ArrayList<>(); + for (String name : mBookTypes.keySet()) { + BookType bookType = new BookType(); + bookType.setTypeName(name); + bookType.setUrl(mBookTypes.get(name)); + bookType.setPageSize(100); + bookTypes.add(bookType); + } + return bookTypes; + } + + private void initBookTypes() { + mBookTypes.put("玄幻奇幻", "https://www.imiaobige.com/xuanhuan/1.html"); + mBookTypes.put("武侠仙侠", "https://www.imiaobige.com/wuxia/1.html"); + mBookTypes.put("都市生活", "https://www.imiaobige.com/dushi/1.html"); + mBookTypes.put("历史军事", "https://www.imiaobige.com/lishi/1.html"); + mBookTypes.put("游戏竞技", "https://www.imiaobige.com/youxi/1.html"); + mBookTypes.put("科幻未来", "https://www.imiaobige.com/kehuan/1.html"); + } + + /* +
+
重生之我变成了火星
+
20-11-26 16:57

重生之我变成了火星

+
作者:仰望黑夜状态:连载中
+
重生成了火星?第一阶段科技进化,第二阶段高魔进化,第三阶段超魔进化!宇宙之间除了人类还有无数可怕存在,让我带领人类征服宇宙,我们的目标是星辰大海~
+
最新章节:第三百一十六章 时空道兵
+
+ */ + @Override + public List getFindBooks(String html, BookType bookType) { + List books = new ArrayList<>(); + Document doc = Jsoup.parse(html); + Element div = doc.getElementById("sitebox"); + Elements dls = div.getElementsByTag("dl"); + for (Element dl : dls) { + Book book = new Book(); + Elements as = dl.getElementsByTag("a"); + book.setName(as.get(1).text()); + book.setAuthor(as.get(2).text()); + book.setType(bookType.getTypeName()); + book.setNewestChapterTitle(as.get(3).text()); + book.setDesc(dl.getElementsByClass("book_des").first().text()); + book.setImgUrl(as.first().getElementsByTag("img").attr("src")); + book.setChapterUrl(as.get(1).attr("href").replace("novel", "read").replace(".html", "/")); + book.setUpdateDate(dl.getElementsByClass("uptime").first().text()); + book.setSource(LocalBookSource.miaobi.toString()); + books.add(book); + } + return books; + } + + @Override + public boolean getTypePage(BookType curType, int page) { + if (page > curType.getPageSize()) { + return true; + } + curType.setUrl(curType.getUrl().substring(0, curType.getUrl().lastIndexOf("/") + 1) + page + ".html"); + return false; + } +} diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/find/QB5FindCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/find/QB5FindCrawler.java new file mode 100644 index 0000000..bdd846b --- /dev/null +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/find/QB5FindCrawler.java @@ -0,0 +1,158 @@ +package xyz.fycz.myreader.webapi.crawler.find; + +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; +import org.jsoup.nodes.Element; +import org.jsoup.select.Elements; + +import java.util.ArrayList; +import java.util.List; + +import xyz.fycz.myreader.entity.bookstore.BookType; +import xyz.fycz.myreader.enums.LocalBookSource; +import xyz.fycz.myreader.greendao.entity.Book; +import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.webapi.crawler.base.FindCrawler; + + +public class QB5FindCrawler extends FindCrawler { + public static final String FIND_URL = "https://www.qb50.com"; + public static final String FIND_NAME = "书城[全本小说]"; + private static final String CHARSET = "GBK"; + + @Override + public String getCharset() { + return CHARSET; + } + + @Override + public String getFindName() { + return FIND_NAME; + } + + @Override + public String getFindUrl() { + return FIND_URL; + } + + @Override + public boolean hasImg() { + return false; + } + + @Override + public boolean needSearch() { + return false; + } + + /** + * 获取书城小说分类列表 + * + * @param html + * @return + */ + public List getBookTypes(String html) { + List bookTypes = new ArrayList<>(); + Document doc = Jsoup.parse(html); + Elements divs = doc.getElementsByClass("nav_cont"); + if (divs.size() > 0) { + Elements uls = divs.get(0).getElementsByTag("ul"); + if (uls.size() > 0) { + for (Element li : uls.get(0).children()) { + Element a = li.child(0); + BookType bookType = new BookType(); + bookType.setTypeName(a.attr("title")); + bookType.setUrl(a.attr("href")); + if (bookType.getTypeName().contains("首页") || bookType.getTypeName().contains("热门小说")) + continue; + if (!StringHelper.isEmpty(bookType.getTypeName())) { + bookTypes.add(bookType); + } + } + } + + } + return bookTypes; + } + + /** + * 获取某一分类小说排行榜列表 + * + * @param html + * @return + */ + public List getBookRankList(String html) { + List books = new ArrayList<>(); + Document doc = Jsoup.parse(html); + Elements divs = doc.getElementsByClass("r"); + if (divs.size() > 0) { + Elements uls = divs.get(0).getElementsByTag("ul"); + if (uls.size() > 0) { + for (Element li : uls.get(0).children()) { + Book book = new Book(); + Element scanS1 = li.getElementsByClass("s1").get(0); + Element scanS2 = li.getElementsByClass("s2").get(0); + Element scanS5 = li.getElementsByClass("s5").get(0); + book.setType(scanS1.html().replace("[", "").replace("]", "")); + Element a = scanS2.getElementsByTag("a").get(0); + book.setName(a.attr("title")); + book.setChapterUrl(a.attr("href")); + book.setAuthor(scanS5.html()); + book.setSource(LocalBookSource.biquge.toString()); + books.add(book); + } + } + } + + return books; + } + + public List getFindBooks(String html, BookType bookType) { + List books = new ArrayList<>(); + Document doc = Jsoup.parse(html); + try { + int pageSize = Integer.parseInt(doc.getElementsByClass("last").first().text()); + bookType.setPageSize(pageSize); + } catch (Exception ignored) { + } + String type = doc.select("meta[name=keywords]").attr("content").replace(",全本小说网", ""); + Element div = doc.getElementById("tlist"); + Elements uls = div.getElementsByTag("ul"); + if (uls.size() > 0) { + for (Element li : uls.get(0).children()) { + Book book = new Book(); + Element aName = li.getElementsByClass("name").get(0); + Element divZz = li.getElementsByClass("zz").get(0); + Element divAuthor = li.getElementsByClass("author").get(0); + Element divSj = li.getElementsByClass("sj").get(0); + book.setType(type); + book.setName(aName.attr("title")); + book.setChapterUrl(aName.attr("href")); + book.setNewestChapterTitle(divZz.text()); + book.setAuthor(divAuthor.text()); + book.setUpdateDate(divSj.text()); + book.setSource(LocalBookSource.qb5.toString()); + books.add(book); + } + } + + return books; + + } + + public boolean getTypePage(BookType curType, int page) { + if (curType.getPageSize() <= 0) { + curType.setPageSize(10); + } + if (page > curType.getPageSize()) { + return true; + } + if (!curType.getTypeName().equals("完本小说")) { + curType.setUrl(curType.getUrl().substring(0, curType.getUrl().lastIndexOf("_") + 1) + page + "/"); + } else { + curType.setUrl(curType.getUrl().substring(0, curType.getUrl().lastIndexOf("/") + 1) + page); + } + return false; + } + +} diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/find/XS7FindCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/find/XS7FindCrawler.java new file mode 100644 index 0000000..1097bb7 --- /dev/null +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/find/XS7FindCrawler.java @@ -0,0 +1,123 @@ +package xyz.fycz.myreader.webapi.crawler.find; + +import android.text.Html; + +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; +import org.jsoup.nodes.Element; +import org.jsoup.select.Elements; + +import java.util.ArrayList; +import java.util.List; + +import xyz.fycz.myreader.entity.SearchBookBean; +import xyz.fycz.myreader.entity.bookstore.BookType; +import xyz.fycz.myreader.enums.LocalBookSource; +import xyz.fycz.myreader.greendao.entity.Book; +import xyz.fycz.myreader.greendao.entity.Chapter; +import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; +import xyz.fycz.myreader.webapi.crawler.base.FindCrawler; +import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; + + +public class XS7FindCrawler extends FindCrawler{ + public static final String NAME_SPACE = "https://www.xs7.la"; + public static final String CHARSET = "GBK"; + public static final String SEARCH_CHARSET = "GBK"; + public static final String FIND_NAME = "书城[小说旗]"; + + @Override + public String getCharset() { + return CHARSET; + } + + @Override + public String getFindName() { + return FIND_NAME; + } + + @Override + public String getFindUrl() { + return NAME_SPACE; + } + + @Override + public boolean hasImg() { + return true; + } + + @Override + public boolean needSearch() { + return false; + } + + @Override + public List getBookTypes(String html) { + List bookTypes = new ArrayList<>(); + Document doc = Jsoup.parse(html); + Element div = doc.getElementsByClass("subnav-hot").first(); + Elements as = div.getElementsByTag("a"); + for (Element a : as) { + BookType bookType = new BookType(); + bookType.setUrl(a.attr("href")); + bookType.setTypeName(a.text()); + bookTypes.add(bookType); + } + return bookTypes; + } + + /* +
+
带着农场混异界
+
+
+

带着农场混异界

+ 作者:明宇 +
+ +
他横任他横,我自种我田,若要来惹我,过不了明年。 + 宅男赵海带着QQ农场穿越到了异界,附身到了一个落迫的小贵族身上,他的封地是一片种不出东西的黑土地,而最主要的是,...
+ +
+
+ */ + @Override + public List getFindBooks(String html, BookType bookType) { + List books = new ArrayList<>(); + Document doc = Jsoup.parse(html); + Element last = doc.getElementsByClass("last").first(); + bookType.setPageSize(Integer.parseInt(last.text())); + Element div = doc.getElementById("alist"); + Elements bDivs = div.select("div[id=alistbox]"); + for (Element bDiv : bDivs) { + Book book = new Book(); + Element title = bDiv.getElementsByClass("title").first(); + Element sys = bDiv.getElementsByClass("sys").first(); + Element intro = bDiv.getElementsByClass("intro").first(); + book.setName(title.getElementsByTag("a").first().text()); + book.setAuthor(title.getElementsByTag("span").first().text().replace("作者:", "")); + book.setNewestChapterTitle(sys.getElementsByTag("a").first().text()); + book.setImgUrl(bDiv.getElementsByTag("img").attr("src")); + book.setDesc(intro.text()); + book.setType(bookType.getTypeName()); + book.setChapterUrl(title.getElementsByTag("a").first().attr("href")); + book.setSource(LocalBookSource.xs7.toString()); + books.add(book); + } + return books; + } + + @Override + public boolean getTypePage(BookType curType, int page) { + if (page != 1 && page > curType.getPageSize()) { + return true; + } + curType.setUrl(curType.getUrl().substring(0, curType.getUrl().lastIndexOf("_") + 1) + page + ".html"); + return false; + } +} diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/find/XS7Rank.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/find/XS7Rank.java index c602765..869c533 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/find/XS7Rank.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/find/XS7Rank.java @@ -20,7 +20,7 @@ import xyz.fycz.myreader.webapi.crawler.read.XS7ReadCrawler; */ @Deprecated public class XS7Rank extends FindCrawler { - private FindCrawler xs7 = new XS7ReadCrawler(); + private FindCrawler xs7 = new XS7FindCrawler(); public static final String CHARSET = "GBK"; public static final String FIND_NAME = "排行榜[小说旗]"; public static final String FIND_URL = "https://www.xs7.la/top/lastupdate/1.html"; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/Ben100ReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/Ben100ReadCrawler.java index 145d20a..5ddc439 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/Ben100ReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/Ben100ReadCrawler.java @@ -13,6 +13,7 @@ import xyz.fycz.myreader.enums.LocalBookSource; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.BookInfoCrawler; import xyz.fycz.myreader.webapi.crawler.base.FindCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; @@ -22,14 +23,11 @@ import java.util.LinkedHashMap; import java.util.List; @Deprecated -public class Ben100ReadCrawler extends FindCrawler implements ReadCrawler, BookInfoCrawler { +public class Ben100ReadCrawler extends BaseLocalCrawler implements BookInfoCrawler { public static final String NAME_SPACE = "https://www.100ben.net"; public static final String NOVEL_SEARCH = "https://www.100ben.net/plus/search.php?keyword={key}"; public static final String CHARSET = "UTF-8"; public static final String SEARCH_CHARSET = "utf-8"; - public static final String FIND_NAME = "书城[100本书·实体]"; - private LinkedHashMap mBookTypes = new LinkedHashMap<>(); - @Override public String getSearchLink() { @@ -41,26 +39,6 @@ public class Ben100ReadCrawler extends FindCrawler implements ReadCrawler, BookI return CHARSET; } - @Override - public String getFindName() { - return FIND_NAME; - } - - @Override - public String getFindUrl() { - return NAME_SPACE; - } - - @Override - public boolean hasImg() { - return true; - } - - @Override - public boolean needSearch() { - return false; - } - @Override public String getNameSpace() { return NAME_SPACE; @@ -175,111 +153,4 @@ public class Ben100ReadCrawler extends FindCrawler implements ReadCrawler, BookI book.setType(type.getElementsByTag("a").get(2).text()); return book; } - - - @Override - public List getBookTypes(String html) { - List bookTypes = new ArrayList<>(); - Document doc = Jsoup.parse(html); - Element menu = doc.getElementsByClass("menu").first(); - for (Element a : menu.children()) { - String name = a.text(); - String url = a.attr("href"); - if ("首页".equals(name)) { - name = "100本书"; - } else if (name.contains("全部小说")) { - name = "全部小说"; - } - BookType bookType = new BookType(); - bookType.setTypeName(name); - bookType.setUrl(url); - bookTypes.add(bookType); - System.out.println("bookTypes.put(\"" + bookType.getTypeName() + "\", \"" + bookType.getUrl() + "\");"); - } - return bookTypes; - } - - @Override - public List getBookTypes() { - initBookTypes(); - List bookTypes = new ArrayList<>(); - for (String name : mBookTypes.keySet()) { - BookType bookType = new BookType(); - bookType.setTypeName(name); - bookType.setUrl(mBookTypes.get(name)); - bookTypes.add(bookType); - } - return bookTypes; - } - - private void initBookTypes() { - mBookTypes.put("世界名著", "https://www.100ben.net/shijiemingzhu/"); - mBookTypes.put("现代文学", "https://www.100ben.net/xiandaiwenxue/"); - mBookTypes.put("外国小说", "https://www.100ben.net/waiguoxiaoshuo/"); - mBookTypes.put("励志书籍", "https://www.100ben.net/lizhishuji/"); - mBookTypes.put("古典文学", "https://www.100ben.net/gudianwenxue/"); - mBookTypes.put("武侠小说", "https://www.100ben.net/wuxiaxiaoshuo/"); - mBookTypes.put("言情小说", "https://www.100ben.net/yanqingxiaoshuo/"); - mBookTypes.put("推理小说", "https://www.100ben.net/tuilixiaoshuo/"); - mBookTypes.put("科幻小说", "https://www.100ben.net/kehuanxiaoshuo/"); - mBookTypes.put("人物传记", "https://www.100ben.net/renwuzhuanji/"); - mBookTypes.put("盗墓悬疑", "https://www.100ben.net/daomuxuanyi/"); - mBookTypes.put("玄幻穿越", "https://www.100ben.net/xuanhuanchuanyue/"); - mBookTypes.put("科普书籍", "https://www.100ben.net/kepushuji/"); - mBookTypes.put("100本书", "https://www.100ben.net/"); - mBookTypes.put("全部小说", "https://www.100ben.net/all/"); - } - - @Override - public List getFindBooks(String html, BookType bookType) { - List books = new ArrayList<>(); - Document doc = Jsoup.parse(html); - - try { - Element pageDiv = doc.getElementsByClass("page").first(); - String page = pageDiv.getElementsByTag("a").last().text(); - String pageStr = page.replace("末页(", "").replace(")", ""); - bookType.setPageSize(Integer.parseInt(pageStr)); - } catch (Exception ignored) { - } - - Elements divs = doc.getElementsByClass("recommand"); - Element div = divs.get(0); - Elements elementsByTag = div.getElementsByTag("li"); - for (Element element : elementsByTag) { - Book book = new Book(); - String name = element.getElementsByClass("titles").first().getElementsByTag("a").first().text(); - book.setName(name); - String author = element.getElementsByClass("author").first().text().replace("作者:", ""); - book.setAuthor(author); - String imgUrl = element.getElementsByTag("img").first().attr("src"); - book.setImgUrl(imgUrl); - String chapterUrl = element.getElementsByClass("titles").first().getElementsByTag("a").first().attr("href"); - book.setChapterUrl(chapterUrl); - String desc = element.getElementsByClass("intro").first().text(); - book.setDesc(desc); - book.setNewestChapterTitle(""); - book.setType(bookType.getTypeName()); - book.setSource(LocalBookSource.ben100.toString()); - books.add(book); - } - return books; - } - - @Override - public boolean getTypePage(BookType curType, int page) { - if (curType.getPageSize() <= 0) { - curType.setPageSize(1); - } - if (page > curType.getPageSize()) { - return true; - } - if (curType.getTypeName().equals("100本书")) return false; - if (curType.getUrl().contains("list")) { - curType.setUrl(curType.getUrl().substring(0, curType.getUrl().lastIndexOf("_") + 1) + page + ".html"); - } else { - curType.setUrl(curType.getUrl() + "list_" + page + ".html"); - } - return false; - } } diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/BiJianReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/BiJianReadCrawler.java index 4413ef5..24c2916 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/BiJianReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/BiJianReadCrawler.java @@ -14,10 +14,11 @@ import xyz.fycz.myreader.enums.LocalBookSource; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; -public class BiJianReadCrawler implements ReadCrawler { +public class BiJianReadCrawler extends BaseLocalCrawler { public static final String NAME_SPACE = "http://www.bjcan.com"; public static final String NOVEL_SEARCH = "http://www.bjcan.com/home/search/index.html?keyword={key}"; public static final String CHARSET = "UTF-8"; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/BiQuGe44ReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/BiQuGe44ReadCrawler.java index 66484a4..59e7de5 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/BiQuGe44ReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/BiQuGe44ReadCrawler.java @@ -13,13 +13,14 @@ import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.BookInfoCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; import java.util.ArrayList; -public class BiQuGe44ReadCrawler implements ReadCrawler, BookInfoCrawler { +public class BiQuGe44ReadCrawler extends BaseLocalCrawler implements BookInfoCrawler { // public static final String NAME_SPACE = "http://www.wqge.net"; public static final String NAME_SPACE = "https://www.wqge.cc"; public static final String NOVEL_SEARCH = "https://www.wqge.cc/modules/article/search.php?searchkey={key}"; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/BiQuGeReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/BiQuGeReadCrawler.java index e5e62de..2187817 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/BiQuGeReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/BiQuGeReadCrawler.java @@ -12,6 +12,7 @@ import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.BookInfoCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; @@ -21,7 +22,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -public class BiQuGeReadCrawler implements ReadCrawler, BookInfoCrawler { +public class BiQuGeReadCrawler extends BaseLocalCrawler implements BookInfoCrawler { private static final String NAME_SPACE = "https://www.52bqg.net"; private static final String NOVEL_SEARCH = "https://www.52bqg.net/modules/article/search.php?searchkey={key}"; private static final String CHARSET = "GBK"; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/CansShu99ReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/CansShu99ReadCrawler.java index 4ce1766..3f5e1de 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/CansShu99ReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/CansShu99ReadCrawler.java @@ -12,12 +12,13 @@ import xyz.fycz.myreader.enums.LocalBookSource; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; import java.util.ArrayList; -public class CansShu99ReadCrawler implements ReadCrawler { +public class CansShu99ReadCrawler extends BaseLocalCrawler { public static final String NAME_SPACE = "http://www.99csw.com"; public static final String NOVEL_SEARCH = "http://www.99csw.com/book/search.php?type=all&keyword={key}"; public static final String CHARSET = "UTF-8"; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ChaoXingReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ChaoXingReadCrawler.java index 4280b8f..cf7808b 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ChaoXingReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ChaoXingReadCrawler.java @@ -13,12 +13,13 @@ import xyz.fycz.myreader.enums.LocalBookSource; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; import java.util.ArrayList; -public class ChaoXingReadCrawler implements ReadCrawler { +public class ChaoXingReadCrawler extends BaseLocalCrawler { public static final String NAME_SPACE = "http://yz4.chaoxing.com"; public static final String NOVEL_SEARCH = "http://yz4.chaoxing.com/circlemarket/getsearch,start=0&size=25&sw={key}&channelId=52"; public static final String CHAPTERS_URL = "https://special.zhexuezj.cn/mobile/mooc/tocourse/"; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ChuanQiReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ChuanQiReadCrawler.java index 8c5e044..6d00743 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ChuanQiReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ChuanQiReadCrawler.java @@ -15,10 +15,11 @@ import xyz.fycz.myreader.enums.LocalBookSource; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; @Deprecated -public class ChuanQiReadCrawler implements ReadCrawler { +public class ChuanQiReadCrawler extends BaseLocalCrawler { public static final String NAME_SPACE = "https://www.xs86.com"; public static final String NOVEL_SEARCH = "https://www.xs86.com/search.php?key={key}"; public static final String CHARSET = "UTF-8"; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/DSTQReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/DSTQReadCrawler.java index 58bbd1f..2c906aa 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/DSTQReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/DSTQReadCrawler.java @@ -14,10 +14,11 @@ import xyz.fycz.myreader.enums.LocalBookSource; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; -public class DSTQReadCrawler implements ReadCrawler { +public class DSTQReadCrawler extends BaseLocalCrawler { public static final String NAME_SPACE = "https://www.dstiejuan.com"; public static final String NOVEL_SEARCH = "https://www.dstiejuan.com/search.html,searchkey={key}"; public static final String CHARSET = "UTF-8"; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/Du1DuReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/Du1DuReadCrawler.java index 0c9945b..44deea9 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/Du1DuReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/Du1DuReadCrawler.java @@ -13,13 +13,14 @@ import xyz.fycz.myreader.enums.LocalBookSource; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.BookInfoCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; /** * 此小说源书籍详情页可添加推荐书籍,暂未开始做 */ -public class Du1DuReadCrawler implements ReadCrawler, BookInfoCrawler { +public class Du1DuReadCrawler extends BaseLocalCrawler implements BookInfoCrawler { public static final String NAME_SPACE = "http://du1du.org"; public static final String NOVEL_SEARCH = "http://du1du.org/search.htm?keyword={key}"; public static final String CHARSET = "GBK"; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/EWenXueReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/EWenXueReadCrawler.java index 4271315..7f57922 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/EWenXueReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/EWenXueReadCrawler.java @@ -15,11 +15,12 @@ import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.BookInfoCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; -public class EWenXueReadCrawler implements ReadCrawler, BookInfoCrawler { +public class EWenXueReadCrawler extends BaseLocalCrawler implements BookInfoCrawler { public static final String NAME_SPACE = "http://ewenxue.org"; public static final String NOVEL_SEARCH = "http://ewenxue.org/search.htm?keyword={key}"; public static final String CHARSET = "GBK"; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/FYReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/FYReadCrawler.java index fe328fe..5165470 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/FYReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/FYReadCrawler.java @@ -12,6 +12,7 @@ import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; import java.util.ArrayList; @@ -22,7 +23,7 @@ import java.util.regex.Pattern; * 风月小说网html解析工具 */ -public class FYReadCrawler implements ReadCrawler { +public class FYReadCrawler extends BaseLocalCrawler { public static final String NAME_SPACE = "https://novel.fycz.xyz"; public static final String NOVEL_SEARCH = "https://novel.fycz.xyz/search.html?keyword={key}"; public static final String CHARSET = "utf-8"; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/HongChenReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/HongChenReadCrawler.java index c998aba..3e8d70b 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/HongChenReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/HongChenReadCrawler.java @@ -15,10 +15,11 @@ import xyz.fycz.myreader.enums.LocalBookSource; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; -public class HongChenReadCrawler implements ReadCrawler { +public class HongChenReadCrawler extends BaseLocalCrawler { public static final String NAME_SPACE = "https://www.zuxs.net"; public static final String NOVEL_SEARCH = "https://www.zuxs.net/search.php?key={key}"; public static final String CHARSET = "gb2312"; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/JiuTaoReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/JiuTaoReadCrawler.java index 25a1050..0596e52 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/JiuTaoReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/JiuTaoReadCrawler.java @@ -12,12 +12,13 @@ import xyz.fycz.myreader.enums.LocalBookSource; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; import java.util.ArrayList; -public class JiuTaoReadCrawler implements ReadCrawler { +public class JiuTaoReadCrawler extends BaseLocalCrawler { public static final String NAME_SPACE = "https://www.9txs.org"; public static final String NOVEL_SEARCH = "https://so.9txs.org/www/,searchkey={key}"; public static final String CHARSET = "UTF-8"; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/LaoYaoReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/LaoYaoReadCrawler.java index 93c5cc9..45026fc 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/LaoYaoReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/LaoYaoReadCrawler.java @@ -15,10 +15,11 @@ import xyz.fycz.myreader.enums.LocalBookSource; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; @Deprecated -public class LaoYaoReadCrawler implements ReadCrawler { +public class LaoYaoReadCrawler extends BaseLocalCrawler { public static final String NAME_SPACE = "https://www.laoyao.org"; public static final String NOVEL_SEARCH = "https://www.laoyao.org/search.php?key={key}"; public static final String CHARSET = "UTF-8"; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/LiuLangCatReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/LiuLangCatReadCrawler.java index 9a16c9c..700f9bb 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/LiuLangCatReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/LiuLangCatReadCrawler.java @@ -16,13 +16,14 @@ import xyz.fycz.myreader.entity.SearchBookBean; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; /** * @author fengyue * @date 2020/11/27 14:09 */ -public class LiuLangCatReadCrawler implements ReadCrawler { +public class LiuLangCatReadCrawler extends BaseLocalCrawler { public static final String NAME_SPACE = "http://m.liulangcat.com"; public static final String NOVEL_SEARCH = "http://m.liulangcat.com/get/get_search_result.php?page=0&keyword={key}"; // public static final String NOVEL_SEARCH = "http://www.liulangcat.com/search.php?k={key}&submit=搜索&wgxojg=wc0yz&uwzgzw=yi1p7&amlmvy=mcp50&rybwbm=1s0y7"; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/LuoQiuReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/LuoQiuReadCrawler.java index 09eb61d..5f81d50 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/LuoQiuReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/LuoQiuReadCrawler.java @@ -15,11 +15,12 @@ import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.BookInfoCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; -public class LuoQiuReadCrawler implements ReadCrawler, BookInfoCrawler { +public class LuoQiuReadCrawler extends BaseLocalCrawler implements BookInfoCrawler { public static final String NAME_SPACE = "https://www.lqbook.com"; public static final String NOVEL_SEARCH = "https://www.lqbook.com/modules/article/search.php?searchkey={key}&submit=%CB%D1%CB%F7"; public static final String CHARSET = "GBK"; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/MiQuReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/MiQuReadCrawler.java index 2471626..8683e75 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/MiQuReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/MiQuReadCrawler.java @@ -12,13 +12,14 @@ import xyz.fycz.myreader.enums.LocalBookSource; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.BookInfoCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; import java.util.ArrayList; @Deprecated -public class MiQuReadCrawler implements ReadCrawler, BookInfoCrawler { +public class MiQuReadCrawler extends BaseLocalCrawler implements BookInfoCrawler { public static final String NAME_SPACE = "https://www.meegoq.com"; public static final String NOVEL_SEARCH = "https://www.meegoq.com/search.htm?keyword={key}"; public static final String CHARSET = "UTF-8"; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/MiaoBiReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/MiaoBiReadCrawler.java index 0f5e142..f305e17 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/MiaoBiReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/MiaoBiReadCrawler.java @@ -17,17 +17,16 @@ import xyz.fycz.myreader.enums.LocalBookSource; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.FindCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; -public class MiaoBiReadCrawler extends FindCrawler implements ReadCrawler { +public class MiaoBiReadCrawler extends BaseLocalCrawler { public static final String NAME_SPACE = "https://www.imiaobige.com"; public static final String NOVEL_SEARCH = "https://www.imiaobige.com/search.html,searchkey={key}"; public static final String CHARSET = "UTF-8"; public static final String SEARCH_CHARSET = "UTF-8"; - public static final String FIND_NAME = "书城[妙笔阁]"; - private final LinkedHashMap mBookTypes = new LinkedHashMap<>(); @Override public String getSearchLink() { @@ -39,26 +38,6 @@ public class MiaoBiReadCrawler extends FindCrawler implements ReadCrawler { return CHARSET; } - @Override - public String getFindName() { - return FIND_NAME; - } - - @Override - public String getFindUrl() { - return NAME_SPACE; - } - - @Override - public boolean hasImg() { - return true; - } - - @Override - public boolean needSearch() { - return false; - } - @Override public String getNameSpace() { return NAME_SPACE; @@ -147,67 +126,4 @@ public class MiaoBiReadCrawler extends FindCrawler implements ReadCrawler { return books; } - @Override - public List getBookTypes() { - initBookTypes(); - List bookTypes = new ArrayList<>(); - for (String name : mBookTypes.keySet()) { - BookType bookType = new BookType(); - bookType.setTypeName(name); - bookType.setUrl(mBookTypes.get(name)); - bookType.setPageSize(100); - bookTypes.add(bookType); - } - return bookTypes; - } - - private void initBookTypes() { - mBookTypes.put("玄幻奇幻", "https://www.imiaobige.com/xuanhuan/1.html"); - mBookTypes.put("武侠仙侠", "https://www.imiaobige.com/wuxia/1.html"); - mBookTypes.put("都市生活", "https://www.imiaobige.com/dushi/1.html"); - mBookTypes.put("历史军事", "https://www.imiaobige.com/lishi/1.html"); - mBookTypes.put("游戏竞技", "https://www.imiaobige.com/youxi/1.html"); - mBookTypes.put("科幻未来", "https://www.imiaobige.com/kehuan/1.html"); - } - - /* -
-
重生之我变成了火星
-
20-11-26 16:57

重生之我变成了火星

-
作者:仰望黑夜状态:连载中
-
重生成了火星?第一阶段科技进化,第二阶段高魔进化,第三阶段超魔进化!宇宙之间除了人类还有无数可怕存在,让我带领人类征服宇宙,我们的目标是星辰大海~
-
最新章节:第三百一十六章 时空道兵
-
- */ - @Override - public List getFindBooks(String html, BookType bookType) { - List books = new ArrayList<>(); - Document doc = Jsoup.parse(html); - Element div = doc.getElementById("sitebox"); - Elements dls = div.getElementsByTag("dl"); - for (Element dl : dls) { - Book book = new Book(); - Elements as = dl.getElementsByTag("a"); - book.setName(as.get(1).text()); - book.setAuthor(as.get(2).text()); - book.setType(bookType.getTypeName()); - book.setNewestChapterTitle(as.get(3).text()); - book.setDesc(dl.getElementsByClass("book_des").first().text()); - book.setImgUrl(as.first().getElementsByTag("img").attr("src")); - book.setChapterUrl(as.get(1).attr("href").replace("novel", "read").replace(".html", "/")); - book.setUpdateDate(dl.getElementsByClass("uptime").first().text()); - book.setSource(LocalBookSource.miaobi.toString()); - books.add(book); - } - return books; - } - - @Override - public boolean getTypePage(BookType curType, int page) { - if (page > curType.getPageSize()) { - return true; - } - curType.setUrl(curType.getUrl().substring(0, curType.getUrl().lastIndexOf("/") + 1) + page + ".html"); - return false; - } } diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/PiaoTianReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/PiaoTianReadCrawler.java index f2d12d9..be9ee01 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/PiaoTianReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/PiaoTianReadCrawler.java @@ -14,10 +14,11 @@ import xyz.fycz.myreader.enums.LocalBookSource; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.BookInfoCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; -public class PiaoTianReadCrawler implements ReadCrawler, BookInfoCrawler { +public class PiaoTianReadCrawler extends BaseLocalCrawler implements BookInfoCrawler { public static final String NAME_SPACE = "https://www.piaotian.org"; public static final String NOVEL_SEARCH = "https://www.piaotian.org/modules/article/search.php?searchkey={key}&submit=%CB%D1%CB%F7"; public static final String CHARSET = "GBK"; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/PinShuReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/PinShuReadCrawler.java index 33d183b..390a165 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/PinShuReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/PinShuReadCrawler.java @@ -12,6 +12,7 @@ import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.BookInfoCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; @@ -23,7 +24,7 @@ import java.util.ArrayList; * 已失效 */ @Deprecated -public class PinShuReadCrawler implements ReadCrawler, BookInfoCrawler { +public class PinShuReadCrawler extends BaseLocalCrawler implements BookInfoCrawler { public static final String NAME_SPACE = "https://www.vodtw.com"; public static final String NOVEL_SEARCH = "https://www.vodtw.com/Book/Search.aspx?SearchKey={key}&SearchClass=1"; public static final String CHARSET = "gbk"; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/PinShuReadCrawler2.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/PinShuReadCrawler2.java index 40666a3..e2de205 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/PinShuReadCrawler2.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/PinShuReadCrawler2.java @@ -12,6 +12,7 @@ import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.BookInfoCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; @@ -21,7 +22,7 @@ import java.util.ArrayList; * @author fengyue * @date 2020/5/19 19:50 */ -public class PinShuReadCrawler2 implements ReadCrawler, BookInfoCrawler { +public class PinShuReadCrawler2 extends BaseLocalCrawler implements BookInfoCrawler { public static final String NAME_SPACE = "https://www.vodtw.la"; public static final String NOVEL_SEARCH = "https://www.vodtw.la/search.html"; public static final String SEARCH_KEY = "q"; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/QB5ReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/QB5ReadCrawler.java index 9b8f516..f0bea65 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/QB5ReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/QB5ReadCrawler.java @@ -14,6 +14,7 @@ import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.BookInfoCrawler; import xyz.fycz.myreader.webapi.crawler.base.FindCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; @@ -22,11 +23,9 @@ import java.util.ArrayList; import java.util.List; -public class QB5ReadCrawler extends FindCrawler implements ReadCrawler, BookInfoCrawler { +public class QB5ReadCrawler extends BaseLocalCrawler implements BookInfoCrawler { private static final String NAME_SPACE = "https://www.qb50.com"; private static final String NOVEL_SEARCH = "https://www.qb50.com/modules/article/search.php?searchkey={key}&submit=%CB%D1%CB%F7"; - public static final String FIND_URL = "https://www.qb50.com"; - public static final String FIND_NAME = "书城[全本小说]"; private static final String CHARSET = "GBK"; public static final String SEARCH_CHARSET = "GBK"; @@ -50,126 +49,11 @@ public class QB5ReadCrawler extends FindCrawler implements ReadCrawler, BookInfo return CHARSET; } - @Override - public String getFindName() { - return FIND_NAME; - } - - @Override - public String getFindUrl() { - return FIND_URL; - } - @Override public String getSearchCharset() { return SEARCH_CHARSET; } - @Override - public boolean hasImg() { - return false; - } - - @Override - public boolean needSearch() { - return false; - } - - /** - * 获取书城小说分类列表 - * - * @param html - * @return - */ - public List getBookTypes(String html) { - List bookTypes = new ArrayList<>(); - Document doc = Jsoup.parse(html); - Elements divs = doc.getElementsByClass("nav_cont"); - if (divs.size() > 0) { - Elements uls = divs.get(0).getElementsByTag("ul"); - if (uls.size() > 0) { - for (Element li : uls.get(0).children()) { - Element a = li.child(0); - BookType bookType = new BookType(); - bookType.setTypeName(a.attr("title")); - bookType.setUrl(a.attr("href")); - if (bookType.getTypeName().contains("首页") || bookType.getTypeName().contains("热门小说")) - continue; - if (!StringHelper.isEmpty(bookType.getTypeName())) { - bookTypes.add(bookType); - } - } - } - - } - return bookTypes; - } - - /** - * 获取某一分类小说排行榜列表 - * - * @param html - * @return - */ - public List getBookRankList(String html) { - List books = new ArrayList<>(); - Document doc = Jsoup.parse(html); - Elements divs = doc.getElementsByClass("r"); - if (divs.size() > 0) { - Elements uls = divs.get(0).getElementsByTag("ul"); - if (uls.size() > 0) { - for (Element li : uls.get(0).children()) { - Book book = new Book(); - Element scanS1 = li.getElementsByClass("s1").get(0); - Element scanS2 = li.getElementsByClass("s2").get(0); - Element scanS5 = li.getElementsByClass("s5").get(0); - book.setType(scanS1.html().replace("[", "").replace("]", "")); - Element a = scanS2.getElementsByTag("a").get(0); - book.setName(a.attr("title")); - book.setChapterUrl(a.attr("href")); - book.setAuthor(scanS5.html()); - book.setSource(LocalBookSource.biquge.toString()); - books.add(book); - } - } - } - - return books; - } - - public List getFindBooks(String html, BookType bookType) { - List books = new ArrayList<>(); - Document doc = Jsoup.parse(html); - try { - int pageSize = Integer.parseInt(doc.getElementsByClass("last").first().text()); - bookType.setPageSize(pageSize); - } catch (Exception ignored) { - } - String type = doc.select("meta[name=keywords]").attr("content").replace(",全本小说网", ""); - Element div = doc.getElementById("tlist"); - Elements uls = div.getElementsByTag("ul"); - if (uls.size() > 0) { - for (Element li : uls.get(0).children()) { - Book book = new Book(); - Element aName = li.getElementsByClass("name").get(0); - Element divZz = li.getElementsByClass("zz").get(0); - Element divAuthor = li.getElementsByClass("author").get(0); - Element divSj = li.getElementsByClass("sj").get(0); - book.setType(type); - book.setName(aName.attr("title")); - book.setChapterUrl(aName.attr("href")); - book.setNewestChapterTitle(divZz.text()); - book.setAuthor(divAuthor.text()); - book.setUpdateDate(divSj.text()); - book.setSource(LocalBookSource.qb5.toString()); - books.add(book); - } - } - - return books; - - } - @Override public String getContentFormHtml(String html) { Document doc = Jsoup.parse(html); @@ -277,20 +161,4 @@ public class QB5ReadCrawler extends FindCrawler implements ReadCrawler, BookInfo return book; } - - public boolean getTypePage(BookType curType, int page) { - if (curType.getPageSize() <= 0) { - curType.setPageSize(10); - } - if (page > curType.getPageSize()) { - return true; - } - if (!curType.getTypeName().equals("完本小说")) { - curType.setUrl(curType.getUrl().substring(0, curType.getUrl().lastIndexOf("_") + 1) + page + "/"); - } else { - curType.setUrl(curType.getUrl().substring(0, curType.getUrl().lastIndexOf("/") + 1) + page); - } - return false; - } - } diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/QiQiReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/QiQiReadCrawler.java index 3318792..73759ab 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/QiQiReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/QiQiReadCrawler.java @@ -10,6 +10,7 @@ import xyz.fycz.myreader.entity.SearchBookBean; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; import java.util.ArrayList; @@ -18,7 +19,7 @@ import java.util.ArrayList; * 已失效 */ @Deprecated -public class QiQiReadCrawler implements ReadCrawler { +public class QiQiReadCrawler extends BaseLocalCrawler { public static final String NAME_SPACE = "https://www.qq717.com"; public static final String NOVEL_SEARCH = "https://www.qq717.com/search.php?keyword={key}"; public static final String CHARSET = "UTF-8"; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/QianDianReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/QianDianReadCrawler.java index 71ade3d..8a8a2c7 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/QianDianReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/QianDianReadCrawler.java @@ -14,10 +14,11 @@ import xyz.fycz.myreader.enums.LocalBookSource; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; -public class QianDianReadCrawler implements ReadCrawler { +public class QianDianReadCrawler extends BaseLocalCrawler { public static final String NAME_SPACE = "https://www.qidian.com"; public static final String NOVEL_SEARCH = "https://www.qidian.com/search?kw={key}"; public static final String CHARSET = "UTF-8"; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/QuanNovelReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/QuanNovelReadCrawler.java index a1e0969..c5ddb97 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/QuanNovelReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/QuanNovelReadCrawler.java @@ -11,13 +11,14 @@ import xyz.fycz.myreader.enums.LocalBookSource; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.BookInfoCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; import java.util.ArrayList; -public class QuanNovelReadCrawler implements ReadCrawler, BookInfoCrawler { +public class QuanNovelReadCrawler extends BaseLocalCrawler implements BookInfoCrawler { public static final String NAME_SPACE = "https://qxs.la"; public static final String NOVEL_SEARCH = "https://qxs.la/s_{key}"; public static final String CHARSET = "GBK"; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ReXueReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ReXueReadCrawler.java index 317aa95..f45ddab 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ReXueReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ReXueReadCrawler.java @@ -14,13 +14,14 @@ import xyz.fycz.myreader.entity.SearchBookBean; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; /** * 已失效 */ @Deprecated -public class ReXueReadCrawler implements ReadCrawler { +public class ReXueReadCrawler extends BaseLocalCrawler { public static final String NAME_SPACE = "https://www.rexue.org"; public static final String NOVEL_SEARCH = "https://www.rexue.org/search.php?key={key}"; public static final String CHARSET = "UTF-8"; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ShiGuangReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ShiGuangReadCrawler.java index f0f1227..8a5297a 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ShiGuangReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ShiGuangReadCrawler.java @@ -15,10 +15,11 @@ import xyz.fycz.myreader.enums.LocalBookSource; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; -public class ShiGuangReadCrawler implements ReadCrawler { +public class ShiGuangReadCrawler extends BaseLocalCrawler { public static final String NAME_SPACE = "https://www.youxs.org"; public static final String NOVEL_SEARCH = "https://www.youxs.org/search.php?key={key}"; public static final String CHARSET = "gbk"; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ShuHaiGeReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ShuHaiGeReadCrawler.java index 12ebfa6..42069ca 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ShuHaiGeReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ShuHaiGeReadCrawler.java @@ -8,7 +8,9 @@ import org.jsoup.select.Elements; import java.io.IOException; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import xyz.fycz.myreader.entity.SearchBookBean; import xyz.fycz.myreader.enums.LocalBookSource; @@ -17,11 +19,12 @@ import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; import xyz.fycz.myreader.util.StringHelper; import xyz.fycz.myreader.util.utils.OkHttpUtils; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.BookInfoCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; -public class ShuHaiGeReadCrawler implements ReadCrawler, BookInfoCrawler { +public class ShuHaiGeReadCrawler extends BaseLocalCrawler implements BookInfoCrawler { public static final String NAME_SPACE = "https://www.xinshuhaige.org"; public static final String NOVEL_SEARCH = "https://www.xinshuhaige.org/search.html,searchkey={key}&searchtype=all"; public static final String CHARSET = "utf-8"; @@ -52,6 +55,15 @@ public class ShuHaiGeReadCrawler implements ReadCrawler, BookInfoCrawler { return SEARCH_CHARSET; } + @Override + public Map getHeaders() { + String cookie = "Hm_lvt_46329db612a10d9ae3a668a40c152e0e=1612793811,1612795781,1613200980,1613218588; " + + "__cfduid=d0ebd0275436b7b0c3ccf4c9eb7394abd1619231977 "; + Map headers = new HashMap<>(); + headers.put("Cookie", cookie); + return headers; + } + /** * 从html中获取章节正文 * diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/SoNovelReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/SoNovelReadCrawler.java index c1fe1ae..9da6ef9 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/SoNovelReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/SoNovelReadCrawler.java @@ -11,14 +11,17 @@ import xyz.fycz.myreader.enums.LocalBookSource; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.BookInfoCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; -public class SoNovelReadCrawler implements ReadCrawler, BookInfoCrawler { +public class SoNovelReadCrawler extends BaseLocalCrawler implements BookInfoCrawler { public static final String NAME_SPACE = "https://www.soxs.cc"; public static final String NOVEL_SEARCH = "https://www.soxs.cc/search.html,searchtype=all&searchkey={key}&action=search&submit= 搜 索 "; public static final String CHARSET = "UTF-8"; @@ -49,6 +52,15 @@ public class SoNovelReadCrawler implements ReadCrawler, BookInfoCrawler { return SEARCH_CHARSET; } + @Override + public Map getHeaders() { + String cookie = "Hm_lvt_46329db612a10d9ae3a668a40c152e0e=1612793811,1612795781,1613200980,1613218588; " + + "__cfduid=d0ebd0275436b7b0c3ccf4c9eb7394abd1619231977 "; + Map headers = new HashMap<>(); + headers.put("Cookie", cookie); + return headers; + } + /** * 从html中获取章节正文 * diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/TianLaiReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/TianLaiReadCrawler.java index 4fc7702..a2b483e 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/TianLaiReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/TianLaiReadCrawler.java @@ -13,6 +13,7 @@ import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; import java.util.ArrayList; @@ -21,7 +22,7 @@ import java.util.ArrayList; * 天籁小说网html解析工具 */ -public class TianLaiReadCrawler implements ReadCrawler { +public class TianLaiReadCrawler extends BaseLocalCrawler { public static final String NAME_SPACE = "https://www.23txt.com"; public static final String NOVEL_SEARCH = "https://www.23txt.com/search.php?q={key}"; public static final String CHARSET = "GBK"; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/WoLongReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/WoLongReadCrawler.java index 873a073..0d20744 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/WoLongReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/WoLongReadCrawler.java @@ -14,10 +14,11 @@ import xyz.fycz.myreader.enums.LocalBookSource; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; -public class WoLongReadCrawler implements ReadCrawler { +public class WoLongReadCrawler extends BaseLocalCrawler { public static final String NAME_SPACE = "http://www.paper027.com"; public static final String NOVEL_SEARCH = "http://www.paper027.com/search.html?keyword={key}"; public static final String CHARSET = "UTF-8"; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/XBiQuGeReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/XBiQuGeReadCrawler.java index 7648be7..d24a4d0 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/XBiQuGeReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/XBiQuGeReadCrawler.java @@ -14,10 +14,11 @@ import xyz.fycz.myreader.enums.LocalBookSource; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; -public class XBiQuGeReadCrawler implements ReadCrawler { +public class XBiQuGeReadCrawler extends BaseLocalCrawler { public static final String NAME_SPACE = "https://www.xquge.com"; public static final String NOVEL_SEARCH = "https://www.xquge.com/search?keyword={key}&sign="; public static final String CHARSET = "UTF-8"; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/XS7ReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/XS7ReadCrawler.java index 731cfad..4809d1b 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/XS7ReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/XS7ReadCrawler.java @@ -16,16 +16,16 @@ import xyz.fycz.myreader.enums.LocalBookSource; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.FindCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; -public class XS7ReadCrawler extends FindCrawler implements ReadCrawler { +public class XS7ReadCrawler extends BaseLocalCrawler { public static final String NAME_SPACE = "https://www.xs7.la"; public static final String NOVEL_SEARCH = "https://www.xs7.la/modules/article/search.php,searchkey={key}"; public static final String CHARSET = "GBK"; public static final String SEARCH_CHARSET = "GBK"; - public static final String FIND_NAME = "书城[小说旗]"; @Override public String getSearchLink() { @@ -37,26 +37,6 @@ public class XS7ReadCrawler extends FindCrawler implements ReadCrawler { return CHARSET; } - @Override - public String getFindName() { - return FIND_NAME; - } - - @Override - public String getFindUrl() { - return NAME_SPACE; - } - - @Override - public boolean hasImg() { - return true; - } - - @Override - public boolean needSearch() { - return false; - } - @Override public String getNameSpace() { return NAME_SPACE; @@ -144,74 +124,4 @@ public class XS7ReadCrawler extends FindCrawler implements ReadCrawler { // } return books; } - - @Override - public List getBookTypes(String html) { - List bookTypes = new ArrayList<>(); - Document doc = Jsoup.parse(html); - Element div = doc.getElementsByClass("subnav-hot").first(); - Elements as = div.getElementsByTag("a"); - for (Element a : as) { - BookType bookType = new BookType(); - bookType.setUrl(a.attr("href")); - bookType.setTypeName(a.text()); - bookTypes.add(bookType); - } - return bookTypes; - } - - /* -
-
带着农场混异界
-
-
-

带着农场混异界

- 作者:明宇 -
- -
他横任他横,我自种我田,若要来惹我,过不了明年。 - 宅男赵海带着QQ农场穿越到了异界,附身到了一个落迫的小贵族身上,他的封地是一片种不出东西的黑土地,而最主要的是,...
- -
-
- */ - @Override - public List getFindBooks(String html, BookType bookType) { - List books = new ArrayList<>(); - Document doc = Jsoup.parse(html); - Element last = doc.getElementsByClass("last").first(); - bookType.setPageSize(Integer.parseInt(last.text())); - Element div = doc.getElementById("alist"); - Elements bDivs = div.select("div[id=alistbox]"); - for (Element bDiv : bDivs) { - Book book = new Book(); - Element title = bDiv.getElementsByClass("title").first(); - Element sys = bDiv.getElementsByClass("sys").first(); - Element intro = bDiv.getElementsByClass("intro").first(); - book.setName(title.getElementsByTag("a").first().text()); - book.setAuthor(title.getElementsByTag("span").first().text().replace("作者:", "")); - book.setNewestChapterTitle(sys.getElementsByTag("a").first().text()); - book.setImgUrl(bDiv.getElementsByTag("img").attr("src")); - book.setDesc(intro.text()); - book.setType(bookType.getTypeName()); - book.setChapterUrl(title.getElementsByTag("a").first().attr("href")); - book.setSource(LocalBookSource.xs7.toString()); - books.add(book); - } - return books; - } - - @Override - public boolean getTypePage(BookType curType, int page) { - if (page != 1 && page > curType.getPageSize()) { - return true; - } - curType.setUrl(curType.getUrl().substring(0, curType.getUrl().lastIndexOf("_") + 1) + page + ".html"); - return false; - } } diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/XS7ReadCrawler2.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/XS7ReadCrawler2.java index d4ddf7a..5c9bcb9 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/XS7ReadCrawler2.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/XS7ReadCrawler2.java @@ -15,11 +15,12 @@ import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.BookInfoCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; -public class XS7ReadCrawler2 implements ReadCrawler, BookInfoCrawler { +public class XS7ReadCrawler2 extends BaseLocalCrawler implements BookInfoCrawler { public static final String NAME_SPACE = "https://www.xs7.co"; public static final String NOVEL_SEARCH = "https://www.xs7.co/modules/article/search.php?searchkey={key}&submit=%CB%D1%CB%F7"; public static final String CHARSET = "GBK"; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/XiaGuReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/XiaGuReadCrawler.java index ffafaec..9039059 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/XiaGuReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/XiaGuReadCrawler.java @@ -15,10 +15,11 @@ import xyz.fycz.myreader.enums.LocalBookSource; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; -public class XiaGuReadCrawler implements ReadCrawler { +public class XiaGuReadCrawler extends BaseLocalCrawler { public static final String NAME_SPACE = "https://www.xiagu.org"; public static final String NOVEL_SEARCH = "https://www.xiagu.org/search/?keyword={key}&t=0"; public static final String CHARSET = "UTF-8"; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/XingXingReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/XingXingReadCrawler.java index 1b758d6..1549728 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/XingXingReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/XingXingReadCrawler.java @@ -14,10 +14,11 @@ import xyz.fycz.myreader.enums.LocalBookSource; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; -public class XingXingReadCrawler implements ReadCrawler { +public class XingXingReadCrawler extends BaseLocalCrawler { public static final String NAME_SPACE = "https://www.hs918.com"; public static final String NOVEL_SEARCH = "https://www.hs918.com/search.php?key={key}"; public static final String CHARSET = "UTF-8"; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/YanQingLouReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/YanQingLouReadCrawler.java index 5af3b4f..b0a92ea 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/YanQingLouReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/YanQingLouReadCrawler.java @@ -21,10 +21,11 @@ import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; import xyz.fycz.myreader.util.utils.OkHttpUtils; import xyz.fycz.myreader.util.utils.StringUtils; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; @Deprecated -public class YanQingLouReadCrawler implements ReadCrawler { +public class YanQingLouReadCrawler extends BaseLocalCrawler { public static final String NAME_SPACE = "http://www.yanqinglou.com"; public static final String NOVEL_SEARCH = "http://www.yanqinglou.com/Home/Search,action=search&q={key}"; public static final String AJAX_CONTENT = "http://www.yanqinglou.com/home/index/ajaxchapter"; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/YunZhongReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/YunZhongReadCrawler.java index 097c807..08a5e0f 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/YunZhongReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/YunZhongReadCrawler.java @@ -11,13 +11,14 @@ import xyz.fycz.myreader.enums.LocalBookSource; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.BookInfoCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; import java.util.ArrayList; -public class YunZhongReadCrawler implements ReadCrawler, BookInfoCrawler { +public class YunZhongReadCrawler extends BaseLocalCrawler implements BookInfoCrawler { public static final String NAME_SPACE = "http://www.yunxs.com"; public static final String NOVEL_SEARCH = "http://www.yunxs.com/plus/search.php?q={key}"; public static final String CHARSET = "UTF-8"; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ZW37ReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ZW37ReadCrawler.java index 8b19194..263957a 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ZW37ReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ZW37ReadCrawler.java @@ -15,11 +15,12 @@ import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.BookInfoCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; -public class ZW37ReadCrawler implements ReadCrawler, BookInfoCrawler { +public class ZW37ReadCrawler extends BaseLocalCrawler implements BookInfoCrawler { private static final String NAME_SPACE = "https://www.37zww.net"; private static final String NOVEL_SEARCH = "https://www.37zww.net/modules/article/search.php?searchtype=articlename&searchkey={key}"; private static final String CHARSET = "GBK"; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ZaiShuYuanReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ZaiShuYuanReadCrawler.java index 6cc0e6c..c217f26 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ZaiShuYuanReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ZaiShuYuanReadCrawler.java @@ -14,10 +14,11 @@ import xyz.fycz.myreader.enums.LocalBookSource; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; -public class ZaiShuYuanReadCrawler implements ReadCrawler { +public class ZaiShuYuanReadCrawler extends BaseLocalCrawler{ public static final String NAME_SPACE = "https://www.zhaishuyuan.com"; public static final String NOVEL_SEARCH = "https://www.zhaishuyuan.com/search/,key={key}"; public static final String CHARSET = "gbk"; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ZuoPinReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ZuoPinReadCrawler.java index d962e15..2631755 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ZuoPinReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ZuoPinReadCrawler.java @@ -12,13 +12,14 @@ import xyz.fycz.myreader.enums.LocalBookSource; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConcurrentMultiValueMap; +import xyz.fycz.myreader.webapi.crawler.base.BaseLocalCrawler; import xyz.fycz.myreader.webapi.crawler.base.BookInfoCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; import java.util.ArrayList; -public class ZuoPinReadCrawler implements ReadCrawler, BookInfoCrawler { +public class ZuoPinReadCrawler extends BaseLocalCrawler implements BookInfoCrawler { public static final String NAME_SPACE = "http://zuopinj.com"; public static final String NOVEL_SEARCH = "http://so.zuopinj.com/search/index.php,tbname=bookname&show=title&tempid=3&keyboard={key}"; public static final String CHARSET = "UTF-8"; diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7c4501f..5172749 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -366,6 +366,7 @@ 书源URL 书源分组 书源字符编码 + 书源请求头 自定义源分组 输入自定义源分组名称 【%s】