【发布时间】:2020-12-30 19:22:08
【问题描述】:
我一直在尝试从网址https://www.binance.com/en/futures/funding-history/0 中提取表格数据。
以下代码仅提取表格的一部分(仅标题)。
import requests
from bs4 import BeautifulSoup
r = requests.get('https://www.binance.com/en/futures/funding-history/0')
soup = BeautifulSoup(r.text, 'html.parser')
resultsTable = soup.findChildren('table')[0]
rows = resultsTable.findChildren(['tr'])
print(rows)
我有什么遗漏的或者有更好的想法来完成这项工作吗?
【问题讨论】:
-
你缺少的是表格是由JS动态加载的,所以BeautifulSoup不会看到它。
标签: python-3.x web-scraping beautifulsoup