【问题标题】:Accessing .lck and jdb files stored via web crawler访问通过网络爬虫存储的 .lck 和 jdb 文件
【发布时间】:2012-09-22 21:53:27
【问题描述】:

我目前使用crawler4j 作为我选择的网络爬虫,我正在尝试自学网络爬虫的工作原理。我已经开始爬网了,我希望它能够快速返回爬虫到下面的 crawlStorageFolder (/data/crawl/root) 中的数据

public class Controller {

    public static void main(String[] args) throws Exception {


            /*
             * crawlStorageFolder is a folder where intermediate crawl data is
             * stored.
             */
            String crawlStorageFolder =  "/data/crawl/root";


            /*
             * numberOfCrawlers shows the number of concurrent threads that should
             * be initiated for crawling.
             */
            int numberOfCrawlers = 7;



            CrawlConfig config = new CrawlConfig();

            config.setCrawlStorageFolder(crawlStorageFolder);

问题是我能找到的唯一信息是 crawlStorageFolder 位置的两个 .lck 文件和一个 .jdb 文件,我假设是数据的存储位置,但我也无法打开它们。是否有人能帮助我了解如何访问数据,以便我有希望并成功地将其输入数据库并最终将其显示在我的网站上。将不胜感激。

【问题讨论】:

    标签: java parsing web-crawler crawler4j


    【解决方案1】:

    Crawler4j 使用BerkeleyDB 来存储爬取信息。请参阅源代码中的here

    您可以从命令行使用 DB utils 来访问数据。已经涵盖在 SO here

    如果您想访问 Java 代码中的数据,只需导入 BerkeleyDB 库(Maven 指令there)并按照tutorial on how to open the DB 操作即可。

    【讨论】:

      【解决方案2】:

      您不应使用该文件夹中的数据。您应该将该数据视为爬虫的内部数据。您可以随时在 WebCrawler 的访问方法中转储/写入您的爬取数据。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-04-16
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多