抓取角度列表数据


import requests
from bs4 import BeautifulSoup
url= requests.get('https://angel.co/companies').text
soup= BeautifulSoup(url, 'lxml')
for div in soup.find_all("div", class_="name"):
    print(div.text)

我想打印公司列表的名称,但它什么也没打印。

import requests
from selenium import webdriver
from bs4 import BeautifulSoup
import time
driver=webdriver.Chrome()
driver.get('https://angel.co/companies?locations[]=1637-Dubai,+AE')
time.sleep(10)
soup= BeautifulSoup(driver.page_source, 'lxml')
name_data = []
for item in soup.select('.name'):
    name=item.text.strip()
    name_data.append(name)
    print(name)

driver.quit()

它工作正常

最新更新