当前位置:网站首页>Jsup crawls Baidu Encyclopedia
Jsup crawls Baidu Encyclopedia
2022-07-03 12:07:00 【Dull Yanan】
download Jsoup Of jar rely on , Add to project file
getMessage() Method to enter the content you want to encyclopedia , Function return Encyclopedia ;
public String getMessage(String search) throws Exception
{
String url="https://baike.baidu.com/item/"+search;
URL url1=new URL(url);
Document doc1= Jsoup.parse(url1,1000);
Elements eles=doc1.getElementsByAttributeValue("name","description");
String f1= String.valueOf(eles);
String s[]=f1.split("=");
String str=s[2];
String pattern = "[\\w\\u4e00-\\u9fa5\\u3002\\uff1b\\uff0c\\uff1a\\u201c\\u201d\\uff08\\uff09\\u3001\\uff1f\\u300a\\u300b]";
String ans=" ";
Pattern r = Pattern.compile(pattern);
Matcher m = r.matcher(str);
while (m.find()) {
String data = m.group();
ans=ans+data;
}
return ans;
}
边栏推荐
- Wrong arrangement (lottery, email)
- SLF4J 日志门面
- Go语言实现静态服务器
- (construction notes) grasp learning experience
- Sheet1$.输出[Excel 源输出].列[XXX] 出错。返回的列状态是:“文本被截断,或者一个或多个字符在目标代码页中没有匹配项。”。
- vulnhub之cereal
- 2022年湖南工学院ACM集训第二次周测题解
- Colleagues wrote a responsibility chain model, with countless bugs
- Download address and installation tutorial of vs2015
- PHP导出word方法(一phpword)
猜你喜欢

PHP导出word方法(一mht)

PHP export word method (one MHT)

vulnhub之cereal

2022年湖南工学院ACM集训第二次周测题解

Groovy test class and JUnit test

【mysql专项】读锁和写锁

Visual studio 2022 downloading and configuring opencv4.5.5

(构造笔记)ADT与OOP

rxjs Observable filter Operator 的实现原理介绍
![Capturing and sorting out external Fiddler -- Conversation bar and filter [2]](/img/04/e9cc027d753e7049f273d866eefdce.png)
Capturing and sorting out external Fiddler -- Conversation bar and filter [2]
随机推荐
ArcGIS应用(二十一)Arcmap删除图层指定要素的方法
DEJA_VU3D - Cesium功能集 之 053-地下模式效果
Momentum of vulnhub
Unity3d learning notes 5 - create sub mesh
Dart: About zone
Php Export word method (One MHT)
解决msvcp120d.dll和msvcr120d.dll缺失
libvirt 中体验容器
PHP导出word方法(一phpword)
CGroup introduction
Shardingsphere sub database and sub table < 3 >
Shutter: overview of shutter architecture (excerpt)
(construction notes) learning experience of MIT reading
OpenGL 索引缓存对象EBO和线宽模式
Vulnhub's cereal
《剑指offer 04》二维数组查找
(construction notes) learn the specific technology of how to design reusable software entities from three levels: class, API and framework
shardingSphere分库分表<3>
Shell: basic learning
PHP export word method (phpword)