用Jsoup进行链接提取
来源:互联网 发布:国际数据分析师认证 编辑:程序博客网 时间:2024/04/27 13:53
项目用到对文章内的图片和附件连接进行提取
// 检索WebContent中的图片和附件Document doc = Jsoup.parse(info.getWebc().getWebContent());// 当前页中的图片Elements srcLinks = doc.select("img[src]");String imagesPath = "";for (Element link : srcLinks) {// 剔除标签,只剩链接路径String imagesPaths = link.attr("src");String ht = imagesPaths.substring(0, 4);String htt = imagesPaths.substring(0, 1);if (!ht.equals("http") && htt.equals("/")) {imagesPath = imagesPaths.trim().replaceAll(ContextPath, "");imagesPath = imagesPath.substring(imagesPath.lastIndexOf("/") + 1);} else {imagesPath = "";}//System.out.println("---导入WebContent中的图片---" + imagesPath);if (!imagesPath.equals("")) {importCopy("/html/"+strSiteID+"/"+strColumnID+"/"+keyID+"/"+imagesPath, path, strInfoID,"/html/"+strSiteID+"/"+strColumnID+"/"+keyID+"/");}}// 提取所有的href连接String filePaths = "";Elements linehrefs = doc.select("a[href]");for (Element link : linehrefs) {filePaths = link.attr("href").trim().replaceAll(ContextPath, "");filePaths = filePaths.substring(filePaths.lastIndexOf("/") + 1);//System.out.println("---导入WebContent中的文件---" + filePaths);if (!filePaths.equals("")) {importCopy("/html/"+strSiteID+"/"+strColumnID+"/"+keyID+"/"+filePaths, path, strInfoID,"/html/"+strSiteID+"/"+strColumnID+"/"+keyID+"/");}}
0 0
- 用Jsoup进行链接提取
- jsoup 提取 html中的所有链接
- Httpclient 和jsoup结和提取网页内容(某客学院视频链接)
- jsoup进行html处理
- 用正则表达式提取网页中的链接
- JSoup获取网页中的链接
- jsoup提取连接下载网站图片
- jsoup提取连接下载网站图片
- jsoup提取连接下载网站图片
- 菜鸟请教高手。。如何用C++ 提取与网页进行链接?
- Swift - 使用NSDataDetector进行URL验证,及提取字符串中所有链接
- 提取网页所有链接
- 提取html中的链接
- 特征提取资源链接
- 利用爬虫在b站搜动漫找链接,第一次用jsoup 0.0
- jsoup示例程序: 获取所有链接
- jsoup替换网页中的链接demo
- 用HttpWebRequest和正则表达式提取网页中的链接
- u-boot移植总结(二)LED点灯调试 和 u-boot加载地址
- 通过金矿模型介绍动态规划
- C#弱类型Dataset和强类型Dataset
- beta分布
- 通过金矿模型介绍动态规划
- 用Jsoup进行链接提取
- 文件映射内存使用方法
- Thread Local Storage
- 通过金矿模型介绍动态规划
- WebBrowser页面与WinForm交互技巧
- 长连接与短连接
- 求解sizeof(X)
- 基于稀疏表示的人脸识别 (SRC,LASRC,RASL,MRR)
- WebBrowser页面与WinForm交互技巧