[英]Having a hard time using CSS selector with beautifulsoup on flickr, am i doing something wrong?
是的,我知道我應該輸入代碼,但是在格式化的頁面源代碼中找不到它,因此我只復制了相關代碼的圖片: 嘗試選擇覆蓋(單擊此選擇)
所以我想做的是針對overlay div
並復制鏈接。 我正在使用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')
但是soupElement
返回空。 我在這里做錯了什么? div
不可選擇的還是。
根據您的圖片, overlay
是一個<a>
標簽,因此'div.overlay'
應為'a.overlay'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.