1
我試圖捕獲此頁面上的訪問次數,但python返回沒有文本的標籤。使用請求和BeautifulSoup - Python返回沒有文本的標籤
這就是我所做的。
import requests
from bs4 import BeautifulSoup
r = requests.get("http://www.kijiji.ca/v-2-bedroom-apartments-condos/city-of-halifax/clayton-park-west-condo-style-luxury-2-bed-den/1016364514")
soup = BeautifulSoup(r.content)
print soup.find_all("span",{"class":"ad-visits"})
確實的Python必須打開Firefox的檢索infromation? – JohnT 2014-09-23 13:56:57
你可以使用firefox的'無頭',或者你也可以使用硒的另一個webdriver,但你需要有一個環境,它會呈現JavaScript。 – dataisbeautiful 2014-09-23 14:00:35
你是什麼意思無頭的?你的代碼如何改變 – JohnT 2014-09-24 01:06:51