一些反馈建议
Opened this issue · 6 comments
1、解析PC端微博链接无效https://weibo.com/5488749285/HAYBHqGJt 和 https://www.weibo.com/5488749285/HAYBHqGJt
2、go-cqhttpv0.9.25-fix3现在支持发送30MB大小的图片,可以适当放开图片大小限制。
3、b站的api找不到置顶动态信息 https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/space_history
4、发现无法正常解析b站专栏内容
其它补充:gif动图高帧数(至少225张以上),可能无法发送成功,和图片大小无关
function dynamicProcess(dynamic, origin = false) {
let card = JSON.parse(dynamic.card);
let text = "";
let name = "";
let pics = "";
let video = "";
let rt_dynamic = 0;
let url = "";
if (origin == false) {
//logger2.info(dynamic.desc.dynamic_id_str);
url = "https://t.bilibili.com/" + dynamic.desc.dynamic_id_str.replace(/"/g, "");
}
if ("user" in card) {
if ("uname" in card.user) name = card.user.uname;
else if ("name" in card.user) name = card.user.name;
} else if ("author" in card) name = card.author.name;
//投稿
if ("videos" in card) {
name = card.owner.name;
text = card.dynamic;
video = "发布视频:\n" + card.title + "\n" + card.desc + "\nhttps://www.bilibili.com/video/" + dynamic.desc.bvid;
}
//转发
if ("origin" in card) {
let origin = card.origin;
rt_dynamic = dynamicProcess({
card: origin
}, true);
}
if ("pic" in card) pics += "[CQ:image,cache=0,file=" + card.pic + "]";
if ("item" in card) {
//小视频
if ("video_playurl" in card.item) {
video = card.item.video_playurl;
text = "小视频\n" + card.item.description;
}
//通常
else {
if ("content" in card.item && card.item.content.length > 0) text = card.item.content;
else if ("description" in card.item && card.item.description.length > 0) text = card.item.description;
if ("pictures" in card.item) {
let pictures = card.item.pictures;
for (let pic of pictures) pics += "[CQ:image,cache=0,file=" + pic.img_src + "]";
}
}
} else if ("summary" in card) {
text = "发布文章" + card.title + "\n" + card.summary + "\nhttps://www.bilibili.com/read/cv" + dynamic.desc.rid_str;
pics += "[CQ:image,cache=0,file=" + card.origin_image_urls[0] + "]";
}
//解析CV号专栏
// logger2.info(name)
// logger2.info(text)
let dynamicObj = {
name: name,
text: text,
pics: pics,
video: video,
rt_dynamic: rt_dynamic,
url: url
};
return dynamicObj;
}
关于gif动图需要更多信息
经测试,QQ仅支持发送总帧数在300张以内的动图gif(包括300张),独立于图片大小限制
了解,之后会尝试禁止高帧数gif或者进行抽帧
可以加一个清理图片CQ码和链接
https://github.com/Ninzore/Wecab/blob/master/modules/plugin/translate.js#L49
function translate(sourceLang, targetLang, sourceText, context, reply = false) {
//console.log(sourceText.replace(/\[CQ:image.*?\]/g,""));//清理图片CQ码
//console.log(sourceText.replace(/(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/g, ''));//清理链接
let temp = sourceText.replace(/&/g, "&").replace(/[/g, "[").replace(/]/g, "]").replace(/</g, "<").replace(/>/g, ">").replace(/\[CQ:image.*?\]/g, "").replace(/(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/g, '');
if (temp == "") {
return;
}
axios({
url: TENCENT_TRANS_API,
method: "POST",
headers: httpHeader(true),
data: {
"qtk": qtk,
"qtv": qtv,
"source": sourceLang,
"target": targetLang,
"sourceText": temp
}
}).then(res => {
let targetText = "";
for (let i in res.data.translate.records) {
targetText += res.data.translate.records[i].targetText;
}
trans_text = reply ? `[CQ:reply,id=${context.message_id}]${targetText}` : `[${targetText}]`;
replyFunc(context, trans_text);
}).catch(err => {
console.error(new Date().toString() + ":" + "翻译:" + err);
})
}
一般情况的推特链接
https://twitter.com/用户名/status/xxxxxxxxxxx
推特还有这种链接
https://twitter.com/i/web/status/xxxxxxxx
https://twitter.com/intent/user?user_id=用户id
,爬取用户时间线api里可找到
一般情况的推特链接
https://twitter.com/用户名/status/xxxxxxxxxxx
推特还有这种链接
https://twitter.com/i/web/status/xxxxxxxx
https://twitter.com/intent/user?user_id=用户id
,爬取用户时间线api里可找到
可能是有这种吧。。。但谁会用啊,不考虑