前言
最近都在写java,但是呢我的博客似乎写了很多爬虫的文章。昨天,一个朋友发了需求给我,帮她改改代码,于是我就自己改了一下。以后还是多写一写数据平台研发的文章。
需求如下:
- 网站地址:http://bulletin.cebpubservice.com/
- 搜索关键字:银行
- 内容:招标公告
- 公告发布时间:后台自定义
- 渠道:全部
- 需要爬取的数据字段:招标公告名称、所属行业、所属地区、来源渠道、公告发布时间、距离开标时间、公告原文url(招标公告名称的链接)
代码详情
# coding:utf-8
import json
import os
import time
from copy import copy
import xlrd as xlrd
import xlwt as xlwt
from lxml import etree
import requests
import sys
from xlutils.copy import copy
class ZhaotoubiaopingtaiSpider():
url = 'http://bulletin.cebpubservice.com/xxfbcmses/search/bulletin.html'
wordkey = '银行'
startcheckDate='2019-05-01'
endcheckDate='2019-08-07'
params={
'searchDate': '1994-08-06',
'dates':'300',
'word': wordkey,
'categoryId': 88,
'startcheckDate': startcheckDate,
'endcheckDate': endcheckDate,
'industryName':'',
'area':''
}
headers = {
'Cookie': 'JSESSIONID=86C51A1A0546E2DA84226C777B97326E; acw_tc&