根据微博关键字爬取微博内容的时候,url需要注意
这样可以
url = "https://m.weibo.cn/api/container/getIndex?containerid=100103type%3D1%26q%3D{}&page_type=searchall&page={}"
#keyword是关键字,page是页数
response = requests.get(url.format(keyword, page), headers=headers)
这样不行(爬取不到内容)
url = "https://m.weibo.cn/api/container/getIndex?containerid=100103type%3D1%26q%3D" + keyword +"&page_type=searchall&page=" + str(page)
#keyword是关键字,page是页数
response = requests.get(url, headers=headers)