浏览阅读

关注公众号 jb51net

关闭
三木猿阅读(电脑小说漫画阅读器) v1.0 绿色版

三木猿阅读(电脑小说漫画阅读器) v1.0 绿色版

热门排行

简介

三木猿阅读(电脑小说漫画阅读器)小说阅读器软件,三木猿阅读器适配PC平台,可以在电脑上免费浏览全网小说资源,支持分类搜索,支持智能书签,支持离线下载。并且无需注册会员,让您轻松体验PC端看小说的乐趣。

三木猿阅读器功能

在线小说资源阅读

离线下载功能

搜索框

多数据源筛选

三木猿阅读器使用

解压后打开exe文件,到浏览器输入http://localhost/,即可开始阅读,数据源有两个biquge和biquge5200,页面借用了起点。

部分代码一览

package com.aaa.data;

import com.aaa.config.SSLHelper;

import com.aaa.dto.BookCatalogueDto;

import com.aaa.entity.BookCatalogue;

import org.jsoup.Jsoup;

import org.jsoup.nodes.Document;

import org.jsoup.nodes.Element;

import org.jsoup.nodes.Node;

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 java.util.concurrent.*;

import java.util.regex.Matcher;

import java.util.regex.Pattern;

import static com.aaa.util.DataProcessing.splitList;

/**

 * [url=home.php?mod=space&uid=686208]@AuThor[/url] 杨森

 * [url=home.php?mod=space&uid=1248337]@version[/url] 1.0

 * @Title: BookCatalogue

 * [url=home.php?mod=space&uid=686237]@date[/url] 2020/8/7 15:39

 */

public class BookCatalogueDB {

private static ExecutorService executorService;

public static List<BookCatalogueDto> setDataSource(String dataSource, String bookCod,ExecutorService executorService) {

BookCatalogueDB.executorService =executorService;

SSLHelper.init();

if ("biquge5200".equals(dataSource)) {

return biquge5200(bookCod);

} else if ("biquge".equals(dataSource)) {

return biquge(bookCod);

}

return null;

}

private static List<BookCatalogueDto> biquge5200(String bookCod) {

try {

Map<Integer,List<BookCatalogueDto>> bookCatalogueDtoMaps = new HashMap<>(3);

Pattern pattern = Pattern.compile("<a\\s*href=\"?([\\w\\W]*?)\"?[\\s]*?[^>]>([\\s\\S]*?)(?=</a>)");

Document document = Jsoup.connect("https://www.biquge5200.com/" + bookCod + "/").get();

Elements dd = document.getElementsByTag("dd");

Map<Integer, List<Element>> integerListMap = splitList(dd, 3);

CountDownLatch latch=new CountDownLatch(3);

for (int i = 0; i < 3; i++) {

final int ins=i;

executorService.execute(() -> {

bookCatalogueDtoMaps.put(ins,get(integerListMap.get(ins), bookCod, document, pattern));

latch.countDown();

});

}

latch.await();

List<BookCatalogueDto> bookCatalogueDtos=new ArrayList<>(dd.size());

for (int i = 0; i < 3; i++) {

bookCatalogueDtos.addAll(bookCatalogueDtoMaps.get(i));

}

return bookCatalogueDtos;

} catch (IOException e) {

e.printStackTrace();

} catch (InterruptedException e) {

e.printStackTrace();

}finally {

executorService.shutdown();

}

return null;

}

public static List<BookCatalogueDto> get(List<Element> dd, String bookCod, Document document, Pattern pattern) {

List<BookCatalogueDto> bookCatalogueDtos = new ArrayList<>(dd.size());

Element imgurl = document.getElementById("fmimg");

Element intro = document.getElementById("intro");

Element info = document.getElementById("info");

Element child = info.child(1);

String h1 = info.select("h1").text();

for (int i = 0; i < dd.size(); i++) {

Element element = dd.get(i);

BookCatalogueDto bookCatalogueDto = new BookCatalogueDto();

BookCatalogue bookCatalogue = new BookCatalogue();

Node node = element.childNode(0);

for (Node e : element.childNodes()) {

if (!"".equals(e.toString())) {

node = e;

}

}

bookCatalogueDto.setCatalogueName(node.childNode(0).toString());

String s1 = node.toString();

Matcher matcher = pattern.matcher(s1);

if (matcher.find()) {

String nameCodeUrl = matcher.group(1);

String insStr = nameCodeUrl.substring(nameCodeUrl.lastIndexOf("/") + 1, nameCodeUrl.lastIndexOf("."));

bookCatalogueDto.setCatalogueCod(Integer.parseInt(insStr));

}

bookCatalogueDto.setBookName(h1);

bookCatalogueDto.setBookIntro(intro.text());

for(Node n :imgurl.childNodes()){

if(n.toString().matches("(.*)img(.*)")){

bookCatalogueDto.setBookImage(imgurl.childNode(0).toString());

}

}

bookCatalogueDto.setBookCod(bookCod);

bookCatalogueDto.setBookAuthor(child.text().replace("作 者:",""));

bookCatalogueDtos.add(bookCatalogueDto);

if (i + 1 < dd.size()) {

Node node1 = dd.get(i + 1).childNode(0);

Matcher matcher1 = pattern.matcher(node1.toString());

if (matcher1.find()) {

String nameCodeUrl = matcher.group(1);

String insStr = nameCodeUrl.substring(nameCodeUrl.lastIndexOf("/") + 1, nameCodeUrl.lastIndexOf("."));

bookCatalogue.setNextCode(Integer.parseInt(insStr));

}

}

}

return bookCatalogueDtos;

}

private static List<BookCatalogueDto> biquge(String bookCod) {

try {

Pattern pattern = Pattern.compile("<a\\s*href=\"?([\\w\\W]*?)\"?[\\s]*?[^>]>([\\s\\S]*?)(?=</a>)");

Document document = Jsoup.connect("https://www.biquge.com/" + bookCod + "/").get();

Map<Integer,List<BookCatalogueDto>> bookCatalogueDtoMaps = new HashMap<>(3);

Elements dd = document.getElementsByTag("dd");

Map<Integer, List<Element>> integerListMap = splitList(dd, 3);

CountDownLatch latch=new CountDownLatch(3);

for (int i = 0; i <3; i++) {

final int ins=i;

executorService.execute(()->{

bookCatalogueDtoMaps.put(ins,get(integerListMap.get(ins), bookCod, document, pattern)) ;

latch.countDown();

});

}

latch.await();

List<BookCatalogueDto> bookCatalogueDtos=new ArrayList<>(dd.size());

for (int i = 0; i < 3; i++) {

bookCatalogueDtos.addAll(bookCatalogueDtoMaps.get(i));

}

return bookCatalogueDtos;

} catch (Exception e) {

e.printStackTrace();

}finally {

executorService.shutdown();

}

return null;

}

}

大家还下载了