translated

This commit is contained in:
geekpi 2022-10-08 08:39:07 +08:00
parent 18506f42bf
commit af7b0d48b6
2 changed files with 102 additions and 102 deletions

View File

@ -1,102 +0,0 @@
[#]: subject: "Get change alerts from any website with this open source tool"
[#]: via: "https://opensource.com/article/22/9/changedetection-io-open-source-website-changes"
[#]: author: "Leigh Morresi https://opensource.com/users/dgtlmoon"
[#]: collector: "lkxed"
[#]: translator: "geekpi"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Get change alerts from any website with this open source tool
======
Use changedetection.io to get alerts when a website makes changes or updates.
![Browser of things][1]
The year was 2020, and news about COVID-19 came flooding in so quickly that everyone felt completely overwhelmed with similar news articles providing updates with varying degrees of accuracy.
But all I needed to know was when my official government guidelines changed. In the end, that's all that mattered to me.
Whether the concern is a pandemic or just the latest tech news, keeping ahead of changes in website content can be critical.
The [changedetection.io][2] project provides a simple yet highly capable, open source solution for website change detection and notification. It's easy to set up, and it can notify over 70 (and counting) different notification systems, such as Matrix, Mattermost, [Nextcloud][3], [Signal][4], [Zulip][5], [Home Assistant][6], email, and more. It also notifies proprietary applications like Discord, Office365, Reddit, Telegram, and many others.
But [changedetection.io][7] isn't just limited to watching web page content. You can also monitor XML and JSON feeds, and it will build an RSS feed of the websites that changed.
Thanks to its built-in JSON simple storage system, there's no need to set up complicated databases to receive and store information. You can [run it as a Docker image][8] or install it with `pip`. The project has an [extensive wiki help section][9], and most common questions are covered there.
For sites using complex JavaScript, you can connect your changedetection.io installation to a Chromium or Chrome browser with the built-in [Playwright content fetcher][10].
Once running, access the application in your browser (`http://localhost:5000`, by default). You can set a password in the **Settings** section if your computer can be reached from an outside network.
![change detection watch list][11]
Submit the URL of a page you want to monitor. There are several settings related to how the page is filtered. For example, you more than likely do not want to know when a company's stock price listed in their site footer has changed, but you may want to know when they post a news article to their blog.
### Monitor a site
Imagine you want to add your favorite website, Opensource.com, to be monitored. You only want to know when the main call-out article contains the word "python" and you want to be notified over Matrix.
To do this, begin with the **visual-selector** tool. (This requires the **playwright** browser interface to be connected.)
![Find an element to monitor][12]
The **visual-selector** tool automatically calculates the best Xpath or CSS filter to target the content. Otherwise, you would get a lot of noise from the daily page updates.
Next, visit the **Filters & Triggers** tab.
![Filters and triggers][13]
In **CSS/JSON/XPATH Filter** field (the blue circle), you can see the automatically generated CSS filter from the previous step.
There are several useful filters available, such as **Remove elements** (good for removing noisy elements), **Ignore text, Trigger/wait for text,** and **Block change-detection if text matches** (used for waiting for some text to disappear, like "sold out").
In **Trigger/wait for text** (the red circle), type in the keyword you want to monitor for. (That's "python" in this example.)
The final step is in the **Notifications** tab, where you configure where you want to receive your notification. Below I added a Matrix room as the notification target, using the Matrix API.
![Notifications tab][14]
The notification URL is in the format of `matrixs://username:password@matrix.org/#/room/#room-name:matrix.org`
However, [t2Bot][15] format is also supported. Here are more [Matrix notification options][16].
And that's it! Now you'll receive a message over Matrix whenever the content changes.
### There's more
There's so much more to changedetection.io. If you prefer calling a custom JSON API, you don't have to use an API for notifications (use `jsons://` ). You can also create a custom HTTP request (POST and GET), execute JavaScript before checking (perhaps to pre-fill a username and password login field), and many more interesting features, with more to come.
Stop browsing the web and start watching the web instead!
Image by: (Leigh Morresi, CC BY-SA 4.0)
--------------------------------------------------------------------------------
via: https://opensource.com/article/22/9/changedetection-io-open-source-website-changes
作者:[Leigh Morresi][a]
选题:[lkxed][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/dgtlmoon
[b]: https://github.com/lkxed
[1]: https://opensource.com/sites/default/files/lead-images/browser_desktop_website_checklist_metrics.png
[2]: https://github.com/dgtlmoon/changedetection.io
[3]: https://opensource.com/tags/nextcloud
[4]: https://opensource.com/article/19/10/secure-private-messaging
[5]: https://opensource.com/article/22/3/open-source-chat-zulip
[6]: https://opensource.com/article/20/11/home-assistant
[7]: https://github.com/dgtlmoon/changedetection.io
[8]: https://github.com/dgtlmoon/changedetection.io#docker
[9]: https://github.com/dgtlmoon/changedetection.io/wiki
[10]: https://github.com/dgtlmoon/changedetection.io/wiki/Playwright-content-fetcher
[11]: https://opensource.com/sites/default/files/2022-09/screenshot.png
[12]: https://opensource.com/sites/default/files/2022-09/changedetect-osdc.png
[13]: https://opensource.com/sites/default/files/2022-09/changedetect-filters-triggers.webp
[14]: https://opensource.com/sites/default/files/2022-09/step3-notification-matrix.png
[15]: https://t2bot.io/
[16]: https://github.com/caronc/apprise/wiki/Notify_matrix

View File

@ -0,0 +1,102 @@
[#]: subject: "Get change alerts from any website with this open source tool"
[#]: via: "https://opensource.com/article/22/9/changedetection-io-open-source-website-changes"
[#]: author: "Leigh Morresi https://opensource.com/users/dgtlmoon"
[#]: collector: "lkxed"
[#]: translator: "geekpi"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
用这个开源工具从任何网站获取变化提醒
======
使用 changeetection.io 在网站发生变化或更新时获得提醒。
![Browser of things][1]
那一年是 2020 年,关于 COVID-19 的消息迅速涌来,每个人都感到完全被只是提供了不同程度的更新的类似新闻所淹没,。
但我需要知道的是,我的官方政府准则何时改变。最后,这就是对我来说最重要的事情。
无论关注的是大流行病还是最新的科技新闻,提前了解网站内容的变化都至关重要。
[changedetection.io][2] 项目为网站变更检测和通知提供了一个简单但强大的开源解决方案。它很容易设置,而且可以通知 70 多个不同的通知系统,如 Matrix、Mattermost、[Nextcloud][3]、[Signal][4]、[Zulip][5]、[Home Assistant][6]、电子邮件等等。它还能通知专有应用,如 Discord、Office365、Reddit、Telegram 和许多其他应用。
但 [changeetection.io][7] 并不只是局限于观察监测内容。你也可以监视 XML 和 JSON 源,它将建立一个 RSS 源,记录变化的网站。
由于其内置的 JSON 简单存储系统,不需要设置复杂的数据库来接收和存储信息。你可以[使用 Docker 镜像运行][8]或用 `pip` 安装它。该项目有一个[全面的维基帮助页][9],大多数常见的问题都有涵盖。
对于使用复杂 JavaScript 的网站,你可以用内置的 [Playwright 内容获取器][10]将你的 changeetection.io 安装到 Chromium 或 Chrome 浏览器。
运行后,在你的浏览器(默认情况下是 `http://localhost:5000`)中访问该应用。如果你的电脑可以从外部网络访问,你可以在**设置**中设置一个密码。
![change detection watch list][11]
提交你想监控的页面的 URL。有几个设置与如何过滤该网页有关。例如你很可能不想知道一家公司在其网站页脚列出的股票价格何时发生变化但你可能想知道他们在其博客上发布的新闻文章。
### 监控一个网站
想象一下,你想添加你最喜欢的网站 Opensource.com 进行监控。 你只想知道主要标注文章何时包含 “python” 一词,并且通过 Matrix 收到通知。
要做到这点,首先要使用**视觉选择器**工具。(这需要连接 **playwright** 浏览器界面)。
![Find an element to monitor][12]
**视觉选择器**工具会自动计算出针对内容的最佳 Xpath 或 CSS 过滤器。否则,你会从每天的页面更新中得到大量的噪音。
接下来,访问**过滤器和触发器**标签。
![Filters and triggers][13]
在 **CSS/JSON/XPATH 过滤器**区域(蓝色圆圈),你可以看到上一步自动生成的 CSS 过滤器。
有几个有用的过滤器,比如**移除元素**(适合移除嘈杂的元素),**忽略文本,触发/等待文本**,和**如果文本匹配则阻止变化检测**(用于等待一些文本消失,如“售罄”)。
在**触发/等待文本**(红色圆圈)中,输入你想监测的关键词。(在这个例子中是 “python”
最后一步是在**通知**选项卡中,你要在那里配置你想收到的通知。下面我使用 Matrix API 添加了一个 Matrix 房间作为通知目标。
![Notifications tab][14]
通知的 URL 的格式是 `matrixs://username:password@matrix.org/#/room/#room-name:matrix.org`
然而,[t2Bot][15] 格式也被支持。这里有更多的 [Matrix 通知选项][16]。
就是这些了! 现在只要内容有变化,你就会通过 Matrix 收到信息。
### 还有更多
changedetection.io 还有很多东西。如果你喜欢调用一个自定义的 JSON API你不需要使用通知的 API使用 `jsons://` )。你还可以创建一个自定义的 HTTP 请求POST 和 GET在检查前执行 JavaScript也许是为了预先填充一个用户名和密码的登录字段以及更多有趣的功能更多的功能将陆续推出。
不要再浏览网站,而是开始监测网络吧!
图片提供:(Leigh Morresi, CC BY-SA 4.0)
--------------------------------------------------------------------------------
via: https://opensource.com/article/22/9/changedetection-io-open-source-website-changes
作者:[Leigh Morresi][a]
选题:[lkxed][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/dgtlmoon
[b]: https://github.com/lkxed
[1]: https://opensource.com/sites/default/files/lead-images/browser_desktop_website_checklist_metrics.png
[2]: https://github.com/dgtlmoon/changedetection.io
[3]: https://opensource.com/tags/nextcloud
[4]: https://opensource.com/article/19/10/secure-private-messaging
[5]: https://opensource.com/article/22/3/open-source-chat-zulip
[6]: https://opensource.com/article/20/11/home-assistant
[7]: https://github.com/dgtlmoon/changedetection.io
[8]: https://github.com/dgtlmoon/changedetection.io#docker
[9]: https://github.com/dgtlmoon/changedetection.io/wiki
[10]: https://github.com/dgtlmoon/changedetection.io/wiki/Playwright-content-fetcher
[11]: https://opensource.com/sites/default/files/2022-09/screenshot.png
[12]: https://opensource.com/sites/default/files/2022-09/changedetect-osdc.png
[13]: https://opensource.com/sites/default/files/2022-09/changedetect-filters-triggers.webp
[14]: https://opensource.com/sites/default/files/2022-09/step3-notification-matrix.png
[15]: https://t2bot.io/
[16]: https://github.com/caronc/apprise/wiki/Notify_matrix