坏了,scrapy爬虫构造请求,但是没有params参数

解决思路

  • from urllib.parse import urlencode
api = "https://blog.csdn.net/community/home-api/v1/get-business-list"
params = {
    "page": 1,
    "size": 20,
    "businessType": "lately",
    "noMore": "false",
}
url = api + '?' + urlencode(params)
yield scrapy.Request(
    url,
    callback=self.parse_list
)

你可能感兴趣的:(scrapy,爬虫)