Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

想请教下,爬取的url信息储存到BDB中字段属性的相关说明 #51

Open
newCheng opened this issue Dec 1, 2016 · 1 comment

Comments

@newCheng
Copy link

newCheng commented Dec 1, 2016

@yxssfxwzy
Copy link

参考以下代码 :-)

\cn\edu\hfut\dmic\webcollector\util\CrawlDatumFormater.java

public static CrawlDatum jsonStrToDatum(String crawlDatumKey, String jsonStr) {
        JsonArray jsonArray = GsonUtils.parse(jsonStr).getAsJsonArray();
        CrawlDatum crawlDatum = new CrawlDatum();
        crawlDatum.key(crawlDatumKey);
        crawlDatum.url(jsonArray.get(0).getAsString());
        crawlDatum.setStatus(jsonArray.get(1).getAsInt());
        crawlDatum.setExecuteTime(jsonArray.get(2).getAsLong());
        crawlDatum.setExecuteCount(jsonArray.get(3).getAsInt());
        if (jsonArray.size() == 5) {
            JsonObject metaJsonObject = jsonArray.get(4).getAsJsonObject();
            crawlDatum.meta(metaJsonObject);
        }
        return crawlDatum;
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants