Issue
I am not sure if this snippet works with this url or page. I tried running the script in the url but I am getting an 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()
Current 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'
Solution
Because the table fully depends on javascript. I also used HTMLSession with BeautifulSoup and didn't get any error along with no output. If you prefer to selenium with scrapy then I can help you. Thanks
Answered By - Fazlul
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.