Skip to main content

AutoScraperX

AutoScraperX 是一个基于 Selenium 和 undetected_chromedriver 的通用爬虫框架,旨在提供强大而灵活的 Web 自动化功能。它支持自动化浏览、元素操作、页面截图、cookie 管理等功能,适用于各种爬取任务。

功能特点

  • 支持多种浏览器选项(无头模式、用户数据目录、自定义 Chrome 位置等)
  • 支持移动端仿真(iPhone X 模拟)
  • 智能等待机制,确保元素加载完毕再进行操作
  • 页面截图,可保存完整网页截图
  • Cookie 读写,支持持久化登录
  • 自动滚动、刷新、切换标签页等操作
  • 异常处理,确保爬虫稳定运行

安装

确保你的环境中安装了以下依赖:

pip install selenium undetected-chromedriver beautifulsoup4

此外,请下载并配置相应的 WebDriver,例如 ChromeDriver。

使用方法

初始化爬虫

from AutoScraperX import common_spider  # 确保 Spider 类已正确导入

options = {
    'headless': True,  # 以无头模式运行
    'binary_location': "C:\\Path\\To\\chrome.exe",  # 指定 Chrome 位置
    'user_data_dir': "C:\\Users\\User\\AppData\\Local\\Google\\Chrome\\User Data",
    'driver_executable_path': "C:\\Path\\To\\chromedriver.exe"
}

spider = common_spider.Spider(options)

打开网页

spider.open("https://example.com")

获取页面源码

html = spider.get_source()
print(html)

等待元素加载

spider.wait_element("//div[@id='content']", by=By.XPATH)

进行交互

spider.comment("测试评论", "#comment-box")

保存截图

spider.save_screenshot("screenshot.png")

处理 Cookie

spider.save_cookie("cookies.pkl")
spider.load_cookie("cookies.pkl", domain="example.com")

退出爬虫

spider.quit()

贡献

如果你对 AutoScraperX 有任何改进建议或贡献,请提交 PR 或 Issue。

联系方式

Metadata

Release files for AutoScraperX 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for AutoScraperX 0.1.2
File Size Uploaded Provenance
autoscraperx-0.1.2.tar.gz 6.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for AutoScraperX 0.1.2
File Interpreter ABI Platform
AutoScraperX-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 13.3 kB

Release files / autoscraperx-0.1.2.tar.gz

Download URL autoscraperx-0.1.2.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
538be83acb8cff97386baf5fd25d1d3c86db9f3234f7605dc226f5b2883dbe21
BLAKE2b-256 checksum
How to use checksums
b07e308a5683b06cf89c9eda3274665dfb52e99ab4dcab55c7bb414cd46fdfb8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.7

Release files / AutoScraperX-0.1.2-py3-none-any.whl

Download URL AutoScraperX-0.1.2-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b51b485b7585f9a281c8b58e5314556925fc1defe52921360f601edba69c11f0
BLAKE2b-256 checksum
How to use checksums
57e32081ae500f2d2b8f11e7bb7735687799b2912ba072607e3e212b0c7fa5b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.7

Security for AutoScraperX 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page