项目:爬取网易job的数据
shell 命令指示符
---- 01-创建项目
scrapy startproject wangyi
items.py
---- 02-明确目标,然后在items.py文件中建模
# 这里的目标就是初始要提取的数据
import scrapy
class WangyiItem(scrapy.Item):
# define the fields for you item here like:
# 02.1 确定目标并建模
# name = scrapy.Field()
# 职位名称
name = scrapy.Field()
# 职位的详情页面链接
link = scrapy.Field()
# 所属的部门
depart = scrapy.Field()
# 职位类别
type = scrapy.Field()
# 工作地点
address = scrapy.Field()
# 招聘人数
num = scrapy.Field()
# 发布时间
data = scrapy.Field()
shell 命令指示符
---- 03-创建爬虫
# 03.1-切换到项目路径
cd wangyi
# 03.2-创建爬虫文件
scrapy genspider job 163.com
job.py
---- 04-修改完善爬虫
import scrapy
# 使用数据建模模板
from wangyi.items