# coding=gbk
# -*- coding:uft-8 -*-
import requests
import urllib.parse
import execjs
import time
def collect(city, area):
# name 想要搜索的关键字
name = '网贷'
wordType = 1
# startDate 开始时间
startDate = '2020-01-01'
# endDate 结束时间
endDate = '2022-01-09'
baseUrl = '/api/SearchApi/index'
addUrl = f'?area={area}&word=[[%7B%22name%22:%22{urllib.parse.quote(name)}%22,%22wordType%22:{wordType}%7D]]&startDate={startDate}&endDate={endDate}'
headers = {
'Referer': '/v2/main/index.html',
'Cookie': '',
'User-Agent': 'Mozilla/5.0(WindowsNT10.0;Win64;x64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/91.0.4472.106Safari/537.36'
}
res = requests.get(url=baseUrl + addUrl, headers=headers).json()
allData = res['data']['us
摆渡爬虫代码
于 2022-05-15 15:40:56 首次发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)