Java에서 자체 crawljax 3.6 플러그인을 작성하려고합니다. 그것은 매우 유명한 웹 크롤러 인 crawljax에게 그가 웹 페이지에서 찾은 파일을 다운로드하도록 알려 주어야합니다. (PDF, 이미지 등). 나는 HTML이나 실제 DOM-Tree 만 원하지 않는다. 그가 찾은 파일 (PDF, jpg)에 대한 액세스 권한을 얻고 싶습니다.Crawljax를 사용하여 웹 페이지에서 파일을 다운로드하십시오.
어떻게하면 PDF 파일, 이미지 등을 다운로드 할 수 있습니까?
어떤 도움을 주셔서 감사합니다!
이
내가 기본 플러그인 (CrawlOverview)를 사용하여 지금까지 -a 새로운 클래스가 무엇 : 이미지에 관한 한import java.io.File;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import org.apache.commons.io.FileUtils;
import com.crawljax.browser.EmbeddedBrowser.BrowserType;
import com.crawljax.condition.NotXPathCondition;
import com.crawljax.core.CrawlSession;
import com.crawljax.core.CrawljaxRunner;
import com.crawljax.core.configuration.BrowserConfiguration;
import com.crawljax.core.configuration.CrawljaxConfiguration;
import com.crawljax.core.configuration.CrawljaxConfiguration.CrawljaxConfigurationBuilder;
import com.crawljax.core.configuration.Form;
import com.crawljax.core.configuration.InputSpecification;
import com.crawljax.plugins.crawloverview.CrawlOverview;
/**
* Example of running Crawljax with the CrawlOverview plugin on a single-page
* web app. The crawl will produce output using the {@link CrawlOverview}
* plugin.
*/
public final class Main {
private static final long WAIT_TIME_AFTER_EVENT = 200;
private static final long WAIT_TIME_AFTER_RELOAD = 20;
private static final String URL = "http://demo.crawljax.com";
/**
* Run this method to start the crawl.
*
* @throws IOException
* when the output folder cannot be created or emptied.
*/
public static void main(String[] args) throws IOException {
CrawljaxConfigurationBuilder builder = CrawljaxConfiguration
.builderFor(URL);
builder.addPlugin(new CrawlOverview());
builder.crawlRules().insertRandomDataInInputForms(false);
// click these elements
builder.crawlRules().clickDefaultElements();
builder.crawlRules().click("div");
builder.crawlRules().click("a");
builder.setMaximumStates(10);
builder.setMaximumDepth(3);
// Set timeouts
builder.crawlRules().waitAfterReloadUrl(WAIT_TIME_AFTER_RELOAD,
TimeUnit.MILLISECONDS);
builder.crawlRules().waitAfterEvent(WAIT_TIME_AFTER_EVENT,
TimeUnit.MILLISECONDS);
// We want to use two browsers simultaneously.
builder.setBrowserConfig(new BrowserConfiguration(BrowserType.FIREFOX,
1));
CrawljaxRunner crawljax = new CrawljaxRunner(builder.build());
crawljax.call();
}
}
모든 데이터를 얻고 표시하는 방법은 무엇입니까? http://stackoverflow.com/questions/27936719/how-to-get-crawl-content-in-crawljax – BasK