【问题标题】:Scrape the angellist startup data抓取angellist启动数据
【发布时间】:2020-05-21 06:01:40
【问题描述】:

我想从https://angel.co/companies?locations[]=1688-United+States 抓取数据。谁能指导我该怎么做?

我知道我应该使用 BeautifulSoup 或 Selenium,但最终我发现这个网页不是静态的,它会随时更改其数据,谁能指导我完成它?

我认为 angellist API 网页不再工作了。

【问题讨论】:

  • 能不能加上你要提取的,数据格式。
  • @vish 使用 Selenium
  • 你好 @tek nath 如果你打开 angel.co/companies?locations[]=1688-United+States 这个 URL,你会看到一个表,我想提取带有列的表(公司、位置、市场、网站、员工、总筹集)这 6 列我要提取

标签: python selenium web-scraping beautifulsoup scrapy


【解决方案1】:

您需要等待几秒钟才能生成页面上的表格:

from selenium import webdriver
import os
import time

chrome_driver = os.path.abspath(os.path.dirname(__file__)) + '/chromedriver'
browser = webdriver.Chrome(chrome_driver)
browser.get("https://angel.co/companies?locations[]=1688-United+States")
time.sleep(3)

data_row = browser.find_elements_by_class_name('base.startup')

for item in data_row:
    print('-'*100)
    company = item.find_element_by_class_name('name').text
    location = item.find_element_by_class_name('column.location').text
    print(company)
    print(location)

输出:

----------------------------------------------------------------------------------------------------
WP Engine
Austin
----------------------------------------------------------------------------------------------------
Kissmetrics
San Francisco
----------------------------------------------------------------------------------------------------
Bluesmart
San Francisco
----------------------------------------------------------------------------------------------------
Star.me
Los Angeles
...
...

【讨论】:

  • 您好,当我使用此路径“\Users\Dell User\Downloads\Compressed\chromedriver_win32”时,它会显示错误:SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 0 -1:截断\UXXXXXXXX 转义请帮助
  • @Zarakai Kenpachi 你能做一个正确的路径 C:\Users\Dell User\Downloads\Compressed\chromedriver_win32 我应该怎么写?我试过 chrome_driver = "C:\\Users\\Dell User\\Downloads\\Compressed\\chromedriver_win32" 仍然无法正常工作,显示找不到路径
  • @vish 对不起,不要测试。我是 Linux 用户
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-11-19
  • 2020-06-30
相关资源
最近更新 更多