新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
Jsuop進行鏈接提取
- // 檢索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+"/");
- }
- }
【本文是專欄作者張勇波的原創(chuàng)文章,轉載請通過獲取作者授權】

創(chuàng)新互聯(lián)-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設、高性價比洮北網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式洮北網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設找我們,業(yè)務覆蓋洮北地區(qū)。費用合理售后完善,10年實體公司更值得信賴。
新聞標題:Jsuop進行鏈接提取
本文路徑:http://m.fisionsoft.com.cn/article/djisggd.html


咨詢
建站咨詢
