Commit 9a4a0346 by yangchen

头条历史文章 内部循环 错误修改

parent e3db22e4
......@@ -119,16 +119,17 @@ public class TouTiaoArticleParse {
* @throws Exception
*/
public static Map<String, Object> getTouTiaoHistory(String user_id, String max_behot_time,Date endData, Proxy proxy ) throws Exception{
for(int i=0;i<3;i++){
Signature signature = new Signature(user_id, max_behot_time);
String as=signature.getAs();
String cp=signature.getCp();
String _signature = signature.getSignature();
String url = "https://www.toutiao.com/c/user/article/?page_type=1&user_id="+user_id+"&max_behot_time="+max_behot_time+"&count=20&as="+as+"&cp="+cp+"&_signature="+_signature;
System.out.println(url);
Map<String,String> headerMap = new HashMap<String,String>();
headerMap.put("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.80 Safari/537.36");
headerMap.put("referer","https://www.toutiao.com/c/user/"+user_id+"/");
String htmlBody = null;
for(int i=0;i<3;i++){
try {
htmlBody = httpBoot.syncCall(RequestUtils.wrapGet(url, headerMap), proxy).body().string();
if(htmlBody != null && htmlBody.contains("behot_time")){
......@@ -296,6 +297,7 @@ public class TouTiaoArticleParse {
labelList = data.getJSONArray("label").toJavaList(String.class);
tt.setLabelList(labelList);
}
System.out.println(tt.toString());
dataList.add(tt);
}
} catch (Exception e) {
......
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