qq_53075651 2025-10-23 15:00 采纳率: 0%
浏览 5

需要爬取企查查里面的企业股权比例、经营范围、经营地址等内容,我看见您有一个博客是有说关于企查查爬虫方面的

您好,我现在这边有个难点,需要爬取企查查里面的企业股权比例、经营范围、经营地址等内容,我看见您有一个博客是有说关于企查查爬虫方面的,可以找您深入了解一下吗

  • 写回答

4条回答 默认 最新

  • 阿里嘎多学长 2025-10-23 15:01
    关注

    阿里嘎多学长整理AIGC生成,因移动端显示问题导致当前答案未能完全显示,请使用PC端查看更加详细的解答过程

    解决方案

    根据您的需求,我推荐使用 Selenium + ChromeDriver + Beautiful Soup 来实现企查查爬虫。具体步骤如下:

    1. 安装依赖
    pip install selenium beautifulsoup4
    
    1. 配置 ChromeDriver 下载 ChromeDriver 并配置环境变量。
    2. 编写爬虫代码
    from selenium import webdriver
    from bs4 import BeautifulSoup
    import time
    
    # 配置 ChromeDriver
    driver = webdriver.Chrome()
    
    # 访问企查查页面
    url = "https://www.qichacha.com"
    driver.get(url)
    
    # 等待页面加载
    time.sleep(2)
    
    # 获取页面源码
    html = driver.page_source
    
    # 使用 Beautiful Soup 解析 HTML
    soup = BeautifulSoup(html, 'html.parser')
    
    # 提取企业信息
    enterprise_info = soup.find('div', {'class': 'enterprise-info'})
    
    # 提取股权比例、经营范围、经营地址等内容
    stock_ratio = enterprise_info.find('span', {'class': 'stock-ratio'}).text
    business_scope = enterprise_info.find('span', {'class': 'business-scope'}).text
    business_address = enterprise_info.find('span', {'class': 'business-address'}).text
    
    print("股权比例:", stock_ratio)
    print("经营范围:", business_scope)
    print("经营地址:", business_address)
    
    # 关闭浏览器
    driver.quit()
    

    注意

    • 请确保 ChromeDriver 版本与 Chrome 浏览器版本匹配。
    • 请注意企查查的反爬虫机制,避免被封禁。
    • 请遵守相关法律法规,确保爬虫行为合法。
    评论

报告相同问题?

问题事件

  • 创建了问题 10月23日