Comments (8)
目标修正
由于拉勾网数据抓取难度相对较大,所以选择了智联招聘作为抓取目标。
from mymemorandum.
最新进度
已经可以初步抓取智联招聘某一页的公司信息:
下一步的工作就是抓取全面的信息,以及抓取更多页的信息。
from mymemorandum.
最新进度
已经实现了抓取某一页面数据的函数,传入页码、地点、工作岗位、数量即可获取数据。
上图表示忽略推荐的数据,只选择已有数据。
目前正在实现主函数。
from mymemorandum.
问题
使用获取单页面数据的函数循环获取数据时,容易丢失一些数据,main函数代码如下:
function main(job){
// for(job in variables.jobs){
// console.log(`Job : ${variables.jobs[job]}`);
for(city in variables.cities){
// console.log(`City : ${variables.cities[city]}`);
var url = encodeURI(`http://sou.zhaopin.com/jobs/searchresult.ashx?bj=160000&sj=${variables.jobs[job]}&in=160400&jl=${variables.cities[city]}&p=1&isadv=0`);
(function(Job, City){
http.get(url, (res)=>{
res.setEncoding('utf-8');
var str = '';
res.on('data', (data)=>{
str += data;
});
res.on('end', function(){
var $ = cheerio.load(str);
var txt = $('span.search_yx_tj>em').text();
var jobsCount = parseInt(txt);
var pagesCount = 0;
if(jobsCount%60 === 0){
pagesCount = jobsCount/60;
}
else{
pagesCount = jobsCount/60 + 1;
}
for(var i=1; i <= pagesCount; i++){
getData(i, Job, City, jobsCount, writeFile);
}
// console.log(`${Job}方面的工作在${City}共有岗位${txt}个。`);
});
});
})(job, variables.cities[city]);
}
// }
}
感觉到最后总是会漏掉很多数据,不知道是什么原因,需要解决。
问题尚未解决...
from mymemorandum.
最新进度
虽然上一个问题还没有解决,但是我已经继续前进,少一部分数据对我的影响并不是很大。今天已经可以爬取几乎所有数据了,并且我通过命令行传递参数,非常方便。
第三个参数是工作岗位,还可以有第四个参数是工作地点。
采集结果:
现已采集到MongoDB数据库中,已有数据26940余条(所有数据截止到2018/02/07)。
下一步的任务是准备写一个展示页面。
from mymemorandum.
最新进度
前端使用React框架,已经完成图表显示组件,能够显示出基本图表。
from mymemorandum.
最新进度
from mymemorandum.
总结
总结发布在博客:我的博客
整个项目基本完结。
from mymemorandum.
Related Issues (13)
- 异步组件和webpack优化 HOT 1
- 最近学习计划
- scoped css 无效 HOT 3
- 学习计划
- 最近计划(Express + React)——2018.02.13 HOT 1
- 最近计划(Parcel + async/await)——2018.02.13 HOT 3
- 最近计划(Node Stream)——2018.02.14 HOT 1
- 最近计划(Underscore源码阅读)——2018.02.17 HOT 6
- 最近计划(Python学习)——2018.03.14 HOT 5
- 并行学习任务——排序算法以及算法的复杂度 HOT 3
- 明天答辩啦! HOT 2
- 最近计划(Linux学习)——2018.06.11 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mymemorandum.