Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

一些反馈建议 #13

Open
shitianshiwa opened this issue Sep 22, 2020 · 6 comments
Open

一些反馈建议 #13

shitianshiwa opened this issue Sep 22, 2020 · 6 comments
Labels
enhancement New feature or request

Comments

@shitianshiwa
Copy link
Contributor

shitianshiwa commented Sep 22, 2020

1、解析PC端微博链接无效https://weibo.com/5488749285/HAYBHqGJthttps://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;
}
@Ninzore Ninzore added the enhancement New feature or request label Sep 22, 2020
@Ninzore
Copy link
Owner

Ninzore commented Sep 22, 2020

关于gif动图需要更多信息

@shitianshiwa
Copy link
Contributor Author

经测试,QQ仅支持发送总帧数在300张以内的动图gif(包括300张),独立于图片大小限制

@Ninzore
Copy link
Owner

Ninzore commented Sep 25, 2020

了解,之后会尝试禁止高帧数gif或者进行抽帧

@shitianshiwa
Copy link
Contributor Author

可以加一个清理图片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(/&amp;/g, "&").replace(/&#91;/g, "[").replace(/&#93;/g, "]").replace(/&lt;/g, "<").replace(/&gt;/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);
    })
}

@shitianshiwa
Copy link
Contributor Author

shitianshiwa commented Apr 11, 2021

一般情况的推特链接
https://twitter.com/用户名/status/xxxxxxxxxxx

推特还有这种链接
https://twitter.com/i/web/status/xxxxxxxx
https://twitter.com/intent/user?user_id=用户id,爬取用户时间线api里可找到

@Ninzore
Copy link
Owner

Ninzore commented Apr 15, 2021

一般情况的推特链接
https://twitter.com/用户名/status/xxxxxxxxxxx

推特还有这种链接
https://twitter.com/i/web/status/xxxxxxxx
https://twitter.com/intent/user?user_id=用户id,爬取用户时间线api里可找到

可能是有这种吧。。。但谁会用啊,不考虑

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants