当前位置: 首页>>代码示例>>Java>>正文


Java Element.data方法代码示例

本文整理汇总了Java中org.jsoup.nodes.Element.data方法的典型用法代码示例。如果您正苦于以下问题:Java Element.data方法的具体用法?Java Element.data怎么用?Java Element.data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jsoup.nodes.Element的用法示例。


在下文中一共展示了Element.data方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getEpisodeVideo

import org.jsoup.nodes.Element; //导入方法依赖的package包/类
@Override
public String getEpisodeVideo(String url) {
    String lVideoUrl = "";
    try {
        Document docdata = Jsoup.connect(url).userAgent(getUserAgent())
                .referrer(getServerUrl())
                .timeout(Parser.getParseTimeOut()).get();
        Element scriptElement = docdata.select("head").select("script").last();
        Elements downloadEle = docdata.select("li[class=bg-download]").select("a");
        if (downloadEle != null && !downloadEle.isEmpty()) {
            String downloadLink = downloadEle.get(0).attr("href");
            if (!TextUtils.isEmpty(downloadLink)) {
                lVideoUrl = getInternalVideoUrlAniUploader(downloadLink);
            }
        } else {
            String temp = "";
            String tempArray[];
            String tempVideoUrl = "";
            if (scriptElement != null) {
                temp = scriptElement.data();
                if (!TextUtils.isEmpty(temp)) {
                    tempArray = temp.split("\n");
                    for (String text : tempArray) {
                        if (text.contains("var stream")) {
                            lVideoUrl = text.substring(text.indexOf("\"") + 1, text.lastIndexOf("\""));
                        }
                    }
                }
            }
            if (lVideoUrl.contains("cdn-stream")) {
                lVideoUrl = getInternalVideoUrl(lVideoUrl);
            }
        }
    } catch (IOException e) {
        WriteLog.appendLog(Log.getStackTraceString(e));
    }
    return lVideoUrl;
}
 
开发者ID:SalmanTKhan,项目名称:MyAnimeViewer,代码行数:39,代码来源:AnimeTv.java

示例2: getInternalVideoUrl

import org.jsoup.nodes.Element; //导入方法依赖的package包/类
private String getInternalVideoUrl(String url) {
    WriteLog.appendLog("getInternalVideoUrl(" + url + ") called");
    String lVideoUrl = "";
    try {
        Document docdata = Jsoup.connect(url).userAgent(getUserAgent())
                .referrer(getServerUrl())
                .timeout(Parser.getParseTimeOut()).get();
        Elements scriptEles = docdata.select("script");
        Element script = null;
        String text = "";
        if (scriptEles != null) {
            for (int i = 0; i < scriptEles.size(); i++) {
                script = scriptEles.get(i);
                text = script.data();
                if (!text.contains("var v_src"))
                    continue;
                String[] scriptText = text.split("\r\n");
                if (scriptText != null) {
                    for (int j = 0; j < scriptText.length; j++) {
                        if (scriptText[j].contains("file:")) {
                            lVideoUrl = scriptText[j].trim();
                            lVideoUrl = lVideoUrl.substring(lVideoUrl.indexOf("h"), lVideoUrl.lastIndexOf(",") - 1).replace(" ", "%20");
                            break;
                        }
                    }
                }
                if (!TextUtils.isEmpty(lVideoUrl))
                    break;
            }
        }
    } catch (IOException e) {
        WriteLog.appendLog(Log.getStackTraceString(e));
    }
    return lVideoUrl;
}
 
开发者ID:SalmanTKhan,项目名称:MyAnimeViewer,代码行数:36,代码来源:AnimeFreak.java

示例3: ripAlbumAndGetSubalbums

import org.jsoup.nodes.Element; //导入方法依赖的package包/类
private List<String> ripAlbumAndGetSubalbums(String theUrl) throws IOException {
    int filesIndex = 0,
        filesTotal = 0,
        pageIndex = 0;
    String currentAlbumPath = null,
           url = null;

    while (pageIndex == 0 || filesIndex < filesTotal) {
        if (isStopped()) {
            break;
        }
        pageIndex++;
        if (pageIndex > 1 || pageResponse == null) {
            url = theUrl + String.format("?sort=3&page=%d", pageIndex);
            logger.info("    Retrieving " + url);
            pageResponse = Http.url(url).response();
        }
        Document albumDoc = pageResponse.parse();
        // Retrieve JSON from request
        String jsonString = null;
        for (Element script : albumDoc.select("script[type=text/javascript]")) {
            String data = script.data();
            // Ensure this chunk of javascript contains the album info
            if (!data.contains("libraryAlbumsPageCollectionData")) {
                continue;
            }
            // Grab the JSON
            Pattern p; Matcher m;
            p = Pattern.compile("^.*collectionData: (\\{.*}).*$", Pattern.DOTALL);
            m = p.matcher(data);
            if (m.matches()) {
                jsonString = m.group(1);
                break;
            }
        }
        if (jsonString == null) {
            logger.error("Unable to find JSON data at URL: " + url);
            break;
        }
        JSONObject json = new JSONObject(jsonString);
        JSONObject items = json.getJSONObject("items");
        JSONArray objects = items.getJSONArray("objects");
        filesTotal = items.getInt("total");
        currentAlbumPath = json.getString("currentAlbumPath");
        for (int i = 0; i < objects.length(); i++) {
            JSONObject object = objects.getJSONObject(i);
            String image = object.getString("fullsizeUrl");
            filesIndex += 1;
            addURLToDownload(new URL(image),
                    "",
                    object.getString("location").replaceAll(" ", "_"),
                    albumDoc.location(),
                    pageResponse.cookies());
        }
    }
    // Get subalbums
    if (url != null) {
        return getSubAlbums(url, currentAlbumPath);
    } else {
        return new ArrayList<>();
    }
}
 
开发者ID:RipMeApp,项目名称:ripme,代码行数:63,代码来源:PhotobucketRipper.java

示例4: logOldDigiflip

import org.jsoup.nodes.Element; //导入方法依赖的package包/类
private boolean logOldDigiflip(HtmlPage mainPage) throws IOException, InterruptedException, DbDriverException {

    String macAddr = null;

    Document doc = Jsoup.connect(hostUrl + "/status.htm").userAgent(USER_AGENT).header("Authorization", "Basic " + base64Login).timeout(60000).get();

    Elements data = doc.select("script");

    for (Element datum : data) {
      if (datum.data().contains("bssid_drv[0] ='")) {
        String theScript = datum.data();
        int i = theScript.indexOf("bssid_drv[0] ='");
        i += "bssid_drv[0] ='".length(); // To bypass the quote
        char c = theScript.charAt(i);
        i++;
        macAddr = "";
        while (true) {
          macAddr += c;
          c = theScript.charAt(i);
          i++;
          if (c == '\'') {
            break;
          }
        }
        break;
      }
    }

    doc = Jsoup.parse(mainPage.asXml());

    Elements elements = doc.select("html");

    System.out.println(mainPage.asXml());

    Thread.sleep(5000);

    if (macAddr == null) {
      Logger.error(host + ": Not an old digiflip.", true);
      return false;
    }

    macAddr = macAddr.replace("-", ":");
    if (!macAddr.contains(":")) {
      String tmpMac = macAddr;
      macAddr = "";
      for (int i = 0; i < macAddr.length(); i++) {
        if ((i > 0) && (i % 2 == 0)) {
          macAddr += ":";
        }
        macAddr += tmpMac.charAt(i);
      }
    }

    Logger.info(host + ": Found MAC: " + macAddr);

    Map<String, String> wifiData = new HashMap();

    wifiData.put("BSSID", macAddr.toLowerCase());
    wifiData.put("SSID", elements.get(0).select("input#ssid[name=ssid]").val());
    wifiData.put("key", elements.get(0).select("input#pskValue[name=pskValue]").val());
    wifiData.put("AuthType", "WPA/WPA2 PSK");
    wifiData.put("Encryption", "TKIP/AES");

    if ((wifiData.get("SSID") == null) && (wifiData.get("key") == null)) {
      Logger.debug(host + ": Not an old Digiflip or not WPA. FIX THIS!");
      return false;
    }

    Logger.info(host + ": Found SSID: " + wifiData.get("SSID"));
    Logger.info(host + ": Found key: " + wifiData.get("key"));
    Logger.info(host + ": Found AuthType: " + wifiData.get("AuthType"));
    Logger.info(host + ": Found Encryption: " + wifiData.get("Encryption"));

    UpdaterDao.saveStation(wifiData, host);

    return true;
  }
 
开发者ID:k0r0pt,项目名称:Project-Tauro,代码行数:78,代码来源:DigiflipScraper.java


注:本文中的org.jsoup.nodes.Element.data方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。