
【微信】我是如何做到检测域名是否见红的 附送node源码
一直在摸索如何检测域名是否被微信封掉,最终找到了两个方案:感觉有帮助的,麻烦给个爱心,后续出解析各大短视频去水印教程
1、借助公众号自定义菜单接口,需要自己阶段性更新cookie(见末尾截图)
2、借助转链后,然后解析body(附送node源码)
(1).链接
let wxdata = { action: 'long2short',long_url: url, } if (!ctx.session.access_token) { await koa2Req( { method: 'GET', url: `https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=${config.wx.APPID}&secret=${config.wx.SECRET}` } ).then(response => { ctx.session.access_token = JSON.parse(response.body).access_token }) } let wurl_result = await koa2Req({ method: 'POST', url: `https://api.weixin.qq.com/cgi-bin/shorturl?access_token=${ctx.session.access_token}`, json: true, headers: { "content-type": "application/json" }, body: wxdata }) ctx.body = {errcode: 0,data: wurl_result.body }
2、解析body
exports.checkShorturl = async ctx => { let url = ctx.query.url await koa2Req({ method: 'GET', url: url }).then(response => { if ((response.body.indexOf('已停止访问该网页') === -1) && (response.body.indexOf('请长按网址复制') == -1)) { ctx.body = { msg: '域名ok,可以使用', url: url } } else { ctx.body = { msg: '域名被屏蔽', url: url } } }) }
本文最后更新于2019年12月27日,若涉及的内容可能已经失效,直接留言反馈补链即可,我们会处理,谢谢
常见问题FAQ
- 1.关于新手解压出错 必看(附电脑+安卓WINRAR APP)
- 新手必看 本站资源解压教程:http://www.52cgzys.com/76304/
- 2.本站Telegram群组链接
- 3.所有礼包码下载地址:http://www.52cgzys.com/422289/
- 4.各类问题及解决处理方法合集