SuperAPI AI 工具集

scrapling-official

编程与开发

查看项目

更新于 10-15 20:30

技能介绍

用途:Scrapling 是自适应网页抓取框架,覆盖单次请求到大规模爬取。解析器能学习网站变化,在页面更新后自动重新定位元素;抓取器可开箱绕过 Cloudflare Turnstile 等反爬系统;爬虫框架支持并发、多会话、暂停/恢复与自动代理轮换。

主要能力:HTTP 请求(get/post/put/delete)、浏览器抓取(fetch)、隐身浏览器抓取(stealthy-fetch);CSS/XPath/BeautifulSoup 风格选择器;Spider、CrawlSpider、SitemapSpider、XMLFeedSpider、CSVFeedSpider、ShopifySpider 等模板;开发模式缓存响应便于调试。

使用方式:需 Python 3.10+。安装:pip install "scrapling[all]>=0.4.15",再执行 scrapling install --force。也可用 Docker:docker pull pyd4vinci/scrapling 或 ghcr.io/d4vinci/scrapling:latest(仅命令行)。CLI 示例:scrapling extract get "https://example.com" page.html;scrapling extract fetch "https://example.com" content.md --network-idle;scrapling extract stealthy-fetch "https://example.com" data.txt --solve-cloudflare。可用 -s/--css-selector 提取指定内容。命令行抓取必须加 --ai-targeted 以防提示注入,浏览器命令下该参数还会自动启用广告拦截。

适用场景:简单站点/博客/新闻用 get;现代动态网页用 fetch;受保护站点、Cloudflare 或反爬系统用 stealthy-fetch。不确定时从 get 开始,失败再升级。

限制:Cloudflare 通过自动化解决,无需求解器或凭据;代理与 CDP 模式可选,由用户提供;cdp_url、user_data_dir、代理认证等参数由库内部校验,用户仍需自行注意。临时文件用后应清理;优先 .md 输出,需解析结构时用 .html。更多功能需编写 Python 代码。具体收费、价格与平台支持暂未提供。