新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
Jsuop進(jìn)行鏈接提取
- // 檢索WebContent中的圖片和附件
- Document doc = Jsoup.parse(info.getWebc().getWebContent());
- // 當(dāng)前頁中的圖片
- Elements srcLinks = doc.select("img[src]");
- String imagesPath = "";
- for (Element link : srcLinks) {
- // 剔除標(biāo)簽,只剩鏈接路徑
- 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("---導(dǎo)入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("---導(dǎo)入WebContent中的文件---" + filePaths);
- if (!filePaths.equals("")) {
- importCopy("/html/"+strSiteID+"/"+strColumnID+"/"+keyID+"/"+filePaths, path, strInfoID,"/html/"+strSiteID+"/"+strColumnID+"/"+keyID+"/");
- }
- }
【本文是專欄作者張勇波的原創(chuàng)文章,轉(zhuǎn)載請(qǐng)通過獲取作者授權(quán)】

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


咨詢
建站咨詢
