simonw/shot-scraper

GitHub: simonw/shot-scraper

一款基于 Playwright 的 CLI 工具,用于自动化截取网页截图、录制视频演示并通过 JavaScript 抓取网站数据。

Stars: 2510 | Forks: 123

# shot-scraper [![PyPI](https://img.shields.io/pypi/v/shot-scraper.svg)](https://pypi.org/project/shot-scraper/) [![更新日志](https://img.shields.io/github/v/release/simonw/shot-scraper?include_prereleases&label=changelog)](https://github.com/simonw/shot-scraper/releases) [![测试](https://static.pigsec.cn/wp-content/uploads/repos/cas/ce/ce733292a922c08274cf5a2096f8fa4cf01023bfa51a36ef6beecaaef371a9d9.svg)](https://github.com/simonw/shot-scraper/actions?query=workflow%3ATest) [![许可证](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/shot-scraper/blob/master/LICENSE) [![discord](https://img.shields.io/discord/823971286308356157?label=discord)](https://discord.gg/EE7Hx4Kbny) 一款用于截取网站截图、录制视频演示以及使用 JavaScript 抓取网站的 CLI 工具 有关此项目的背景信息,请参阅 [shot-scraper:基于 Playwright 构建的文档自动化截图工具](https://simonwillison.net/2022/Mar/10/shot-scraper/)。 ## 文档 - [shot-scraper 完整文档](https://shot-scraper.datasette.io/) - [教程:使用 shot-scraper 自动化截取 Datasette 文档的截图](https://simonwillison.net/2022/Oct/14/automating-screenshots/) - [发布说明](https://github.com/simonw/shot-scraper/releases) ## 通过 GitHub Actions 快速开始 若要在不安装任何软件的情况下开始使用,请使用 [shot-scraper-template](https://github.com/simonw/shot-scraper-template) 模板创建你自己的 GitHub 仓库,该仓库会使用 `shot-scraper` 对页面进行截图。详情请参阅 [即刻创建一个 GitHub 仓库来截取网页截图](https://simonwillison.net/2022/Mar/14/shot-scraper-template/)。 ## 快速安装 你可以使用 [pip](https://pip.pypa.io/) 安装 `shot-scraper` CLI 工具: ``` pip install shot-scraper # 现在安装它所需的浏览器: shot-scraper install ``` ## 截取你的第一张截图 你可以像这样截取网页截图: ``` shot-scraper https://datasette.io/ ``` 这将会把截图保存到一个名为 `datasette-io.png` 的文件中。 还有更多可用选项,详情请参阅 [截取截图](https://shot-scraper.datasette.io/en/stable/screenshots.html)。 ## 示例 - [shot-scraper-demo](https://github.com/simonw/shot-scraper-demo) 仓库使用此工具,根据[此页面](https://www.owlsnearme.com/?place=127871) 的数据,捕捉在加州 El Granada 最近被发现的猫头鹰,并生成了一张带有注释的截图,用于说明 Datasette 的某项功能,具体描述见[我的博客](https://simonwillison.net/2022/Mar/10/shot-scraper/#a-complex-example)。 - [Datasette 文档](https://docs.datasette.io/en/latest/) 中使用的截图,是由在 [simonw/datasette-screenshots](https://github.com/simonw/datasette-screenshots) GitHub 仓库中运行的 `shot-scraper` 生成的,详情请参阅 [使用 shot-scraper 自动化截取 Datasette 文档的截图](https://simonwillison.net/2022/Oct/14/automating-screenshots/)。 - Ben Welsh 开发了 [@newshomepages](https://twitter.com/newshomepages),这是一个 Twitter 机器人,它利用 `shot-scraper` 和 GitHub Actions 截取新闻网站的主页并将其发布到 Twitter 上。其源码位于 [palewire/news-homepages](https://github.com/palewire/news-homepages) 仓库中。 - [scrape-hacker-news-by-domain](https://github.com/simonw/scrape-hacker-news-by-domain) 使用 `shot-scraper javascript` 来抓取网页。有关其工作原理的详情,请参阅 [使用 shot-scraper 从命令行抓取网页](https://simonwillison.net/2022/Mar/14/scraping-web-pages-shot-scraper/)。 - 路透社使用 shot-scraper 来生成[用于电子邮件通讯的](https://twitter.com/palewire/status/1658069533763026944)定期更新的数据仪表盘。
标签:Playwright, Python, 文档结构分析, 无后门, 特征检测, 网络调试, 网页截图, 自动化, 逆向工具