Commit e5fa93cf by cwy

客户端采集修改为 外部控制翻页

parent b60d852a
...@@ -423,13 +423,11 @@ public class TouTiaoArticleParse { ...@@ -423,13 +423,11 @@ public class TouTiaoArticleParse {
* @param maxBehotTime * @param maxBehotTime
* @return * @return
*/ */
public static List<Map<String,Object>> getClientMicroToutiaoCrawler(String userId, ProxyHolder proxy, public static Map<String, Object> getClientMicroToutiaoCrawler(String userId, ProxyHolder proxy,
Long maxBehotTime) { Long maxBehotTime) {
Map<String, Object> rMap = new HashMap<>();
List<Map<String,Object>> dataList = new ArrayList<>(); List<Map<String,Object>> dataList = new ArrayList<>();
String ma = "";
while(true) {
String url = "https://profile.zjurl.cn/api/feed/profile/v1/?category=profile_all&visited_uid="+userId+"&stream_api_version=82&offset="+maxBehotTime+"&version_code=7.5.3&version_name=70503&user_id="+userId+"&request_source=1&active_tab=dongtai&device_id=65&app_name=news_article"; String url = "https://profile.zjurl.cn/api/feed/profile/v1/?category=profile_all&visited_uid="+userId+"&stream_api_version=82&offset="+maxBehotTime+"&version_code=7.5.3&version_name=70503&user_id="+userId+"&request_source=1&active_tab=dongtai&device_id=65&app_name=news_article";
ma = String.valueOf(maxBehotTime);
try (Response response = httpBoot.syncCall(RequestUtils.wrapGet(url),proxy)){ try (Response response = httpBoot.syncCall(RequestUtils.wrapGet(url),proxy)){
String result = response.body().string(); String result = response.body().string();
JSONObject json = JSONObject.parseObject(result); JSONObject json = JSONObject.parseObject(result);
...@@ -472,7 +470,6 @@ public class TouTiaoArticleParse { ...@@ -472,7 +470,6 @@ public class TouTiaoArticleParse {
map.put("readNum", readNum); map.put("readNum", readNum);
map.put("commentNum", commentNum); map.put("commentNum", commentNum);
map.put("user_id", userId); map.put("user_id", userId);
System.out.println(map.toString());
dataList.add(map); dataList.add(map);
} }
} }
...@@ -480,16 +477,12 @@ public class TouTiaoArticleParse { ...@@ -480,16 +477,12 @@ public class TouTiaoArticleParse {
e.printStackTrace(); e.printStackTrace();
} }
} }
rMap.put("data", dataList);
System.out.println(" 采集到 条 == "+dataList.size() + " -- " +ma + " -- " + maxBehotTime); rMap.put("maxBehotTime", maxBehotTime);
if(ma.equals(String.valueOf(maxBehotTime))) {
break;
}
} catch (Exception e) { } catch (Exception e) {
logger.info("客户端微头条采集错误 {}",e); logger.info("客户端微头条采集错误 {}",e);
} }
} return rMap;
return dataList;
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment