logo科技微讯

检测 Twitter 用户更新

作者:科技微讯
日期:2022-02-28
📝 笔记

提供某条 tweet 的 id,获取它的信息,链接

提供某位用户的昵称,获取它的关注数,链接

获取一位用户的 timeline,链接

关于以上 api 的配置,可以看 Twitter 官网的文档

const minify = require("html-minifier").minify;
const json = await got(
  "https://cdn.syndication.twimg.com/timeline/profile?screen_name=TwitterDev&tweet_limit=1"
).then((res) => {
  return JSON.parse(res.body);
});
const html = json.body;
const htmlMinified = minify(html, {
  collapseWhitespace: true,
  collapseInlineTagWhitespace: true,
  decodeEntities: true,
  minifyCSS: true,
  minifyJS: true,
  removeComments: true,
  removeEmptyElements: true,
  removeEmptyAttributes: true,
  removeRedundantAttributes: true,
});
console.log(htmlMinified);
donation赞赏
thumbsup0
thumbsdown0
暂无评论