簡體   English   中英

在flickr上將CSS選擇器與beautifulsoup結合使用時遇到困難,我做錯了嗎?

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM