当前位置:网站首页>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;
}
边栏推荐
猜你喜欢
Vulnhub narak
Extrapolated scatter data
OpenGL draws colored triangles
Xiaopeng P7 hit the guardrail and the airbag did not pop up. The official responded that the impact strength did not meet the ejection requirements
Quantitative calculation research
VS2015的下载地址和安装教程
Unity3D学习笔记5——创建子Mesh
Solve msvcp120d DLL and msvcr120d DLL missing
ES6新特性
Solution to the second weekly test of ACM intensive training of Hunan Institute of technology in 2022
随机推荐
Vulnhub's cereal
Duplicate numbers in the array of sword finger offer 03
小鹏 P7 撞护栏安全气囊未弹出,官方回应称撞击力度未达到弹出要求
Vulnhub geminiinc V2
Xiaopeng P7 hit the guardrail and the airbag did not pop up. The official responded that the impact strength did not meet the ejection requirements
4000 word super detailed pointer
Simple factory and factory method mode
PHP導出word方法(一mht)
Wechat applet development - page Jump transfer parameters
Keepalived中Master和Backup角色选举策略
Raven2 of vulnhub
OPenGL 基本知识(根据自己理解整理)
MySQL searches and sorts out common methods according to time
Vulnhub geminiinc
QT OpenGL texture map
Unity3d learning notes 5 - create sub mesh
Dart: about grpc (I)
抓包整理外篇fiddler———— 会话栏与过滤器[二]
Fluent: Engine Architecture
安装electron失败的解决办法