url='http://image.baidu.com/search/index?tn=baiduimage&ct=201326592&lm=-1&cl=2&ie=gbk&word=%D0%C7%BF%D5&fr=ala&ori_query=%E6%98%9F%E7%A9%BA&ala=0&alatpl=sp&pos=0'
html=urllib.urlopen(url).read()
soup=BeautifulSoup(html)
a=soup.find_all('img')
len(a)
6
b=re.findall(r'img',html)
len(b)
414
c=re.findall('data-imgurl',html)
len(c)
0
为什么获取不到data-imgurl的内容啊,img的内容用bs4也大多获取不到。。。。。查看网页源码也看不到data-imgurl。。只能查找的到。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
打开源文件
看到第487行的JS代码,其中插入了一块JSON格式的数据
其中hoverURL对应的项是图片的url,然后objURL是原图片的url
都是ajax怎么匹配到
建议题主考虑使用 phantomjs