python 爬虫爬取不到数据

程序运行后出现这个结果

img

img


代码没问题 就是获取不到网页的信息
def getData(website):
datalist= [] # 储存爬取网页信息
url= website
html= askURL(url) # 保存获取到的网页源码
# 2.逐一解析数据
soup = BeautifulSoup(html,"html.parser") # 解析器
for item in soup.find_all('div', class_="item__10RTO"):
data = []
item = str[item]
print(item)
# link = re.findall(findTime,item)[0]
# data.append(link)
# print(data)

def askURL(url):
head = { # 模拟头部信息
"User-Agent": "Mozilla / 5.0(Windows NT 10.0;Win64;x64) AppleWebKit / 537.36(KHTML, likeGecko) Chrome / 99.0.4844.74Safari / 537.36Edg / 99.0.1150.46",
"Host":"www.lagou.com",
"Accept":" text / html, application / xhtml + xml, application / xml;q = 0.9, image / webp, image / apng, * / *;q = 0.8, application / signed - exchange;v = b3;q = 0.9"
}

request = urllib.request.Request(url,headers=head)
html=""
try:
    response= urllib.request.urlopen(request)
    time.sleep(5)

    html = response.read().decode("utf-8")

except urllib.error.URLError as e:
    if hasattr(e,"code"):
        print(e.code)
    if hasattr(e,"reason"):
        print(e.reason)
print(html)
return html

https://zhuanlan.zhihu.com/p/228372115
参考

拉勾网看这里
https://mp.weixin.qq.com/s/b8yRLCb0SFhRsrfwZaCEjQ