尝试从 Python BS 中的网站抓取 table 时出现 AttributeError

AttributeError while attempting to grab table from a website in Python BS

我不确定此代码段是否适用于此 url 或页面。我尝试了 运行 url 中的脚本,但出现了 AttributeError。

from selenium import webdriver
import requests
from bs4 import BeautifulSoup

browser = webdriver.Chrome('C://Python38/chromedriver')
browser.get("https://poocoin.app/rugcheck/0xe56842ed550ff2794f010738554db45e60730371/top-holders")
url = "https://poocoin.app/rugcheck/0xe56842ed550ff2794f010738554db45e60730371/top-holders"

r = requests.get(url)
soup = BeautifulSoup(r.text, 'lxml')
t = soup.find('table', class_='table table-bordered table-condensed text-small')
trs = t.find('tbody').find_all('tr')
for tr in trs[:10]:
    print(list(tr.stripped_strings))
browser.quit()

当前 Output/Error:

    Traceback (most recent call last):
    File "C:/Users/Acer/poocoin.py", line 8, in <module>
    trs = t.find('tbody').find_all('tr')
    AttributeError: 'NoneType' object has no attribute 'find'

因为 table 完全依赖于 javascript。我还将 HTMLSession 与 BeautifulSoup 一起使用,但没有出现任何错误也没有输出。如果您更喜欢 selenium 和 scrapy,那么我可以帮助您。谢谢