pythonのWebスクラップに関するクローズ・アップ・ノウの知識。PythonでWebページからテーブルを取得
私はthisページからテーブルを取得する必要があります:
http://performance.morningstar.com/funds/etf/total-returns.action?t=IWF
私が興味の表は、このです:これはどのような私です (テーブルの上のチャートを無視)
現在:
from selenium import webdriver
from bs4 import BeautifulSoup
# load chrome driver
driver = webdriver.Chrome('C:/.../chromedriver_win32/chromedriver')
# load web page and get source html
link = 'http://performance.morningstar.com/funds/etf/total-returns.action?t=IWF'
driver.get(link)
html = driver.page_source
# make soup and get all tables
soup = BeautifulSoup(html, 'html.parser')
tables = soup.findAll('table',{'class':'r_table3'})
tbl = tables[1] # ideally we should select table by name
ここからはどこに進んでいますか?ので、ここで
あなたはBeautifulSoupとセレンの両方を使用している具体的な理由はありますか? – Goralight
私は、ページがJavaScriptで埋め込まれているときに、最初に読み込んでからbeautifulsoupを解析する必要があると言われましたか? –
私はそれが問題であると言っているわけではありませんでした。あなたがそれを必要とした理由に骨が欠けていました。あなたはテーブル全体が必要ですか?または特定の細胞ですか? – Goralight