【发布时间】:2020-11-04 19:48:46
【问题描述】:
from bs4 import BeautifulSoup
html = driver.page_source
soup = BeautifulSoup(html, 'html.parser')
tables = soup.select('div.GMBodyMid')
table = tables[0]
table_html = str(table)
table_df_list = pd.read_html(table_html)
table_df = table_df_list[0]
data = pd.DataFrame(table_df)
我试图获得所有课程,但只有 'GMPageFirst' 课程获得了 3 次。 我怎样才能获得“GMBodyMid”课程中的所有课程?
【问题讨论】:
-
你可以试试:tables = soup.find_all("div", class_="GMBodyMid ")
-
我认为你想做什么非常不清楚。
-
可以分享网址吗?
-
@CarlosBazilio 我试过了,但我只能提取 'GMPageFirst' 类
-
@AndrejKesely 该网站需要登录..
标签: python html python-3.x beautifulsoup web-crawler