Commit fcee33bb by chenweitao

增加脉脉采集名称长度日志

parent 630ed695
...@@ -48,7 +48,6 @@ public class MaiMaiHotSearchCrawler { ...@@ -48,7 +48,6 @@ public class MaiMaiHotSearchCrawler {
if (name.length()>750){ if (name.length()>750){
name = name.substring(0,750); name = name.substring(0,750);
} }
// log.info(name);
String maimaiUrl = jsonObject.getString("share_url"); String maimaiUrl = jsonObject.getString("share_url");
String icon = null; String icon = null;
if (jsonObject.containsKey("hot_type_card")) { if (jsonObject.containsKey("hot_type_card")) {
...@@ -57,6 +56,9 @@ public class MaiMaiHotSearchCrawler { ...@@ -57,6 +56,9 @@ public class MaiMaiHotSearchCrawler {
String hotValue = jsonArray.getJSONObject(i).getJSONObject("common").getString("hot_info"); String hotValue = jsonArray.getJSONObject(i).getJSONObject("common").getString("hot_info");
Long count = hotValue.length() > 0 ? TipsUtils.getHotCount(hotValue) : 0; Long count = hotValue.length() > 0 ? TipsUtils.getHotCount(hotValue) : 0;
HotSearchList hotSearchList = new HotSearchList(maimaiUrl, name, count, null, rank, HotSearchType.脉脉热榜.name(), icon, date); HotSearchList hotSearchList = new HotSearchList(maimaiUrl, name, count, null, rank, HotSearchType.脉脉热榜.name(), icon, date);
if (hotSearchList.getName().length()>800){
log.info("脉脉数据名称过长,长度为:{},内容:{}",hotSearchList.getName().length(),hotSearchList.getName());
}
list.add(hotSearchList); list.add(hotSearchList);
} }
} }
......
package com.zhiwei.searchhotcrawler.dao; package com.zhiwei.searchhotcrawler.dao;
import com.mongodb.MongoWriteException;
import com.mongodb.client.MongoCollection; import com.mongodb.client.MongoCollection;
import com.zhiwei.searchhotcrawler.bean.HotSearchList; import com.zhiwei.searchhotcrawler.bean.HotSearchList;
import com.zhiwei.searchhotcrawler.config.DBConfig; import com.zhiwei.searchhotcrawler.config.DBConfig;
...@@ -283,8 +284,10 @@ public class HotSearchCacheDAO { ...@@ -283,8 +284,10 @@ public class HotSearchCacheDAO {
collection.insertOne(nowDoc); collection.insertOne(nowDoc);
} }
} }
} catch (Exception e) { }catch (MongoWriteException e1){
log.error("数据存储时出错:", e); log.error("数据写入时出错,数据为【{}】:", document,e1);
}catch (Exception e) {
log.error("数据存储时出错,数据为【{}】:", document,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