Greasy Fork

来自缓存

Greasy Fork is available in English.

微博群聊自动抢红包

只能用于m.weibo.cn的群聊,因为pc网页无法显示手机红包

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         微博群聊自动抢红包
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  只能用于m.weibo.cn的群聊,因为pc网页无法显示手机红包
// @author       @一只蠢狗君
// @match        https://m.weibo.cn/message/chat*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @require      https://code.jquery.com/jquery-3.6.0.min.js
// @grant        unsafeWindow
// @grant        GM_xmlhttpRequest
// @grant        GM_setValue
// @grant        GM_getValue
// @noframes
// ==/UserScript==

(function() {
    'use strict';
    var id = "4524720329230254";   //配置指定群,然后把页面挂在那个群里,刷新一下启动
    var yiqianghongbao = [ ];
    GM_setValue('yiqianghongbao',yiqianghongbao);

function qianghongbao(){
     GM_xmlhttpRequest(
        {
        method:'get',
        url:'https://m.weibo.cn/api/groupchat/list?count=10&gid=' + id,
        headers:{'Referer': 'https://m.weibo.cn/message/chat?gid='+ id + '&name=msgbox'},
        onload:function (response) {
            let rsp = JSON.parse(response.responseText);
            for(let n=0; n < 10; n++){
                let media_type = rsp["data"]["msgs"][n]["media_type"];
                if(media_type == 13){
                    let url_long = rsp["data"]["msgs"][n]["url_objects"][0]["info"]["url_long"];
                    if(/mall.e.weibo.com/.test(url_long) == true){
                        let exist_or_not = GM_getValue('yiqianghongbao').find(item => item == url_long);
                        if (exist_or_not == undefined) {
                            window.open(url_long);
                            let a = GM_getValue('yiqianghongbao');
                            a.push(url_long);
                            GM_setValue('yiqianghongbao',a);
                        };
                        };
                };
            };
        }
        });
}
setInterval(qianghongbao, 1000);
})();