Total Pageviews

5,392,719

Saturday, 22 March 2025

一个网页监控工具changedetection.io

 

简述

本次推荐一个网页监控工具 changedetection.io,能够满足一些简单的网页监控需求,例如看商品是否有货,最新的新闻热点,博主是否有更新等,可以使用Docker部署

环境

server:debian11

docker:20.10.5

docker-compose:1.25.0

docker-compose.yml文件

本次将使用docker-compose部署,以下是配置文件内容:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
version: '3'
services:
    changedetection:
        image: ghcr.io/dgtlmoon/changedetection.io
        container_name: changedetection
        hostname: changedetection
        volumes:
            - $PWD/changedetection-data:/datastore
        environment:
            - PUID=1000
            - PGID=1001
            - HIDE_REFERER=true
            - USE_X_SETTINGS=1
        ports:
            - 20041:5000
        restart: always

如果需要webdrive功能,当所需要监控的网页需要加载JS,需要使用下面的配置

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
version: '3'
services:
    changedetection:
        image: ghcr.io/dgtlmoon/changedetection.io
        container_name: changedetection
        hostname: changedetection
        volumes:
            - $PWD/changedetection-data:/datastore
        environment:
            - PUID=1000
            - PGID=1001
            - HIDE_REFERER=true
            - USE_X_SETTINGS=1
        ports:
            - 20041:5000
        restart: always

    browser-chrome:
        hostname: browser-chrome
        image: selenium/standalone-chrome-debug:3.141.59
        environment:
            - VNC_NO_PASSWORD=1
            - SCREEN_WIDTH=1920
            - SCREEN_HEIGHT=1080
            - SCREEN_DEPTH=24
        restart: always

PUID 和 PGID 并不是必要参数,可以删除。可以通过以下命令,获取

  • uid 对应 PUID

  • gid 对应 PGID

1
2
work@dodov:~$ id
uid=1000(work) gid=1001(wheel) groups=1001(wheel),112(docker)


启动

1
docker-compose up -d

使用:

访问 https://ip:20041 进入主页.

网页监控:

在首页可直接填写需要监控的网页,保存后进入编辑可以在 Filters & Triggers 模块下配置过滤参数,支持 CSS、Xpath等,展示你需要的内容.

接口监控

在监控链接处写下接口名,在 Requst 配置接口请求的各项参数,示例leetcode每日一题

URL: https://leetcode.cn/graphql/

Request method: POST

Request headers:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
accept: */*
accept-encoding: gzip, deflate, br
accept-language: zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6
content-length: 662
content-type: application/json
cookie: csrftoken=su1noAQZGXL2EHGQ2zD7mEI6wUxtbYH5x995cWsj4gyYhUTvPDwPTMKRgij7BQGi; gr_user_id=f43c345e-5aad-4db8-b1b1-739e59128e9c; _bl_uid=amlbt808uUpzRv8jzq516t25np4e; a2873925c34ecbd2_gr_last_sent_cs1=srcrs; Hm_lvt_fa218a3ff7179639febdb15e372f411c=1668226817; aliyungf_tc=d487271e8db0156e0aff8d23a3e55177e282dda596a219e03f0627a26d2cc2cd; Hm_lvt_f0faad39bcf8471e3ab3ef70125152c3=1669811765,1671021640; NEW_PROBLEMLIST_PAGE=1; a2873925c34ecbd2_gr_session_id=8f7ee875-0654-4c6e-8db2-79fee745c74b; a2873925c34ecbd2_gr_last_sent_sid_with_cs1=8f7ee875-0654-4c6e-8db2-79fee745c74b; a2873925c34ecbd2_gr_session_id_8f7ee875-0654-4c6e-8db2-79fee745c74b=true; _gid=GA1.2.1453642551.1671623897; __appToken__=; _ga=GA1.2.759171331.1664958045; _ga_PDVPZYN3CW=GS1.1.1671623897.3.1.1671624700.0.0.0; a2873925c34ecbd2_gr_cs1=srcrs; _gat=1; Hm_lpvt_f0faad39bcf8471e3ab3ef70125152c3=1671624932
origin: https://leetcode.cn
random-uuid: 370a3458-4279-300e-3749-8ce0ea283bc6
referer: https://leetcode.cn/problemset/all/
sec-ch-ua: "Not?A_Brand";v="8", "Chromium";v="108", "Microsoft Edge";v="108"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Windows"
sec-fetch-dest: empty
sec-fetch-mode: cors
sec-fetch-site: same-origin
user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36 Edg/108.0.1462.54
x-csrftoken: su1noAQZGXL2EHGQ2zD7mEI6wUxtbYH5x995cWsj4gyYhUTvPDwPTMKRgij7BQGi

Request body

{"query":"\n    query questionOfToday {\n  todayRecord {\n    date\n    userStatus\n    question {\n      questionId\n      frontendQuestionId: questionFrontendId\n      difficulty\n      title\n      titleCn: translatedTitle\n      titleSlug\n      paidOnly: isPaidOnly\n      freqBar\n      isFavor\n      acRate\n      status\n      solutionNum\n      hasVideoSolution\n      topicTags {\n        name\n        nameTranslated: translatedName\n        id\n      }\n      extra {\n        topCompanyTags {\n          imgUrl\n          slug\n          numSubscribed\n        }\n      }\n    }\n    lastSubmission {\n      id\n    }\n  }\n}\n    ","variables":{}}

通知

通知使用的是 apprise ,支持多种通知方式,可以自由选择。

开始我比较倾向于使用邮件推送,但是配置调试了很久都没有推送成功,换成了telegram推送,以下是模版:

tgram://5708982690:AAHdbaIn3DL0vdfdfd8bcab-A7O4BpWv9_gvfE/2052322177/

案例

#欣小萌最新投稿

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
General:
  URL: https://api.bilibili.com/x/space/wbi/arc/search?mid=8366990&ps=30&tid=0&pn=1&keyword=&order=pubdate&order_avoided=true&w_rid=b37f7220280dbec445b877940e8bbc36&wts=1671982474
  Time Between Check: 0 0 0 5 0

Request:
  Fetch Method: Basic fast Plaintext/HTTP Client
  Request method: GET
  Request headers: {
    accept: application/json, text/plain, */*
    accept-encoding: gzip, deflate, br
    accept-language: zh-CN,zh;q=0.9,en-AS;q=0.8,en;q=0.7
    cache-control: no-cache
    cookie: buvid3=F8D5D1C8-55E2-23AC-AA4B-CD66147A8A0488878infoc; i-wanna-go-back=-1; b_ut=7;    _uuid=938E2C3F-2567-F173-BA77-8E34C109BC47888980infoc; buvid_fp=a65c806ec103b5691068a7fe2d31f818;   buvid4=891AB099-8FE4-6031-3245-4DCA36CEBFD789604-022051401-sluv7aFmF1Lh17bDnV1PEA%3D%3D; CURRENT_FNVAL=4048;     blackside_state=1; PVID=5; b_lsid=F10E97E10F_18549E99616
    dnt: 1
    origin: https://space.bilibili.com
    pragma: no-cache
    referer: https://space.bilibili.com/8366990/video
    sec-ch-ua: "Not?A_Brand";v="8", "Chromium";v="108", "Google Chrome";v="108"
    sec-ch-ua-mobile: ?0
    sec-ch-ua-platform: "macOS"
    sec-fetch-dest: empty
    sec-fetch-mode: cors
    sec-fetch-site: same-site
    user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36
  }

Filters & Triggers:
  CSS/JSONPath/JQ/XPath Filters: json:$.data.list.vlist[0].[title]
  Notifications: tgram://5705562690:AAasdasddbaInDL0lHh8bcab-A7O4BpWv9_gvfE/2053317177/


参考


No comments:

Post a Comment