这个爬取图片的程序无法正常运行是为什么,求解答

img

img

1.百度图片的话,请求头需要带上自己的cookie (按F12里面可以找到)
2.正则有问题
代码如下:

import requests
import re
headers={"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36",
"cookie":""}
url='https://image.baidu.com/search/index?tn=baiduimage&ipn=r&ct=201326592&cl=2&lm=-1&st=-1&sf=1&fmq=&pv=&ic=0&nc=1&z=&se=1&showtab=0&fb=0&width=&height=&face=0&istype=2&ie=utf-8&fm=index&pos=history&word=%E6%9D%A8%E6%B4%8B'
res=requests.get(url,headers=headers)
res.encoding='utf-8'
pic=re.findall('"thumbURL":"(.*?)"',res.text)
print(pic)
print(len(pic))

正则表达式的错误