优化书源结构

pull/5/head
fengyuecanzhu 4 years ago
parent 6f22ed7185
commit 8296d4a506
  1. 14
      app/src/androidTest/java/xyz/fycz/myreader/ExampleInstrumentedTest.java
  2. 1
      app/src/main/AndroidManifest.xml
  3. 2
      app/src/main/java/xyz/fycz/myreader/entity/sourceedit/EditEntityUtil.kt
  4. 8
      app/src/main/java/xyz/fycz/myreader/model/SearchEngine.java
  5. 2
      app/src/main/java/xyz/fycz/myreader/model/third2/analyzeRule/AnalyzeByJSonPath.java
  6. 2
      app/src/main/java/xyz/fycz/myreader/model/third2/analyzeRule/AnalyzeByJSoup.java
  7. 2
      app/src/main/java/xyz/fycz/myreader/model/third2/analyzeRule/AnalyzeByRegex.java
  8. 2
      app/src/main/java/xyz/fycz/myreader/model/third2/analyzeRule/AnalyzeByXPath.java
  9. 2
      app/src/main/java/xyz/fycz/myreader/model/third2/analyzeRule/AnalyzeRule.java
  10. 2
      app/src/main/java/xyz/fycz/myreader/model/third2/analyzeRule/AnalyzeUrl.java
  11. 4
      app/src/main/java/xyz/fycz/myreader/model/third2/content/AnalyzeNextUrlTask.java
  12. 12
      app/src/main/java/xyz/fycz/myreader/model/third2/content/BookChapterList.java
  13. 6
      app/src/main/java/xyz/fycz/myreader/model/third2/content/BookContent.java
  14. 4
      app/src/main/java/xyz/fycz/myreader/model/third2/content/BookInfo.java
  15. 6
      app/src/main/java/xyz/fycz/myreader/model/third2/content/BookList.java
  16. 6
      app/src/main/java/xyz/fycz/myreader/ui/activity/BookDetailedActivity.java
  17. 7
      app/src/main/java/xyz/fycz/myreader/ui/activity/ReadActivity.java
  18. 13
      app/src/main/java/xyz/fycz/myreader/ui/activity/SourceEditActivity.java
  19. 111
      app/src/main/java/xyz/fycz/myreader/ui/activity/SourceLoginActivity.java
  20. 4
      app/src/main/java/xyz/fycz/myreader/ui/adapter/FontsAdapter.java
  21. 4
      app/src/main/java/xyz/fycz/myreader/ui/dialog/APPDownloadTip.java
  22. 4
      app/src/main/java/xyz/fycz/myreader/ui/dialog/UpdateDialog.java
  23. 16
      app/src/main/java/xyz/fycz/myreader/ui/fragment/DIYSourceFragment.java
  24. 6
      app/src/main/java/xyz/fycz/myreader/ui/presenter/BookcasePresenter.java
  25. 4
      app/src/main/java/xyz/fycz/myreader/ui/presenter/CatalogPresenter.java
  26. 2
      app/src/main/java/xyz/fycz/myreader/util/help/JsExtensions.java
  27. 6
      app/src/main/java/xyz/fycz/myreader/util/utils/AdUtils.java
  28. 3
      app/src/main/java/xyz/fycz/myreader/util/utils/OkHttpUtils.java
  29. 61
      app/src/main/java/xyz/fycz/myreader/webapi/BookApi.java
  30. 44
      app/src/main/java/xyz/fycz/myreader/webapi/LanZousApi.java
  31. 10
      app/src/main/java/xyz/fycz/myreader/webapi/ThirdSourceApi.java
  32. 4
      app/src/main/java/xyz/fycz/myreader/widget/page/NetPageLoader.java
  33. 2
      app/src/main/res/drawable/ic_check.xml
  34. 19
      app/src/main/res/layout/activity_source_login.xml
  35. 5
      app/src/main/res/menu/menu_source_edit.xml
  36. 11
      app/src/main/res/menu/menu_source_login.xml
  37. 5
      app/src/main/res/values/strings.xml

@ -1,28 +1,14 @@
package xyz.fycz.myreader; package xyz.fycz.myreader;
import android.content.Context; import android.content.Context;
import android.util.Log;
import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.platform.app.InstrumentationRegistry;
import com.liulishuo.filedownloader.BaseDownloadTask;
import com.liulishuo.filedownloader.FileDownloadLargeFileListener;
import com.liulishuo.filedownloader.FileDownloader;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import java.io.File;
import java.util.List;
import xyz.fycz.myreader.common.APPCONST;
import xyz.fycz.myreader.common.URLCONST;
import xyz.fycz.myreader.util.utils.GsonUtils;
import xyz.fycz.myreader.webapi.CommonApi;
import xyz.fycz.myreader.webapi.ResultCallback;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
/** /**

@ -135,6 +135,7 @@
<activity android:name=".ui.activity.AdSettingActivity" /> <activity android:name=".ui.activity.AdSettingActivity" />
<activity android:name=".ui.activity.DonateActivity" /> <activity android:name=".ui.activity.DonateActivity" />
<activity android:name=".ui.activity.BookInfoEditActivity" /> <activity android:name=".ui.activity.BookInfoEditActivity" />
<activity android:name=".ui.activity.SourceLoginActivity" />
<receiver android:name=".util.notification.NotificationClickReceiver" /> <receiver android:name=".util.notification.NotificationClickReceiver" />
<receiver android:name=".ui.presenter.BookcasePresenter$cancelDownloadReceiver" /> <receiver android:name=".ui.presenter.BookcasePresenter$cancelDownloadReceiver" />

@ -17,6 +17,7 @@ object EditEntityUtil {
add(EditEntity("sourceGroup", source?.sourceGroup, R.string.source_group, "不同分组以;/,隔开")) add(EditEntity("sourceGroup", source?.sourceGroup, R.string.source_group, "不同分组以;/,隔开"))
add(EditEntity("sourceCharset", source?.sourceCharset, R.string.source_charset, "默认UTF-8")) add(EditEntity("sourceCharset", source?.sourceCharset, R.string.source_charset, "默认UTF-8"))
add(EditEntity("sourceHeaders", source?.sourceHeaders, R.string.source_headers, "json格式")) add(EditEntity("sourceHeaders", source?.sourceHeaders, R.string.source_headers, "json格式"))
add(EditEntity("loginUrl", source?.loginUrl, R.string.login_url))
add(EditEntity("sourceComment", source?.sourceComment, R.string.comment, "这是您留给使用者的说明")) add(EditEntity("sourceComment", source?.sourceComment, R.string.comment, "这是您留给使用者的说明"))
} }
return sourceEntities return sourceEntities
@ -106,6 +107,7 @@ object EditEntityUtil {
"sourceGroup" -> source.sourceGroup = it.value "sourceGroup" -> source.sourceGroup = it.value
"sourceCharset" -> source.sourceCharset = it.value "sourceCharset" -> source.sourceCharset = it.value
"sourceHeaders" -> source.sourceHeaders = it.value "sourceHeaders" -> source.sourceHeaders = it.value
"loginUrl" -> source.loginUrl = it.value
"sourceComment" -> source.sourceComment = it.value "sourceComment" -> source.sourceComment = it.value
} }
} }

@ -16,7 +16,7 @@ import xyz.fycz.myreader.greendao.entity.Chapter;
import xyz.fycz.myreader.model.mulvalmap.ConMVMap; import xyz.fycz.myreader.model.mulvalmap.ConMVMap;
import xyz.fycz.myreader.util.SharedPreUtils; import xyz.fycz.myreader.util.SharedPreUtils;
import xyz.fycz.myreader.util.ToastUtils; import xyz.fycz.myreader.util.ToastUtils;
import xyz.fycz.myreader.webapi.CommonApi; import xyz.fycz.myreader.webapi.BookApi;
import xyz.fycz.myreader.webapi.crawler.base.BookInfoCrawler; import xyz.fycz.myreader.webapi.crawler.base.BookInfoCrawler;
import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler;
@ -135,7 +135,7 @@ public class SearchEngine {
searchSiteIndex++; searchSiteIndex++;
if (searchSiteIndex < mSourceList.size()) { if (searchSiteIndex < mSourceList.size()) {
ReadCrawler crawler = mSourceList.get(searchSiteIndex); ReadCrawler crawler = mSourceList.get(searchSiteIndex);
CommonApi.search(keyword, crawler) BookApi.search(keyword, crawler)
.subscribeOn(scheduler) .subscribeOn(scheduler)
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<ConMVMap<SearchBookBean, Book>>() { .subscribe(new Observer<ConMVMap<SearchBookBean, Book>>() {
@ -182,7 +182,7 @@ public class SearchEngine {
if (searchSiteIndex < mSourceList.size()) { if (searchSiteIndex < mSourceList.size()) {
ReadCrawler crawler = mSourceList.get(searchSiteIndex); ReadCrawler crawler = mSourceList.get(searchSiteIndex);
String searchKey = title; String searchKey = title;
CommonApi.search(searchKey, crawler) BookApi.search(searchKey, crawler)
.subscribeOn(scheduler) .subscribeOn(scheduler)
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<ConMVMap<SearchBookBean, Book>>() { .subscribe(new Observer<ConMVMap<SearchBookBean, Book>>() {
@ -229,7 +229,7 @@ public class SearchEngine {
} }
public synchronized void getBookInfo(Book book, BookInfoCrawler bic, OnGetBookInfoListener listener){ public synchronized void getBookInfo(Book book, BookInfoCrawler bic, OnGetBookInfoListener listener){
CommonApi.getBookInfo(book, bic) BookApi.getBookInfo(book, bic)
.subscribeOn(scheduler) .subscribeOn(scheduler)
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<Book>() { .subscribe(new Observer<Book>() {

@ -1,4 +1,4 @@
package xyz.fycz.myreader.model.third.analyzeRule; package xyz.fycz.myreader.model.third2.analyzeRule;
import android.text.TextUtils; import android.text.TextUtils;

@ -1,4 +1,4 @@
package xyz.fycz.myreader.model.third.analyzeRule; package xyz.fycz.myreader.model.third2.analyzeRule;
import android.text.TextUtils; import android.text.TextUtils;

@ -1,4 +1,4 @@
package xyz.fycz.myreader.model.third.analyzeRule; package xyz.fycz.myreader.model.third2.analyzeRule;
import android.os.Build; import android.os.Build;
import android.text.TextUtils; import android.text.TextUtils;

@ -1,4 +1,4 @@
package xyz.fycz.myreader.model.third.analyzeRule; package xyz.fycz.myreader.model.third2.analyzeRule;
import android.text.TextUtils; import android.text.TextUtils;

@ -1,4 +1,4 @@
package xyz.fycz.myreader.model.third.analyzeRule; package xyz.fycz.myreader.model.third2.analyzeRule;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;

@ -1,4 +1,4 @@
package xyz.fycz.myreader.model.third.analyzeRule; package xyz.fycz.myreader.model.third2.analyzeRule;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.text.TextUtils; import android.text.TextUtils;

@ -1,4 +1,4 @@
package xyz.fycz.myreader.model.third.content; package xyz.fycz.myreader.model.third2.content;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -9,7 +9,7 @@ import xyz.fycz.myreader.base.observer.MyObserver;
import xyz.fycz.myreader.entity.WebChapterBean; import xyz.fycz.myreader.entity.WebChapterBean;
import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Book;
import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.greendao.entity.Chapter;
import xyz.fycz.myreader.model.third.analyzeRule.AnalyzeUrl; import xyz.fycz.myreader.model.third2.analyzeRule.AnalyzeUrl;
import xyz.fycz.myreader.util.utils.OkHttpUtils; import xyz.fycz.myreader.util.utils.OkHttpUtils;
public class AnalyzeNextUrlTask { public class AnalyzeNextUrlTask {

@ -1,4 +1,4 @@
package xyz.fycz.myreader.model.third.content; package xyz.fycz.myreader.model.third2.content;
import android.os.Build; import android.os.Build;
import android.text.TextUtils; import android.text.TextUtils;
@ -25,9 +25,9 @@ import xyz.fycz.myreader.greendao.entity.Book;
import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.greendao.entity.Chapter;
import xyz.fycz.myreader.greendao.entity.rule.BookSource; import xyz.fycz.myreader.greendao.entity.rule.BookSource;
import xyz.fycz.myreader.greendao.entity.rule.TocRule; import xyz.fycz.myreader.greendao.entity.rule.TocRule;
import xyz.fycz.myreader.model.third.analyzeRule.AnalyzeByRegex; import xyz.fycz.myreader.model.third2.analyzeRule.AnalyzeByRegex;
import xyz.fycz.myreader.model.third.analyzeRule.AnalyzeRule; import xyz.fycz.myreader.model.third2.analyzeRule.AnalyzeRule;
import xyz.fycz.myreader.model.third.analyzeRule.AnalyzeUrl; import xyz.fycz.myreader.model.third2.analyzeRule.AnalyzeUrl;
import xyz.fycz.myreader.util.utils.OkHttpUtils; import xyz.fycz.myreader.util.utils.OkHttpUtils;
public class BookChapterList { public class BookChapterList {
@ -53,8 +53,8 @@ public class BookChapterList {
e.onError(new Throwable("目录获取失败" + book.getChapterUrl())); e.onError(new Throwable("目录获取失败" + book.getChapterUrl()));
return; return;
} else { } else {
Log.d(tag, "┌成功获取目录页" + analyzeNextUrl); Log.d(tag, "┌成功获取目录页");
Log.d(tag, "└" + book.getChapterUrl() + analyzeNextUrl); Log.d(tag, "└" + book.getChapterUrl());
} }
book.setTag(tag); book.setTag(tag);
AnalyzeRule analyzer = new AnalyzeRule(book); AnalyzeRule analyzer = new AnalyzeRule(book);

@ -1,4 +1,4 @@
package xyz.fycz.myreader.model.third.content; package xyz.fycz.myreader.model.third2.content;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
@ -17,8 +17,8 @@ import xyz.fycz.myreader.greendao.entity.Chapter;
import xyz.fycz.myreader.greendao.entity.rule.BookSource; import xyz.fycz.myreader.greendao.entity.rule.BookSource;
import xyz.fycz.myreader.greendao.entity.rule.ContentRule; import xyz.fycz.myreader.greendao.entity.rule.ContentRule;
import xyz.fycz.myreader.greendao.gen.ChapterDao; import xyz.fycz.myreader.greendao.gen.ChapterDao;
import xyz.fycz.myreader.model.third.analyzeRule.AnalyzeRule; import xyz.fycz.myreader.model.third2.analyzeRule.AnalyzeRule;
import xyz.fycz.myreader.model.third.analyzeRule.AnalyzeUrl; import xyz.fycz.myreader.model.third2.analyzeRule.AnalyzeUrl;
import xyz.fycz.myreader.util.utils.NetworkUtils; import xyz.fycz.myreader.util.utils.NetworkUtils;
import xyz.fycz.myreader.util.utils.OkHttpUtils; import xyz.fycz.myreader.util.utils.OkHttpUtils;
import xyz.fycz.myreader.util.utils.StringUtils; import xyz.fycz.myreader.util.utils.StringUtils;

@ -1,4 +1,4 @@
package xyz.fycz.myreader.model.third.content; package xyz.fycz.myreader.model.third2.content;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
@ -8,7 +8,7 @@ import io.reactivex.Observable;
import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Book;
import xyz.fycz.myreader.greendao.entity.rule.BookSource; import xyz.fycz.myreader.greendao.entity.rule.BookSource;
import xyz.fycz.myreader.greendao.entity.rule.InfoRule; import xyz.fycz.myreader.greendao.entity.rule.InfoRule;
import xyz.fycz.myreader.model.third.analyzeRule.AnalyzeRule; import xyz.fycz.myreader.model.third2.analyzeRule.AnalyzeRule;
import xyz.fycz.myreader.util.utils.StringUtils; import xyz.fycz.myreader.util.utils.StringUtils;
import static android.text.TextUtils.isEmpty; import static android.text.TextUtils.isEmpty;

@ -1,4 +1,4 @@
package xyz.fycz.myreader.model.third.content; package xyz.fycz.myreader.model.third2.content;
import android.os.Build; import android.os.Build;
import android.text.TextUtils; import android.text.TextUtils;
@ -20,8 +20,8 @@ import xyz.fycz.myreader.greendao.entity.rule.BookSource;
import xyz.fycz.myreader.greendao.entity.rule.FindRule; import xyz.fycz.myreader.greendao.entity.rule.FindRule;
import xyz.fycz.myreader.greendao.entity.rule.InfoRule; import xyz.fycz.myreader.greendao.entity.rule.InfoRule;
import xyz.fycz.myreader.greendao.entity.rule.SearchRule; import xyz.fycz.myreader.greendao.entity.rule.SearchRule;
import xyz.fycz.myreader.model.third.analyzeRule.AnalyzeByRegex; import xyz.fycz.myreader.model.third2.analyzeRule.AnalyzeByRegex;
import xyz.fycz.myreader.model.third.analyzeRule.AnalyzeRule; import xyz.fycz.myreader.model.third2.analyzeRule.AnalyzeRule;
import xyz.fycz.myreader.util.utils.NetworkUtils; import xyz.fycz.myreader.util.utils.NetworkUtils;
import xyz.fycz.myreader.util.utils.StringUtils; import xyz.fycz.myreader.util.utils.StringUtils;

@ -77,7 +77,7 @@ import xyz.fycz.myreader.util.utils.GsonExtensionsKt;
import xyz.fycz.myreader.util.utils.NetworkUtils; import xyz.fycz.myreader.util.utils.NetworkUtils;
import xyz.fycz.myreader.util.utils.RxUtils; import xyz.fycz.myreader.util.utils.RxUtils;
import xyz.fycz.myreader.util.utils.StringUtils; import xyz.fycz.myreader.util.utils.StringUtils;
import xyz.fycz.myreader.webapi.CommonApi; import xyz.fycz.myreader.webapi.BookApi;
import xyz.fycz.myreader.webapi.crawler.ReadCrawlerUtil; import xyz.fycz.myreader.webapi.crawler.ReadCrawlerUtil;
import xyz.fycz.myreader.webapi.crawler.base.BookInfoCrawler; import xyz.fycz.myreader.webapi.crawler.base.BookInfoCrawler;
import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler;
@ -413,7 +413,7 @@ public class BookDetailedActivity extends BaseActivity {
if ((rc instanceof BookInfoCrawler && StringHelper.isEmpty(mBook.getImgUrl())) || (thirdSource && !isCollected)) { if ((rc instanceof BookInfoCrawler && StringHelper.isEmpty(mBook.getImgUrl())) || (thirdSource && !isCollected)) {
binding.pbLoading.setVisibility(View.VISIBLE); binding.pbLoading.setVisibility(View.VISIBLE);
BookInfoCrawler bic = (BookInfoCrawler) rc; BookInfoCrawler bic = (BookInfoCrawler) rc;
CommonApi.getBookInfo(mBook, bic).compose(RxUtils::toSimpleSingle).subscribe(new MyObserver<Book>() { BookApi.getBookInfo(mBook, bic).compose(RxUtils::toSimpleSingle).subscribe(new MyObserver<Book>() {
@Override @Override
public void onNext(@NotNull Book book) { public void onNext(@NotNull Book book) {
if (!App.isDestroy(BookDetailedActivity.this)) { if (!App.isDestroy(BookDetailedActivity.this)) {
@ -476,7 +476,7 @@ public class BookDetailedActivity extends BaseActivity {
mChapters = mChapterService.findBookAllChapterByBookId(mBook.getId()); mChapters = mChapterService.findBookAllChapterByBookId(mBook.getId());
} }
if (chaptersDis != null) chaptersDis.dispose(); if (chaptersDis != null) chaptersDis.dispose();
CommonApi.getBookChapters(mBook, mReadCrawler) BookApi.getBookChapters(mBook, mReadCrawler)
.flatMap((Function<List<Chapter>, ObservableSource<Boolean>>) chapters -> saveChapters(chapters, isChangeSource)).compose(RxUtils::toSimpleSingle) .flatMap((Function<List<Chapter>, ObservableSource<Boolean>>) chapters -> saveChapters(chapters, isChangeSource)).compose(RxUtils::toSimpleSingle)
.subscribe(new MyObserver<Boolean>() { .subscribe(new MyObserver<Boolean>() {
@Override @Override

@ -47,7 +47,6 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
import io.reactivex.Observable; import io.reactivex.Observable;
import io.reactivex.internal.schedulers.ExecutorScheduler;
import io.reactivex.schedulers.Schedulers; import io.reactivex.schedulers.Schedulers;
import xyz.fycz.myreader.ActivityManage; import xyz.fycz.myreader.ActivityManage;
import xyz.fycz.myreader.R; import xyz.fycz.myreader.R;
@ -97,7 +96,7 @@ import xyz.fycz.myreader.util.utils.RxUtils;
import xyz.fycz.myreader.util.utils.ScreenUtils; import xyz.fycz.myreader.util.utils.ScreenUtils;
import xyz.fycz.myreader.util.utils.StringUtils; import xyz.fycz.myreader.util.utils.StringUtils;
import xyz.fycz.myreader.util.utils.SystemBarUtils; import xyz.fycz.myreader.util.utils.SystemBarUtils;
import xyz.fycz.myreader.webapi.CommonApi; import xyz.fycz.myreader.webapi.BookApi;
import xyz.fycz.myreader.webapi.ResultCallback; import xyz.fycz.myreader.webapi.ResultCallback;
import xyz.fycz.myreader.webapi.crawler.ReadCrawlerUtil; import xyz.fycz.myreader.webapi.crawler.ReadCrawlerUtil;
import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler;
@ -1008,7 +1007,7 @@ public class ReadActivity extends BaseActivity implements ColorPickerDialogListe
}); });
} else { } else {
mPageLoader.setmStatus(PageLoader.STATUS_LOADING_CHAPTER); mPageLoader.setmStatus(PageLoader.STATUS_LOADING_CHAPTER);
CommonApi.getBookChapters(mBook, mReadCrawler).flatMap(chapters -> Observable.create(emitter -> { BookApi.getBookChapters(mBook, mReadCrawler).flatMap(chapters -> Observable.create(emitter -> {
updateAllOldChapterData(chapters); updateAllOldChapterData(chapters);
initChapters(); initChapters();
emitter.onNext(chapters); emitter.onNext(chapters);
@ -1585,7 +1584,7 @@ public class ReadActivity extends BaseActivity implements ColorPickerDialogListe
if (StringHelper.isEmpty(chapter.getBookId())) { if (StringHelper.isEmpty(chapter.getBookId())) {
chapter.setId(mBook.getId()); chapter.setId(mBook.getId());
} }
CommonApi.getChapterContent(chapter, mBook, mReadCrawler) BookApi.getChapterContent(chapter, mBook, mReadCrawler)
.subscribeOn(Schedulers.from(App.getApplication().getmFixedThreadPool())) .subscribeOn(Schedulers.from(App.getApplication().getmFixedThreadPool()))
.subscribe(new MyObserver<String>() { .subscribe(new MyObserver<String>() {
@Override @Override

@ -24,6 +24,7 @@ import xyz.fycz.myreader.databinding.ActivitySourceEditBinding;
import xyz.fycz.myreader.entity.sourcedebug.DebugEntity; import xyz.fycz.myreader.entity.sourcedebug.DebugEntity;
import xyz.fycz.myreader.entity.sourceedit.EditEntity; import xyz.fycz.myreader.entity.sourceedit.EditEntity;
import xyz.fycz.myreader.entity.sourceedit.EditEntityUtil; import xyz.fycz.myreader.entity.sourceedit.EditEntityUtil;
import xyz.fycz.myreader.greendao.DbManager;
import xyz.fycz.myreader.greendao.entity.rule.BookSource; import xyz.fycz.myreader.greendao.entity.rule.BookSource;
import xyz.fycz.myreader.model.sourceAnalyzer.BookSourceManager; import xyz.fycz.myreader.model.sourceAnalyzer.BookSourceManager;
import xyz.fycz.myreader.ui.adapter.SourceEditAdapter; import xyz.fycz.myreader.ui.adapter.SourceEditAdapter;
@ -187,6 +188,18 @@ public class SourceEditActivity extends BaseActivity {
debug(item.getTitle(), DebugEntity.TOC); debug(item.getTitle(), DebugEntity.TOC);
} else if (item.getItemId() == R.id.action_debug_content) { } else if (item.getItemId() == R.id.action_debug_content) {
debug(item.getTitle(), DebugEntity.CONTENT); debug(item.getTitle(), DebugEntity.CONTENT);
} else if (item.getItemId() == R.id.action_login) {
BookSource source = getSource();
if (!StringHelper.isEmpty(source.getLoginUrl())) {
Intent intent = new Intent(this, SourceLoginActivity.class);
intent.putExtra(APPCONST.BOOK_SOURCE, source);
startActivity(intent);
} else {
ToastUtils.showWarring("当前书源没有配置登录地址");
}
} else if (item.getItemId() == R.id.action_clear_cookie) {
DbManager.getDaoSession().getCookieBeanDao().deleteByKey(getSource().getSourceUrl());
ToastUtils.showSuccess("Cookie清除成功");
} }
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }

@ -0,0 +1,111 @@
package xyz.fycz.myreader.ui.activity;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.webkit.CookieManager;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import androidx.appcompat.widget.Toolbar;
import xyz.fycz.myreader.R;
import xyz.fycz.myreader.base.BaseActivity;
import xyz.fycz.myreader.common.APPCONST;
import xyz.fycz.myreader.databinding.ActivitySourceLoginBinding;
import xyz.fycz.myreader.greendao.DbManager;
import xyz.fycz.myreader.greendao.entity.CookieBean;
import xyz.fycz.myreader.greendao.entity.rule.BookSource;
import xyz.fycz.myreader.util.ToastUtils;
/**
* @author fengyue
* @date 2021/5/15 10:43
*/
public class SourceLoginActivity extends BaseActivity {
private ActivitySourceLoginBinding binding;
private BookSource bookSource;
private boolean checking = false;
@Override
protected void bindView() {
binding = ActivitySourceLoginBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
}
@Override
protected void onDestroy() {
super.onDestroy();
binding.webView.destroy();
}
@Override
protected void setUpToolbar(Toolbar toolbar) {
super.setUpToolbar(toolbar);
setStatusBarColor(R.color.colorPrimary, true);
getSupportActionBar().setTitle(getString(R.string.text_login));
}
@Override
protected void initData(Bundle savedInstanceState) {
super.initData(savedInstanceState);
bookSource = getIntent().getParcelableExtra(APPCONST.BOOK_SOURCE);
}
@Override
protected void initWidget() {
WebSettings settings = binding.webView.getSettings();
settings.setSupportZoom(true);
settings.setBuiltInZoomControls(true);
settings.setDefaultTextEncodingName("UTF-8");
settings.setJavaScriptEnabled(true);
CookieManager cookieManager = CookieManager.getInstance();
binding.webView.setWebViewClient(new WebViewClient() {
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
String cookie = cookieManager.getCookie(url);
DbManager.getDaoSession().getCookieBeanDao().insertOrReplace(new CookieBean(bookSource.getLoginUrl(), cookie));
super.onPageStarted(view, url, favicon);
}
@Override
public void onPageFinished(WebView view, String url) {
String cookie = cookieManager.getCookie(url);
DbManager.getDaoSession().getCookieBeanDao().insertOrReplace(new CookieBean(bookSource.getLoginUrl(), cookie));
if (checking)
finish();
else
ToastUtils.showInfo(getString(R.string.click_check_after_success));
super.onPageFinished(view, url);
}
});
binding.webView.loadUrl(bookSource.getLoginUrl());
}
// 添加菜单
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_source_login, menu);
return true;
}
//菜单
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
switch (id) {
case R.id.action_check:
if (checking) break;
checking = true;
ToastUtils.showInfo(getString(R.string.check_host_cookie));
binding.webView.loadUrl(bookSource.getLoginUrl());
break;
case android.R.id.home:
finish();
break;
}
return super.onOptionsItemSelected(item);
}
}

@ -29,6 +29,7 @@ import java.util.ArrayList;
import xyz.fycz.myreader.R; import xyz.fycz.myreader.R;
import xyz.fycz.myreader.application.App; import xyz.fycz.myreader.application.App;
import xyz.fycz.myreader.application.SysManager; import xyz.fycz.myreader.application.SysManager;
import xyz.fycz.myreader.webapi.LanZousApi;
import xyz.fycz.myreader.webapi.ResultCallback; import xyz.fycz.myreader.webapi.ResultCallback;
import xyz.fycz.myreader.common.APPCONST; import xyz.fycz.myreader.common.APPCONST;
import xyz.fycz.myreader.common.URLCONST; import xyz.fycz.myreader.common.URLCONST;
@ -39,7 +40,6 @@ import xyz.fycz.myreader.util.IOUtils;
import xyz.fycz.myreader.util.ToastUtils; import xyz.fycz.myreader.util.ToastUtils;
import xyz.fycz.myreader.util.utils.FileUtils; import xyz.fycz.myreader.util.utils.FileUtils;
import xyz.fycz.myreader.util.utils.NetworkUtils; import xyz.fycz.myreader.util.utils.NetworkUtils;
import xyz.fycz.myreader.webapi.CommonApi;
import xyz.fycz.myreader.widget.ProgressButton; import xyz.fycz.myreader.widget.ProgressButton;
@ -208,7 +208,7 @@ public class FontsAdapter extends ArrayAdapter<Font> {
} }
final String[] url = {URLCONST.FONT_DOWNLOAD_URL + font.toString() + ".ttf"}; final String[] url = {URLCONST.FONT_DOWNLOAD_URL + font.toString() + ".ttf"};
viewHolder.btnFontUse.setText("获取连接..."); viewHolder.btnFontUse.setText("获取连接...");
CommonApi.getUrl(font.downloadPath, new ResultCallback() { LanZousApi.getUrl(font.downloadPath, new ResultCallback() {
@Override @Override
public void onFinish(Object o, int code) { public void onFinish(Object o, int code) {
String downloadUrl = (String) o; String downloadUrl = (String) o;

@ -10,6 +10,7 @@ import android.view.View;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import xyz.fycz.myreader.application.App; import xyz.fycz.myreader.application.App;
import xyz.fycz.myreader.webapi.LanZousApi;
import xyz.fycz.myreader.webapi.ResultCallback; import xyz.fycz.myreader.webapi.ResultCallback;
import xyz.fycz.myreader.common.APPCONST; import xyz.fycz.myreader.common.APPCONST;
import xyz.fycz.myreader.ui.activity.MainActivity; import xyz.fycz.myreader.ui.activity.MainActivity;
@ -17,7 +18,6 @@ import xyz.fycz.myreader.ui.fragment.BookcaseFragment;
import xyz.fycz.myreader.util.IOUtils; import xyz.fycz.myreader.util.IOUtils;
import xyz.fycz.myreader.util.ToastUtils; import xyz.fycz.myreader.util.ToastUtils;
import xyz.fycz.myreader.util.utils.FileUtils; import xyz.fycz.myreader.util.utils.FileUtils;
import xyz.fycz.myreader.webapi.CommonApi;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
@ -74,7 +74,7 @@ public class APPDownloadTip {
mBookcaseFragment.getRlDownloadTip().setVisibility(View.VISIBLE); mBookcaseFragment.getRlDownloadTip().setVisibility(View.VISIBLE);
mBookcaseFragment.getPbDownload().setProgress(0); mBookcaseFragment.getPbDownload().setProgress(0);
mBookcaseFragment.getTvDownloadTip().setText("正在获取下载链接..."); mBookcaseFragment.getTvDownloadTip().setText("正在获取下载链接...");
CommonApi.getUrl(url, new ResultCallback() { LanZousApi.getUrl(url, new ResultCallback() {
@Override @Override
public void onFinish(Object o, int code) { public void onFinish(Object o, int code) {
final String downloadUrl = (String) o; final String downloadUrl = (String) o;

@ -40,7 +40,7 @@ import xyz.fycz.myreader.R;
import xyz.fycz.myreader.application.App; import xyz.fycz.myreader.application.App;
import xyz.fycz.myreader.databinding.FragmentUpdateBinding; import xyz.fycz.myreader.databinding.FragmentUpdateBinding;
import xyz.fycz.myreader.util.ToastUtils; import xyz.fycz.myreader.util.ToastUtils;
import xyz.fycz.myreader.webapi.CommonApi; import xyz.fycz.myreader.webapi.LanZousApi;
import xyz.fycz.myreader.webapi.ResultCallback; import xyz.fycz.myreader.webapi.ResultCallback;
@ -368,7 +368,7 @@ public class UpdateDialog extends Fragment {
private void downloadWithLanzous(String apkUrl) { private void downloadWithLanzous(String apkUrl) {
binding.tvProgress.setText("正在获取下载链接..."); binding.tvProgress.setText("正在获取下载链接...");
binding.barPercentView.setPercentage(0); binding.barPercentView.setPercentage(0);
CommonApi.getUrl(apkUrl, new ResultCallback() { LanZousApi.getUrl(apkUrl, new ResultCallback() {
@Override @Override
public void onFinish(Object o, int code) { public void onFinish(Object o, int code) {
String downloadUrl = (String) o; String downloadUrl = (String) o;

@ -24,6 +24,7 @@ import io.reactivex.Observable;
import io.reactivex.Single; import io.reactivex.Single;
import io.reactivex.SingleOnSubscribe; import io.reactivex.SingleOnSubscribe;
import io.reactivex.annotations.NonNull; import io.reactivex.annotations.NonNull;
import io.reactivex.disposables.Disposable;
import xyz.fycz.myreader.R; import xyz.fycz.myreader.R;
import xyz.fycz.myreader.base.BaseFragment; import xyz.fycz.myreader.base.BaseFragment;
import xyz.fycz.myreader.base.observer.MyObserver; import xyz.fycz.myreader.base.observer.MyObserver;
@ -39,6 +40,7 @@ import xyz.fycz.myreader.ui.activity.SourceEditActivity;
import xyz.fycz.myreader.ui.adapter.BookSourceAdapter; import xyz.fycz.myreader.ui.adapter.BookSourceAdapter;
import xyz.fycz.myreader.ui.adapter.helper.ItemTouchCallback; import xyz.fycz.myreader.ui.adapter.helper.ItemTouchCallback;
import xyz.fycz.myreader.ui.dialog.DialogCreator; import xyz.fycz.myreader.ui.dialog.DialogCreator;
import xyz.fycz.myreader.ui.dialog.LoadingDialog;
import xyz.fycz.myreader.ui.dialog.MyAlertDialog; import xyz.fycz.myreader.ui.dialog.MyAlertDialog;
import xyz.fycz.myreader.util.ShareUtils; import xyz.fycz.myreader.util.ShareUtils;
import xyz.fycz.myreader.util.ToastUtils; import xyz.fycz.myreader.util.ToastUtils;
@ -66,6 +68,7 @@ public class DIYSourceFragment extends BaseFragment {
private boolean isSearch; private boolean isSearch;
private PopupMenu featuresMenu; private PopupMenu featuresMenu;
private ItemTouchCallback itemTouchCallback; private ItemTouchCallback itemTouchCallback;
private Disposable importSourceDis;
public DIYSourceFragment() { public DIYSourceFragment() {
sourceActivity = (BookSourceActivity) getActivity(); sourceActivity = (BookSourceActivity) getActivity();
@ -178,9 +181,20 @@ public class DIYSourceFragment extends BaseFragment {
} }
public void importDataS(String text) { public void importDataS(String text) {
LoadingDialog dialog = new LoadingDialog(getContext(), "正在导入", () -> {
if (importSourceDis != null) {
importSourceDis.dispose();
}
});
dialog.show();
Observable<List<BookSource>> observable = BookSourceManager.importSource(text); Observable<List<BookSource>> observable = BookSourceManager.importSource(text);
if (observable != null) { if (observable != null) {
observable.subscribe(new MyObserver<List<BookSource>>() { observable.subscribe(new MyObserver<List<BookSource>>() {
@Override
public void onSubscribe(Disposable d) {
importSourceDis = d;
}
@Override @Override
public void onNext(List<BookSource> sources) { public void onNext(List<BookSource> sources) {
int size = sources.size(); int size = sources.size();
@ -190,11 +204,13 @@ public class DIYSourceFragment extends BaseFragment {
} else { } else {
ToastUtils.showError("格式不对"); ToastUtils.showError("格式不对");
} }
dialog.dismiss();
} }
@Override @Override
public void onError(Throwable e) { public void onError(Throwable e) {
ToastUtils.showError("格式不对"); ToastUtils.showError("格式不对");
dialog.dismiss();
} }
}); });
} else { } else {

@ -61,7 +61,7 @@ import xyz.fycz.myreader.ui.fragment.BookcaseFragment;
import xyz.fycz.myreader.util.*; import xyz.fycz.myreader.util.*;
import xyz.fycz.myreader.util.notification.NotificationUtil; import xyz.fycz.myreader.util.notification.NotificationUtil;
import xyz.fycz.myreader.util.utils.NetworkUtils; import xyz.fycz.myreader.util.utils.NetworkUtils;
import xyz.fycz.myreader.webapi.CommonApi; import xyz.fycz.myreader.webapi.BookApi;
import static xyz.fycz.myreader.application.App.checkVersionByServer; import static xyz.fycz.myreader.application.App.checkVersionByServer;
@ -406,7 +406,7 @@ public class BookcasePresenter implements BasePresenter {
Thread update = new Thread(() -> { Thread update = new Thread(() -> {
final ArrayList<Chapter> mChapters = (ArrayList<Chapter>) mChapterService.findBookAllChapterByBookId(book.getId()); final ArrayList<Chapter> mChapters = (ArrayList<Chapter>) mChapterService.findBookAllChapterByBookId(book.getId());
final ReadCrawler mReadCrawler = ReadCrawlerUtil.getReadCrawler(book.getSource()); final ReadCrawler mReadCrawler = ReadCrawlerUtil.getReadCrawler(book.getSource());
CommonApi.getBookChapters(book, mReadCrawler).flatMap(chapters -> Observable.create(emitter -> { BookApi.getBookChapters(book, mReadCrawler).flatMap(chapters -> Observable.create(emitter -> {
int noReadNum = chapters.size() - book.getChapterTotalNum(); int noReadNum = chapters.size() - book.getChapterTotalNum();
book.setNoReadNum(Math.max(noReadNum, 0)); book.setNoReadNum(Math.max(noReadNum, 0));
book.setNewestChapterTitle(chapters.get(chapters.size() - 1).getTitle()); book.setNewestChapterTitle(chapters.get(chapters.size() - 1).getTitle());
@ -780,7 +780,7 @@ public class BookcasePresenter implements BasePresenter {
chapter.setBookId(book.getId()); chapter.setBookId(book.getId());
} }
ReadCrawler mReadCrawler = ReadCrawlerUtil.getReadCrawler(book.getSource()); ReadCrawler mReadCrawler = ReadCrawlerUtil.getReadCrawler(book.getSource());
CommonApi.getChapterContent(chapter, book, mReadCrawler).flatMap(s -> Observable.create(emitter -> { BookApi.getChapterContent(chapter, book, mReadCrawler).flatMap(s -> Observable.create(emitter -> {
downloadingChapter = chapter.getTitle(); downloadingChapter = chapter.getTitle();
mChapterService.saveOrUpdateChapter(chapter, s); mChapterService.saveOrUpdateChapter(chapter, s);
successCathe++; successCathe++;

@ -20,7 +20,7 @@ import xyz.fycz.myreader.greendao.entity.Chapter;
import xyz.fycz.myreader.greendao.service.ChapterService; import xyz.fycz.myreader.greendao.service.ChapterService;
import xyz.fycz.myreader.ui.adapter.ChapterTitleAdapter; import xyz.fycz.myreader.ui.adapter.ChapterTitleAdapter;
import xyz.fycz.myreader.ui.fragment.CatalogFragment; import xyz.fycz.myreader.ui.fragment.CatalogFragment;
import xyz.fycz.myreader.webapi.CommonApi; import xyz.fycz.myreader.webapi.BookApi;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
@ -67,7 +67,7 @@ public class CatalogPresenter implements BasePresenter {
return; return;
} }
mCatalogFragment.getPbLoading().setVisibility(View.VISIBLE); mCatalogFragment.getPbLoading().setVisibility(View.VISIBLE);
CommonApi.getBookChapters(mBook, ReadCrawlerUtil.getReadCrawler(mBook.getSource())) BookApi.getBookChapters(mBook, ReadCrawlerUtil.getReadCrawler(mBook.getSource()))
.compose(RxUtils::toSimpleSingle).subscribe(new MyObserver<List<Chapter>>() { .compose(RxUtils::toSimpleSingle).subscribe(new MyObserver<List<Chapter>>() {
@Override @Override
public void onNext(@NotNull List<Chapter> chapters) { public void onNext(@NotNull List<Chapter> chapters) {

@ -9,7 +9,7 @@ import java.util.Map;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import xyz.fycz.myreader.model.third.analyzeRule.AnalyzeUrl; import xyz.fycz.myreader.model.third2.analyzeRule.AnalyzeUrl;
import xyz.fycz.myreader.util.utils.OkHttpUtils; import xyz.fycz.myreader.util.utils.OkHttpUtils;
import xyz.fycz.myreader.util.utils.StringUtils; import xyz.fycz.myreader.util.utils.StringUtils;

@ -123,9 +123,9 @@ public class AdUtils {
public static void initAd() { public static void initAd() {
if (!hasInitAd) { if (!hasInitAd) {
hasInitAd = true; hasInitAd = true;
DdSdkHelper.init("1234", "216", "51716a16fbdf50905704b6575b1b3b60", DdSdkHelper.init("", "", "",
"142364", "35ce0efe5f3cc960b116db227498e238", "", "",
"8167", "85bd159309c3da1b", "", "",
App.getApplication(), App.isDebug()); App.getApplication(), App.isDebug());
} }
} }

@ -21,8 +21,7 @@ import xyz.fycz.myreader.application.App;
import xyz.fycz.myreader.entity.StrResponse; import xyz.fycz.myreader.entity.StrResponse;
import xyz.fycz.myreader.greendao.DbManager; import xyz.fycz.myreader.greendao.DbManager;
import xyz.fycz.myreader.greendao.entity.CookieBean; import xyz.fycz.myreader.greendao.entity.CookieBean;
import xyz.fycz.myreader.greendao.entity.rule.BookSource; import xyz.fycz.myreader.model.third2.analyzeRule.AnalyzeUrl;
import xyz.fycz.myreader.model.third.analyzeRule.AnalyzeUrl;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;

@ -3,24 +3,14 @@ package xyz.fycz.myreader.webapi;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.List; import java.util.List;
import java.util.regex.Matcher;
import io.reactivex.Observable; import io.reactivex.Observable;
import io.reactivex.ObservableOnSubscribe;
import io.reactivex.ObservableSource;
import io.reactivex.functions.Function;
import okhttp3.MediaType; import okhttp3.MediaType;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import xyz.fycz.myreader.entity.SearchBookBean; import xyz.fycz.myreader.entity.SearchBookBean;
import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Book;
import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.greendao.entity.Chapter;
import xyz.fycz.myreader.greendao.entity.rule.BookSource;
import xyz.fycz.myreader.model.mulvalmap.ConMVMap; import xyz.fycz.myreader.model.mulvalmap.ConMVMap;
import xyz.fycz.myreader.model.third.analyzeRule.AnalyzeUrl;
import xyz.fycz.myreader.model.third.content.BookChapterList;
import xyz.fycz.myreader.model.third.content.BookContent;
import xyz.fycz.myreader.model.third.content.BookInfo;
import xyz.fycz.myreader.model.third.content.BookList;
import xyz.fycz.myreader.util.utils.NetworkUtils; import xyz.fycz.myreader.util.utils.NetworkUtils;
import xyz.fycz.myreader.util.utils.OkHttpUtils; import xyz.fycz.myreader.util.utils.OkHttpUtils;
import xyz.fycz.myreader.webapi.crawler.base.BookInfoCrawler; import xyz.fycz.myreader.webapi.crawler.base.BookInfoCrawler;
@ -28,10 +18,8 @@ import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler;
import xyz.fycz.myreader.webapi.crawler.read.TianLaiReadCrawler; import xyz.fycz.myreader.webapi.crawler.read.TianLaiReadCrawler;
import xyz.fycz.myreader.webapi.crawler.source.ThirdCrawler; import xyz.fycz.myreader.webapi.crawler.source.ThirdCrawler;
import static xyz.fycz.myreader.common.APPCONST.JS_PATTERN;
public class BookApi {
public class CommonApi {
/** /**
* 获取章节列表 * 获取章节列表
@ -143,51 +131,4 @@ public class CommonApi {
emitter.onComplete(); emitter.onComplete();
}); });
} }
/**
* 通过api获取蓝奏云可下载直链
*
* @param lanZouUrl
* @param callback
*/
public static void getUrl(final String lanZouUrl, final ResultCallback callback) {
LanZousApi.getUrl1(lanZouUrl, new ResultCallback() {
@Override
public void onFinish(final Object o, int code) {
LanZousApi.getKey((String) o, new ResultCallback() {
final String referer = (String) o;
@Override
public void onFinish(Object o, int code) {
LanZousApi.getUrl2((String) o, new ResultCallback() {
@Override
public void onFinish(Object o, int code) {
LanZousApi.getRedirectUrl((String) o, callback);
}
@Override
public void onError(Exception e) {
callback.onError(e);
}
}, referer);
}
@Override
public void onError(Exception e) {
callback.onError(e);
}
});
}
@Override
public void onError(Exception e) {
callback.onError(e);
}
});
}
} }

@ -26,6 +26,50 @@ import xyz.fycz.myreader.util.utils.RxUtils;
*/ */
public class LanZousApi { public class LanZousApi {
/**
* 通过api获取蓝奏云可下载直链
*
* @param lanZouUrl
* @param callback
*/
public static void getUrl(final String lanZouUrl, final ResultCallback callback) {
LanZousApi.getUrl1(lanZouUrl, new ResultCallback() {
@Override
public void onFinish(final Object o, int code) {
LanZousApi.getKey((String) o, new ResultCallback() {
final String referer = (String) o;
@Override
public void onFinish(Object o, int code) {
LanZousApi.getUrl2((String) o, new ResultCallback() {
@Override
public void onFinish(Object o, int code) {
LanZousApi.getRedirectUrl((String) o, callback);
}
@Override
public void onError(Exception e) {
callback.onError(e);
}
}, referer);
}
@Override
public void onError(Exception e) {
callback.onError(e);
}
});
}
@Override
public void onError(Exception e) {
callback.onError(e);
}
});
}
/** /**
* 获取蓝奏云含有key的url * 获取蓝奏云含有key的url
* *

@ -16,11 +16,11 @@ import xyz.fycz.myreader.greendao.entity.Chapter;
import xyz.fycz.myreader.greendao.entity.CookieBean; import xyz.fycz.myreader.greendao.entity.CookieBean;
import xyz.fycz.myreader.greendao.entity.rule.BookSource; import xyz.fycz.myreader.greendao.entity.rule.BookSource;
import xyz.fycz.myreader.model.mulvalmap.ConMVMap; import xyz.fycz.myreader.model.mulvalmap.ConMVMap;
import xyz.fycz.myreader.model.third.analyzeRule.AnalyzeUrl; import xyz.fycz.myreader.model.third2.analyzeRule.AnalyzeUrl;
import xyz.fycz.myreader.model.third.content.BookChapterList; import xyz.fycz.myreader.model.third2.content.BookChapterList;
import xyz.fycz.myreader.model.third.content.BookContent; import xyz.fycz.myreader.model.third2.content.BookContent;
import xyz.fycz.myreader.model.third.content.BookInfo; import xyz.fycz.myreader.model.third2.content.BookInfo;
import xyz.fycz.myreader.model.third.content.BookList; import xyz.fycz.myreader.model.third2.content.BookList;
import xyz.fycz.myreader.util.utils.OkHttpUtils; import xyz.fycz.myreader.util.utils.OkHttpUtils;
import xyz.fycz.myreader.webapi.crawler.source.ThirdCrawler; import xyz.fycz.myreader.webapi.crawler.source.ThirdCrawler;

@ -22,7 +22,7 @@ import xyz.fycz.myreader.greendao.service.ChapterService;
import xyz.fycz.myreader.util.StringHelper; import xyz.fycz.myreader.util.StringHelper;
import xyz.fycz.myreader.util.utils.FileUtils; import xyz.fycz.myreader.util.utils.FileUtils;
import xyz.fycz.myreader.util.utils.RxUtils; import xyz.fycz.myreader.util.utils.RxUtils;
import xyz.fycz.myreader.webapi.CommonApi; import xyz.fycz.myreader.webapi.BookApi;
import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler;
public class NetPageLoader extends PageLoader { public class NetPageLoader extends PageLoader {
@ -226,7 +226,7 @@ public class NetPageLoader extends PageLoader {
* @param chapter * @param chapter
*/ */
public void getChapterContent(Chapter chapter) { public void getChapterContent(Chapter chapter) {
CommonApi.getChapterContent(chapter, mCollBook, mReadCrawler).flatMap(s -> Observable.create(emitter -> { BookApi.getChapterContent(chapter, mCollBook, mReadCrawler).flatMap(s -> Observable.create(emitter -> {
loadingChapters.remove(chapter); loadingChapters.remove(chapter);
String content = StringHelper.isEmpty(s) ? "章节内容为空" : s; String content = StringHelper.isEmpty(s) ? "章节内容为空" : s;
mChapterService.saveOrUpdateChapter(chapter, content); mChapterService.saveOrUpdateChapter(chapter, content);

@ -4,6 +4,6 @@
android:viewportWidth="24.0" android:viewportWidth="24.0"
android:viewportHeight="24.0"> android:viewportHeight="24.0">
<path <path
android:fillColor="#FF000000" android:fillColor="#FFFFFF"
android:pathData="M9,16.17L4.83,12l-1.42,1.41L9,19 21,7l-1.41,-1.41z" /> android:pathData="M9,16.17L4.83,12l-1.42,1.41L9,19 21,7l-1.41,-1.41z" />
</vector> </vector>

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/ll_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical">
<include layout="@layout/toolbar" />
<WebView
android:id="@+id/web_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white" />
</LinearLayout>

@ -33,4 +33,9 @@
android:title="@string/text_login" android:title="@string/text_login"
app:showAsAction="never" /> app:showAsAction="never" />
<item
android:id="@+id/action_clear_cookie"
android:title="@string/clear_cookie"
app:showAsAction="never" />
</menu> </menu>

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_check"
android:title="@string/success"
android:icon="@drawable/ic_check"
app:showAsAction="always" />
</menu>

@ -482,6 +482,11 @@
<string name="skip_ad">跳过 | %ds</string> <string name="skip_ad">跳过 | %ds</string>
<string name="inter_ad">插屏广告</string> <string name="inter_ad">插屏广告</string>
<string name="inter_video">插屏视频</string> <string name="inter_video">插屏视频</string>
<string name="click_check_after_success">登录成功后请点击右上角图标进行首页访问测试</string>
<string name="success">成功</string>
<string name="check_host_cookie">正在打开首页,成功自动返回主界面</string>
<string name="clear_cookie">清除Cookie</string>
<string-array name="reset_screen_time"> <string-array name="reset_screen_time">
<item>跟随系统</item> <item>跟随系统</item>

Loading…
Cancel
Save