2016-11-18 154 views
1

我試圖解析以下HTML網頁:空標籤內容與Beautifulsoup

http://www.oddsportal.com/soccer/france/ligue-1/results/

,以提取標籤內的數據 「DIV ID = tournamentTable」 設在這裏:

body > div class="wrap" > div id="mother-main" > div id="mother > div id="wrap" > div id="box-top" > div id="box-bottom" > div id="main" > div id="col-left" > div id="col-content" > div id="tournamentTable" 

然而,當我運行下面的代碼:

f=urllib.request.urlopen("http://www.oddsportal.com/soccer/france/ligue-1/results/") 
html = f.read() 
soup = BeautifulSoup.BeautifulSoup(html, "html.parser") 
soup.find_all("div",id="tournamentTable") 

我在標籤div id =「tournamentTable」內沒有任何東西。我無法獲取Table中的數據:class =「table-main」。

讓我知道你是否有解決方案。

謝謝!

+1

數據由瀏覽器使用JavaScript動態加載,而不是直接在初始源HTML中加載。使用硒。 –

+1

根據Alex的說法進行擴展,如果您轉到該頁面並按Ctrl-U查看源代碼,則會看到html本身中沒有該div中的任何內容。 – user3030010

回答

相關問題