Cnodejs 内容区域数据采集

var list = topic_list.querySelectorAll('.cell');
var data_list = [];
for(var item of list){
  var obj = {};
  obj.user_avatar = item.querySelector('.user_avatar img').getAttribute('src');
  obj.count_of_replies = item.querySelector('.count_of_replies').innerText;
  obj.count_of_visits = item.querySelector('.count_of_visits').innerText;
  obj.last_active_time = item.querySelector('.last_active_time').innerText;
  obj.topic_title = item.querySelector('.topic_title').innerText;
  obj.put_top=item.querySelector('.put_top')?true:false;
  obj.put_good=item.querySelector('.put_good')?true:false;
  data_list.push(obj);
}
JSON.stringify(data_list)
上一篇:BOM与DOM


下一篇:Javascript的知识整理(9)