fix process
This commit is contained in:
parent
e3ceccd14b
commit
b62b0e0f2e
|
@ -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<OFResultSet> rsList = (List<OFResultSet>)getInternal(getConfig(id));
|
||||
|
||||
Map<String, String> rm = new HashMap<>();
|
||||
Map<String, String> 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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user