/**
* Created by on 2018/12/25.
*/
const http = require("https");
const fs = require('fs'); //读取html插件
const cheerio = require("cheerio"); //读取的文件路径
const filePath = './山炮表格.xlsx'; //表格插件
const xlsx = require('node-xlsx'); const sheets = xlsx.parse('./山炮表格.xlsx');//获取到所有sheets let allUserId = [];
sheets.forEach(function (sheet) {
// console.log(sheet['name']);
for (var rowId in sheet['data']) {
// console.log(rowId);
var row = sheet['data'][rowId];
// console.log(row);
allUserId.push(row);
}
});
// console.log(allUserId); //微博搜索用户页
const findUserUrl = 'https://s.weibo.com/user';
let hasVUser = []
let index = 1;
function getV(allIds, index) {
let theCurrentId = allIds[index][1];
let theUrl = 'https://s.weibo.com/user?q=' + theCurrentId + '&Refer=SUer_box';
console.log(theUrl)
http.get(''+theUrl, res => {
let html = "";
// 获取页面数据
res.on("data", function (data) {
html += data;
});
// 数据获取结束
res.on("end", function () {
let $ = cheerio.load(html);
// console.log($('.icon-vip').length);
if($('.icon-vip').length>0){
hasVUser.push(theCurrentId);
}
if(index<allIds.length-1){
index++
getV(allIds,index);
}else{
console.log(hasVUser,'所有带v')
}
});
});
} getV(allUserId,index);
});
{
"dependencies": {},
"devDependencies": {
"cheerio": "^1.0.0-rc.2",
"fs": "0.0.1-security",
"node-xlsx": "^0.12.1"
}
}

最新文章

  1. 如何用Perl截取报文
  2. 并列统计CASE WHEN
  3. Web页面报错: Eval()、XPath() 和 Bind() 这类数据绑定方法只能在上下文中使用
  4. POJ 2828 Buy Tickets(线段树 树状数组/单点更新)
  5. Unity3D Shader入门指南(一)
  6. 理解C#中的闭包
  7. 微信支付开发(2) 静态链接Native支付
  8. mysql自动备份策略
  9. C/C++中的变量作用域
  10. HDOJ 2018 母牛的故事
  11. ANDROID 中设计模式的採用--创建型模式
  12. 初学grunt压缩
  13. SpringMVC+MyBatis 事务管理一
  14. centos 批量杀死进程
  15. git配置全局用户名
  16. css 两段对齐和超出部分...
  17. python脚本批量复制文件
  18. 修改别人写的Hibernate数据库操作代码
  19. jsonp 实现跨域
  20. Eclipse 不能build, pom文件上面有叉叉 解决办法

热门文章

  1. N-Gram的数据结构
  2. HBase预分区方法
  3. 编写高质量代码改善C#程序的157个建议——建议116:避免用非对称算法加密文件
  4. Java知多少虚拟机(JVM)以及跨平台原理
  5. VC:GetWindowRect、GetClientRect、ScreenToClient与ClientToScreen
  6. ZT 基于git的版本管理思路
  7. hello world! hello blog!
  8. 2、ASP .NETCore 2.0之视图
  9. ES6—— 变量的结构赋值
  10. solr7.3集群搭建