一个简单的小python爬虫,因为时间原因,没有做翻页,谅解。
写的不好,希望大家互相进步,一起成长
后续将会更新Selenium,pyquery,scrapy,Ajax,动态代理,分布式scrapy等一些相关爬虫博客,请多关注
爬取中华英才网特定地区的大数据工程师招聘信息并插入到数据库
from bs4 import BeautifulSoup
import requests
import pymysql
page = 'http://www.chinahr.com/sou/?city=34%2C398%3B36%2C400%3B37%2C401%3B25%2C292%3B25%2C291&keyword=%E5%A4%A7%E6%95%B0%E6%8D%AE'
respone = requests.get(page)
respone.encoding = 'utf-8'
soup = BeautifulSoup(respone.text, 'lxml')
urlResult = soup.select('.jobList .l1 .e1 a')
dateResult = soup.select('.jobList .l1 .e2')
company = soup.select('.jobList .l1 span a')
addrAndNeeds = soup.select('.jobList .l2 .e1')
wagesResult = soup.select('.jobList .l2 .e2')
for i in company:
if i.string == None:
company.remove(i)
db = pymysql.c