如何解析事件监听器 由bs4提供?

问题描述 投票:0回答:1

此代码显示表为空,但这不是因为网页填充表借助一些js代码。所以我不知道如何解析它。请告诉我如何解析它。

import bs4 as bs
import urllib.request

source = urllib.request.urlopen('https://monerobenchmarks.info/').read()
soup = bs.BeautifulSoup(source,'lxml')

table = soup.find('table')
table_rows = table.find_all('tr')
for tr in table_rows:
    td = tr.find_all('td')
    row = [i.text for i in td]
    print(row)
python beautifulsoup event-listener html-tbody
1个回答
0
投票
BeautifulSoup无法等待Javascript完成,您所要求的是不可能的。尤其是因为您使用的是urllib来获取页面(如果您使用请求,那将是相同的,仅仅是因为BeautifulSoup缺少执行Javascript代码的引擎)。
© www.soinside.com 2019 - 2024. All rights reserved.