Ejemplo n.º 1
0
  @Override // 因為原檔就是utf8了,所以無須轉碼
  public String getAllPageString(String urlString) {
    if (urlString.matches(".*/")) {
      urlString = urlString.substring(0, urlString.length() - 1);
    }

    String indexName = Common.getStoredFileName(SetUp.getTempDirectory(), "index_ck_", "html");
    // Common.downloadFile( urlString, SetUp.getTempDirectory(), indexName, false, "" );
    Common.simpleDownloadFile(urlString, SetUp.getTempDirectory(), indexName, urlString);

    return Common.getFileString(SetUp.getTempDirectory(), indexName);
  }
Ejemplo n.º 2
0
  private void handleTitlePic(String tagName, String text) {
    String picName = tagName + ".jpg";
    int beginIndex = text.indexOf("anim_intro_ptext");
    if (beginIndex < 0 || new File(getBaseOutputDirectory() + picName).exists()) {
      return;
    }
    beginIndex = text.indexOf("src=", beginIndex);
    beginIndex = text.indexOf("\"", beginIndex) + 1;
    int endIndex = text.indexOf("\"", beginIndex);

    if (beginIndex <= 0 || endIndex <= 0) {
      return;
    }

    String picURL = text.substring(beginIndex, endIndex).replaceAll("\\s", "%20");
    print(tagName + "圖片網址:" + picURL);
    Common.simpleDownloadFile(picURL, getBaseOutputDirectory(), picName, "", webSite);
  }