我是Python的初学者。在这个问题中,他们从外汇工厂提取数据。当时的解决方案是按照他们的逻辑工作,找到 table soup.find('table', class_="calendar__table")。但是,现在网络结构已经改变,html table is removed and converted to some javascript format. 所以,这个解决方案现在找不到任何东西。
import requests
from bs4 import BeautifulSoup
r = requests.get('http://www.forexfactory.com/calendar.php?day=nov18.2016')
soup = BeautifulSoup(r.text, 'lxml')
calendar_table = soup.find('table', class_="calendar__table")
print(calendar_table)
# for row in calendar_table.find_all('tr', class_=['calendar__row calendar_row','newday']):
# row_data = [td.get_text(strip=True) for td in row.find_all('td')]
# print(row_data)
Run Code Online (Sandbox Code Playgroud)
由于我是初学者,我不知道该怎么做。那么,我该如何抓取数据呢?如果您给我任何提示,这对我会有帮助。非常感谢您阅读我的帖子。