from selenium import webdriver
from lxml import etree
from bs4 import BeautifulSoup
import time
import pandas as pd
urls = ["https://solana.com/ecosystem"]
wd = webdriver.Chrome()
wd.get(urls[0])
time.sleep(30)
resp =wd.page_source
html = BeautifulSoup(resp,"lxml")
temp = html.find_all("div", class_="link-unstyled d-inline-block")
urls=[]
for i in temp:
url = i['href']
print(url)
urls.append(url)
print(urls)
首先你这个网站似乎是需要开国外代理才能访问到的,然后我查了一下,class_="link-unstyled d-inline-block" 有这个样式的是a标签而不是div。
因此,应该是
temp = html.find_all("a", class_="link-unstyled d-inline-block")
https://solana.com/ecosystem 这个网站访问404,没法爬取到数据