Huginn 自定义抓取推送 smzdm 和 v2ex 的优惠信息

昨天偶然发现还有bark这样的一款自定义推送小工具,部署了之后感觉很简洁,推送也很及时。一开始只是随便给女朋友推送一点骚扰通知,后来读 RSS 的时候想起来可以用 Huginn+Bark 来筛选并及时推送优惠信息。

所需原料:

  • huginn
  • bark

Huginn 配置:

目前只抓了什么值得买和 V2EX 的二手交易区,流程图如下:

Snipaste_2018-09-07_12-13-22.png

具体配置供参考

https://gist.github.com/eko133/9672ff068967718849f88520c473e8c1

{
  "schema_version": 1,
  "name": "优惠信息",
  "description": "No description provided",
  "source_url": false,
  "guid": "863b90779850e0325ff6e55a6019d9d5",
  "tag_fg_color": "#ffffff",
  "tag_bg_color": "#5bc0de",
  "icon": "gear",
  "exported_at": "2018-09-07T04:06:31Z",
  "agents": [
    {
      "type": "Agents::WebsiteAgent",
      "name": "抓取优惠信息",
      "disabled": false,
      "guid": "11f00ab6f5fd25d66b5462a1b86aae05",
      "options": {
        "expected_update_period_in_days": "2",
        "url": "https://faxian.smzdm.com/",
        "type": "html",
        "mode": "on_change",
        "extract": {
          "url": {
            "xpath": "//*[@id=\"feed-main-list\"]/li/div/h5/a",
            "value": "@href"
          },
          "title": {
            "xpath": "//*[@id=\"feed-main-list\"]/li/div/h5/a",
            "value": "text()"
          }
        }
      },
      "schedule": "every_10m",
      "keep_events_for": 0,
      "propagate_immediately": true
    },
    {
      "type": "Agents::WebsiteAgent",
      "name": "V2EX二手交易",
      "disabled": false,
      "guid": "2900ce37b0906013cbef5c9902a09642",
      "options": {
        "expected_update_period_in_days": "2",
        "url": "https://www.v2ex.com/?tab=deals",
        "type": "html",
        "mode": "on_change",
        "extract": {
          "url": {
            "xpath": "//*[@id=\"Main\"]/div[2]/div/table/tr/td[3]/span[1]/a",
            "value": "@href"
          },
          "title": {
            "xpath": "//*[@id=\"Main\"]/div[2]/div/table/tr/td[3]/span[1]/a",
            "value": "text()"
          }
        }
      },
      "schedule": "every_10m",
      "keep_events_for": 0,
      "propagate_immediately": true
    },
    {
      "type": "Agents::DeDuplicationAgent",
      "name": "去重",
      "disabled": false,
      "guid": "391763b234b8a22ca0e8e736dabdcb7c",
      "options": {
        "property": "{{message}}",
        "lookback": "100",
        "expected_update_period_in_days": "1"
      },
      "keep_events_for": 0,
      "propagate_immediately": true
    },
    {
      "type": "Agents::EventFormattingAgent",
      "name": "V2EX url",
      "disabled": false,
      "guid": "41da102a4b0e5bf23f7aea0fd96a7ac5",
      "options": {
        "instructions": {
          "url": "https://www.v2ex.com{{url}}"
        },
        "mode": "clean"
      },
      "keep_events_for": 0,
      "propagate_immediately": true
    },
    {
      "type": "Agents::TriggerAgent",
      "name": "筛选优惠",
      "disabled": false,
      "guid": "5dc7aa3d9b10e225ae289fc32982f7d8",
      "options": {
        "expected_receive_period_in_days": "2",
        "keep_event": "true",
        "rules": [
          {
            "type": "regex",
            "value": "item1|item2|item3",
            "path": "title"
          }
        ],
        "message": "{{title}}?url={{url}}"
      },
      "keep_events_for": 0,
      "propagate_immediately": true
    },
    {
      "type": "Agents::WebsiteAgent",
      "name": "HTTP GET",
      "disabled": false,
      "guid": "c25ea9e1ece9314fa613d0600dcfa7e5",
      "options": {
        "expected_update_period_in_days": "2",
        "url": "$bark url/{{message}}",
        "type": "json",
        "mode": "on_change"
      },
      "schedule": "never",
      "keep_events_for": 0,
      "propagate_immediately": true
    }
  ],
  "links": [
    {
      "source": 0,
      "receiver": 4
    },
    {
      "source": 1,
      "receiver": 3
    },
    {
      "source": 2,
      "receiver": 5
    },
    {
      "source": 3,
      "receiver": 4
    },
    {
      "source": 4,
      "receiver": 2
    }
  ],
  "control_links": [

  ]
}

 

 

发表回复