Skip to main content

🕷️ SuperSpider

反检测 Web 爬虫库 — 基于 Camoufox 反检测浏览器,轻松绕过 Cloudflare、Akamai、PerimeterX 等反爬系统。

Python License PyPI

✨ 特性

  • 🛡️ 反检测 — 基于 Camoufox,自动绕过主流反爬系统
  • 🔌 REST API — 通过 camofox-browser 服务,支持远程控制
  • 🎯 简洁 API — 一行代码获取页面,类似 Selenium/Playwright
  • 🌐 代理支持 — 内置 SOCKS5/HTTP 代理配置
  • 📊 结构化提取 — 支持 CSS 选择器和 JSON Schema 提取
  • 🔍 搜索引擎 — 内置 Google/Bing/DuckDuckGo 搜索

📦 安装

pip install super_requests

🚀 快速开始

基础用法

from super_requests import SuperSpider

with SuperSpider() as spider:
    # 获取页面 HTML
    html = spider.fetch("https://example.com")
    
    # 获取页面信息
    title = spider.get_title()
    url = spider.get_url()
    
    # 爬取链接
    links = spider.scrape_links()
    for link in links:
        print(f"{link['text']} -> {link['href']}")
    
    # 爬取表格
    data = spider.scrape_table("table")
    for row in data:
        print(row)

带代理

from super_requests import SuperSpider, BrowserConfig, ProxyConfig

proxy = ProxyConfig(
    host="50.3.64.229",
    port=443,
    username="your-username",
    password="your-password",
    protocol="socks5"
)

config = BrowserConfig(proxy=proxy)

with SuperSpider(config) as spider:
    html = spider.fetch("https://example.com")

搜索引擎

with SuperSpider() as spider:
    # Google 搜索
    spider.google_search("Camoufox 反检测浏览器")
    results = spider.scrape_links("#search a")
    
    # Bing 搜索
    spider.bing_search("Python 爬虫")
    results = spider.scrape_links("#b_results a")

交互操作

with SuperSpider() as spider:
    # 导航
    spider.navigate("https://example.com/login")
    
    # 填写表单
    spider.type_text('input[name="username"]', "myuser")
    spider.type_text('input[name="password"]', "mypass")
    
    # 点击按钮
    spider.click('button[type="submit"]')
    
    # 等待页面加载
    spider.wait_for("#dashboard")
    
    # 滚动加载
    spider.scroll(500)
    
    # 获取内容
    html = spider.get_html()

JavaScript 执行

with SuperSpider() as spider:
    spider.navigate("https://example.com")
    
    # 执行任意 JavaScript
    result = spider.evaluate("""
        Array.from(document.querySelectorAll('h2'))
            .map(el => el.textContent.trim())
    """)
    print(result["result"])  # ['标题1', '标题2', ...]
    
    # 结构化提取
    schema = {
        "type": "object",
        "properties": {
            "title": {"type": "string", "x-ref": "e1"},
            "description": {"type": "string", "x-ref": "e2"}
        }
    }
    data = spider.extract(schema)

📋 API 参考

SuperSpider

方法 说明
fetch(url, wait=2.0, auto_scroll=False) 一步获取页面 HTML
navigate(url, wait=2.0) 导航到 URL
click(selector) 点击元素
type_text(selector, text, mode="fill") 输入文字
scroll(pixels=500) 滚动页面
wait_for(selector, timeout=10.0) 等待元素出现
evaluate(expression) 执行 JavaScript
get_html() 获取页面 HTML
get_text(selector="body") 获取元素文本
get_url() 获取当前 URL
get_title() 获取页面标题
scrape_links() 爬取所有链接
scrape_table(selector="table") 爬取表格
google_search(query) Google 搜索
bing_search(query) Bing 搜索
duckduckgo_search(query) DuckDuckGo 搜索

BrowserConfig

参数 类型 默认值 说明
server_url str http://localhost:9377 camofox-browser 服务地址
user_id str super_requests 用户标识
timeout int 30 请求超时(秒)
proxy ProxyConfig None 代理配置

ProxyConfig

参数 类型 默认值 说明
host str - 代理主机
port int - 代理端口
username str None 代理用户名
password str None 代理密码
protocol str socks5 代理协议

🏗️ 依赖

SuperSpider 需要 camofox-browser 服务运行:

# 安装 camofox-browser
npm install -g @askjo/camofox-browser

# 启动服务
camofox-browser --port 9377

📄 License

MIT License - 详见 LICENSE

🔗 相关项目

Metadata

Release files for camoufox-spider 0.1.0

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

Source distribution (sdist)

Source distribution for camoufox-spider 0.1.0
File Size Uploaded Provenance Actions
camoufox_spider-0.1.0.tar.gz 13.8 kB Without provenance Details for camoufox_spider-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for camoufox-spider 0.1.0
File Interpreter ABI Platform Actions
camoufox_spider-0.1.0-py3-none-any.whl Python 3 none any Details for camoufox_spider-0.1.0-py3-none-any.whl

Total release size: 28.6 kB

Release files / camoufox_spider-0.1.0.tar.gz

Download URL camoufox_spider-0.1.0.tar.gz
Size 13.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e5cdaa5a6c848001c4f75423919d5cb0e909b3b1c521eb6113b41a76b4178db9
BLAKE2b-256 checksum
How to use checksums
6c46e7295ca33ba8ed55e008b853437757553e86946fc9037e21817a6fb51ecc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / camoufox_spider-0.1.0-py3-none-any.whl

Download URL camoufox_spider-0.1.0-py3-none-any.whl
Size 14.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6dc9784ec00d74bedbf8cb17ea7fe1dfb9629e091d8c7b7f1776d7a4184b6a91
BLAKE2b-256 checksum
How to use checksums
26340003421c1b2a95f0745d2a23c398524c9db1d64e622942162b413658de88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for camoufox-spider 0.1.0

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 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