BufferError版本4.10,python版本是3.9的
说明BufferError类是没有这个函数的,你要想知道内容为什么不用beautifulsoup函数,你都调用了
import requests
from bs4 import BeautifulSoup as bs
#以豆瓣‘编程’分类的一个连接URL为例子开始爬数据ID
url = 'https://book.douban.com/tag/编程?start=20&type=T'
res = requests.get(url) #发送请求
#print(res.encoding) #这个是用来查看网页编码的
#res.encoding = 'utf-8'
html = res.text
#print(html)
IDs = []
soup = bs(html,"html.parser") #定义一个BeautifulSoup变量
items = soup.find_all('a',attrs={'class':'nbg'})
用这种不行么