[英]Having a hard time using CSS selector with beautifulsoup on flickr, am i doing something wrong?
Yes I know I should type in the code but I could not find it in the page source formatted therefore I just copied a picture of the relevant code: Trying to select overlay (Click this pick) 是的,我知道我应该输入代码,但是在格式化的页面源代码中找不到它,因此我只复制了相关代码的图片: 尝试选择覆盖(单击此选择)
So what I am trying to do is target the overlay div
, and copy the link. 所以我想做的是针对overlay div
并复制链接。 I am using pythons requests and bs4 (beautifulSoup) module. 我正在使用pythons请求和bs4(beautifulSoup)模块。
# Get the web page
res = requests.get('https://www.flickr.com/search/?=&text=new+york')
soup = bs4.BeautifulSoup(res.text)
soupElement = soup.select('div.overlay')
Yet the soupElement
returns empty. 但是soupElement
返回空。 What am I doing wrong here? 我在这里做错了什么? Is the div
not selectable or. div
不可选择的还是。
根据您的图片, overlay
是一个<a>
标签,因此'div.overlay'
应为'a.overlay'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.