Skip to content

we-thoughts/insights-grappler

Repository files navigation

Insights Grappler

周期性抓取官方发布的政策或通知,推送给订阅者。

监测目标

中央

  • 中华人民共和国中央人民政府:首页 > 政策 > 最新

    根据列表中标题后面的日期判断是否是新数据,将新数据写入目标数据库中。

山西

使用说明

运行

EXE 版本已经发布为 Docker Image,可以直接拉到本地运行。

# pull image
docker pull cigaret/insights-grappler:latest
# run container
docker run -dit -e TC_SECRET_ID=[YourSecretID] -e TC_SECRET_KEY=[YourSecretKey] -e TCB_ENV_ID=[YourEnvID] cigaret/insights-grappler:latest

运行有以下条件:

  • 腾讯云云开发数据库,建立两个集合:
    • GovStrategies: 存储抓取到的数据条目
    • Subscriptions: 存储订阅通知的地址
// GovStrategies Data Structure
const dataItem = {
  _id: "auto generate",
  grapTime: 1634550725,
  publishTime: 1625184000,
  title: "国务院办公厅关于加快发展保障性租赁住房的意见",
  url: "http://www.gov.cn/zhengce/content/2021-07/02/content_5622027.htm"
}
// Subscriptions Data Structure
// notifyType 有两个取值,取值不同的时候,url 接收到的消息具备不同的内容和格式:
//   - WORK_WEIXIN: 企业微信机器人 webhook url
//   - GENERAL: 新数据的 JSON 表示
const subscriber = {
  _id: "auto generate",
  notifyType: "WORK_WEIXIN" | "GENERAL",
  url: "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=[YourKey]"
}

相关资料:

开发

开发完成之后打包为镜像。

# build docker
docker build -t cigaret/insights-grappler:latest .
# push docker
docker push cigaret/insights-grappler:latest

Author

License

This project is licensed under the GPL-3.0 License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published