diff --git a/src/main/java/com/loafle/overflow/crawler/Crawler.java b/src/main/java/com/loafle/overflow/crawler/Crawler.java index b4b4184..907b935 100644 --- a/src/main/java/com/loafle/overflow/crawler/Crawler.java +++ b/src/main/java/com/loafle/overflow/crawler/Crawler.java @@ -3,9 +3,11 @@ package com.loafle.overflow.crawler; import com.fasterxml.jackson.databind.ObjectMapper; import com.loafle.overflow.crawler.config.Config; +import com.loafle.overflow.crawler.result.OFResultSet; import java.io.File; import java.util.HashMap; +import java.util.List; import java.util.Map; /** @@ -32,7 +34,21 @@ public abstract class Crawler { return true; } public Object get(String id) throws Exception { - return getInternal(getConfig(id)); + + List rsList = (List)getInternal(getConfig(id)); + + Map rm = new HashMap<>(); + Map m = null; + for (OFResultSet rs : rsList) { + m = rs.getData(); + rm.putAll(m); + } + + ObjectMapper mapper = new ObjectMapper(); + + String json = mapper.writeValueAsString(rm); + + return json.getBytes(); } public Object init(byte [] data) throws Exception { add(data);