Code Monkey home page Code Monkey logo

april-zh-hotspot-push's Introduction

知乎热榜爬取

利用GitHub actions 自动爬取知乎每日热榜50条,目前已支持接入钉钉机器人,飞书机器人.(本地jdk版本最低11)

快速开始(钉钉)

  1. 在钉钉新建群聊
  2. 添加机器人
  3. 选择自定义机器人
  4. 创建机器人详情,配置关键词为1,如图

img.png

  1. 点击完成,复制Webhook地址到代码的 com/mobaijun/constant/Constant.java 的钉钉 DING_WEBHOOK
  2. 运行测试(效果图)

通知详情

内容详情

默认知乎详情

快速开始(飞书)

  1. 参考官方文档创建机器人(创建机器人
  2. 出于安全考虑配置了飞书机器人的签名校验,需要你在 com.mobaijun.constant.Constant 配置 FS_WEBHOOK 地址和签名配置
/**
 * 飞书地址
 */
public static final String FS_WEBHOOK = "https://open.feishu.cn/open-apis/bot/v2/hook/888888888888888888888888888";
/**
 * 飞书签名
 */
public static final String FS_SIGN = "888888888888888888888888888";
  1. 修改 com.mobaijun.util.DataAnalysisUtil 下的 private static void sendMsg(List<ZhInfo> infoList) 方法,将飞书改为 true 即可执行测试:
/**
 * 构件markdown推送信息
 *
 * @param infoList 消息列表
 */
private static void sendMsg(List<ZhInfo> infoList) {
    StringBuilder msg = new StringBuilder();
    // 钉钉最好不要超过15条热榜,否则无法发送,飞书不要超过10条数据,并且飞书不支持markdown,后续有空在优化飞书显示内容
    infoList.subList(0, 15).forEach(item -> msg.append(item.formatMarkdownMsg())
            .append(System.lineSeparator())
            .append(System.lineSeparator()).append("---")
            .append(System.lineSeparator()).append(System.lineSeparator()));
    // 需要推送的平台改为 true 即可,默认 false
    RobotClient.sendMessage(true, true, Constant.DING_WEBHOOK, Constant.FS_WEBHOOK, msg.toString());
}
  1. 效果图如下

飞书效果图

开发计划

  • 钉钉✔
  • 飞书✔
  • 企业微信 X (不准备支持了,听说也不支持 markdown)
  • 文档✔
  • 邮箱(计划中)

疑难解答

请在GitHub issue 进行提问,或者前往我的博客进行留言

april-zh-hotspot-push's People

Contributors

mobaijun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

april-zh-hotspot-push's Issues

提问

请问有考虑接入飞书或者微信群嘛

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.