招聘关键词分析
Python爬虫设计
本次毕设系统在Python爬虫模块设计中,主要采用51Job作为数据收集来源,利用Python Request模块实现对站点岗位数据的收集与去重,动态过滤种子URL地址,写入Mysql数据库,完成工作岗位数据的采集与分析。
爬虫程序实现
部分核心代码
class HubTaskWorkSpider:
"""
51 job 网站爬虫类
"""
def __init__(self):
self.count = 1 # 记录当前爬第几条数据
self.company = []
self.desc_url_queue = Queue() # 线程池队列
self.pool = Pool(POOL_MAXSIZE) # 线程池管理线程,最大协程数
def work_spider(self):
"""
爬虫入口
"""
urls = [START_URL.format(p) for p in range(1, 16)]
for url in urls:
logger.info("爬取第 {} 页".format(urls.index(url) + 1))