Greasy Fork is available in English.

B站自用工具箱

bilibili自用工具箱,清理转发抽奖动态、批量取关、直播间自动签到、每天奖励任务、大会员权益领取

// ==UserScript==
// @name         B站自用工具箱
// @namespace    http://tampermonkey.net/
// @version      2.0.9
// @description  bilibili自用工具箱,清理转发抽奖动态、批量取关、直播间自动签到、每天奖励任务、大会员权益领取
// @author       Eliauk
// @match        *://*.bilibili.com/*
// @exclude      *://api.bilibili.com/*
// @exclude      *://api.*.bilibili.com/*
// @exclude      *://*.bilibili.com/api/*
// @exclude      *://member.bilibili.com/studio/bs-editor/*
// @exclude      *://t.bilibili.com/h5/dynamic/specification
// @exclude      *://bbq.bilibili.com/*
// @exclude      *://message.bilibili.com/pages/nav/header_sync
// @exclude      *://s1.hdslb.com/bfs/seed/jinkela/short/cols/iframe.html
// @exclude      *://open-live.bilibili.com/*
// @resource     ArcoDesignStyle      https://update.greasyfork.org/scripts/490751/ArcoDesignStyle.user.css?v=0.1.0
// @icon         https://www.bilibili.com/favicon.ico?v=1
// @icon64       data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAACOEfKtAAAbi0lEQVR4nO1cecylV1n/Pe9dvm2Wlg6d+TrfdC8M02JiZZGilrZToAEVRAz4BxgTIQS3PwAJBiLBfwSJJlUjSZVoVJAYCmXRuHQBGi20tVNaZEqRMvs+wyzfdu97HnOWZznvvfV/47wz33fvd+95z/I7z/J7nnPOi4vXxevidfH6f3yRDP3AB/84v6EaDGYGxQ+JwOBSRAoR0DDAlO9jLvfTTQzcTcy7APwTmN/DjGXE+0P8msEh1sXpf642pBdi17b+btIXsd3UByrtp1eWgqn5+Ef6NPALweHD4LAdAZ8K4H/ObYXcRc43SBvpXjcMB0B+DcH6xMD193ws/d3Xgh3gtOO5SjAVoOAaotxqHEcEGg3JeP6egF0JdMY7CNgB4jci0DKaoAOWuvNNlIH1oJBMlo0ugZi60RSwqPRNcCVwCEsAPwii6xDS/W8m8G5m3O8xAYmAyFyQm0Eu/zl9xA3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lqbL2GNJpe2Nsx1V+yo902ryajZxMYh9i5p8B42vJN+bM/TcA3ArwA5J7rnKCMXBosto1bG1YAtSkXdJmlj7z69HO80ZOx1YPE59g4CeZ+WPxMaBgfBfA3wD4KQI+k9mPf9guoydHdyGLXEXqiho35OWv64Ur5lyyKn4lqqTxc+LTDiJTfqDNNznE5y7QTH70CK11MyIM2QklA5eFHXuukPBFY3GWeal3+bIO3mtLeg3VObRzRPSRwPwRf/JB50jFvGSN5NGf8r70xQM3sUR08bp4Xbz+T14A/geLPbaK59MqjAAAAABJRU5ErkJggg==
// @license      GPL-3.0 License
// @grant        GM_info
// @grant        GM_addStyle
// @grant        GM_getValue
// @grant        GM_setValue
// @grant        GM_listValues
// @grant        GM_deleteValue
// @grant        GM_getResourceText
// @grant        GM_registerMenuCommand
// @require      https://update.greasyfork.org/scripts/493023/1472683/UnaTools.js?v=0.0.1.20241027210637
// @require      https://update.greasyfork.org/scripts/514389/1472695/UnaMD5.js?v=0.0.1.20241027214139
// @noframes
// ==/UserScript==
const isDebug=false;const debug=isDebug?debuglog:()=>{};const isCleanCache=false;const isClearAllCache=true;const pathname=/\d+/.exec(window.location.pathname);const dedeUserID=getCookie("DedeUserID");const my_mid=dedeUserID?+dedeUserID:0;const url=window.location.href;const prefix="eliauk_";const panelEleId=prefix+randomString(8).toLocaleLowerCase();const globalStyle=`.el-hidden{display:none}#${panelEleId} .el-switch-primary{background-color:rgb(var(--primary-6))}#${panelEleId} .el-switch-success{background-color:rgb(var(--success-6))}#${panelEleId} .el-switch-danger{background-color:rgb(var(--danger-6))}`;const ELIAUK_DYNAMIC_EXPIRATION_IN_MILLIS=90*24*60*60*1e3;const ELIAUK_TOOLS_CLEAR_WHITE_LIST=["VERSION","CONFIG"];const ELIAUK_TOOLS_KEY={VERSION:"eliauk_tools_version",CONFIG:"eliauk_tools_config",DYNAMIC_KEY:"eliauk_dynamic_key"};const DefaultConfig={1:{enable:false,message:"",extra:{time:0}},2:{enable:false,message:"",extra:{time:0}},4:{enable:false,message:"",extra:{time:0,last_time:0}},5:{enable:false,message:"",extra:{time:0,period_times:{}}},6:{enable:false},7:{enable:false}};const ElSettings=[{name:"daily",title:"每日奖励",desc:"每日奖励相关操作",functions:[{id:1,main:"watchFunction",sort:3,title:"观看视频",desc:"观看视频每日经验领取"},{id:2,main:"shareFunction",sort:4,title:"分享视频",desc:"分享视频每日经验领取"}]},{name:"vip",title:"大会员",desc:"大会员相关权益自动领取",functions:[{id:4,main:"experienceFunction",sort:6,title:"大会员每日经验",desc:"大会员观看任意视频每日领取10经验"},{id:5,main:"privilegeFunction",sort:7,title:"大会员每月权益",desc:"大会员每月专享权益领取"}]},{name:"others",title:"其他",desc:"其他功能",functions:[{id:6,main:"dynamicFunction",sort:2,title:"删除转发抽奖动态",desc:"删除官方过期抽奖动态"},{id:7,main:"followFunction",sort:1,title:"批量取关",desc:"批量取关已关注UP主"}]}];const DynamicType={forward:"DYNAMIC_TYPE_FORWARD",lottery:"RICH_TEXT_NODE_TYPE_LOTTERY"};function getCookie(e){return decodeURIComponent(document.cookie.replace(new RegExp(`(?:(?:^|.*;)\\s*${encodeURIComponent(e).replace(/[\-.+*]/g,"\\$&")}\\s*=\\s*([^;]*).*$)|^.*$`),"$1"))||null}function addCookie(name,value,time,path){name=encodeURIComponent(name);value=encodeURIComponent(value);if(isNaN(time)||time<0){log("Invalid time value for cookie expiration");return}const expirationDate=new Date;expirationDate.setTime(expirationDate.getTime()+time*1e3);path=path===""?"":";path="+path;try{document.cookie=name+"="+value+";expires="+expirationDate.toUTCString()+path}catch(error){log("Failed to set cookie:",error)}}function getUserCSRF(){return getCookie("bili_jct")}if(typeof GM_info==="undefined"){GM_info={script:{name:"bilibili_toolbox",version:"1.0.0"}}}if(typeof unsafeWindow==="undefined")unsafeWindow=window;if(typeof GM_addStyle==="undefined"){GM_addStyle=function(css,id){const s=document.createElement("style");if(id){s.setAttribute(id,id)}s.setAttribute("type","text/css");s.setAttribute("style","display: none !important;");s.appendChild(document.createTextNode(css));return(document.getElementsByTagName("head")[0]||document.documentElement).appendChild(s)}}if(typeof GM_getResourceText==="undefined"){GM_getResourceText=function(_){return""}}if(typeof GM_xmlhttpRequest==="undefined"){GM_xmlhttpRequest=function(GM_param){const xhr=new XMLHttpRequest;xhr.open(GM_param.method,GM_param.url,true);if(GM_param.responseType)xhr.responseType=GM_param.responseType;if(GM_param.overrideMimeType)xhr.overrideMimeType(GM_param.overrideMimeType);xhr.onreadystatechange=function(){if(xhr.readyState===xhr.DONE){if(xhr.status===200&&GM_param.onload)GM_param.onload(xhr);if(xhr.status!==200&&GM_param.onerror)GM_param.onerror(xhr)}};for(let header in GM_param.headers){xhr.setRequestHeader(header,GM_param.headers[header])}xhr.send(GM_param.data?GM_param.data:null)}}if(typeof GM_getValue==="undefined"){GM_getValue=function(name,type){const value=localStorage.getItem(name);if(value===undefined)return value;if(/^(?:true|false)$/i.test(value)&&type===undefined||type==="boolean"){if(/^true$/i.test(value))return true;else if(/^false$/i.test(value))return false;else return Boolean(value)}else if(/^-?[\d.]+$/i.test(value)&&type===undefined||type==="number")return Number(value);else return value}}if(typeof GM_setValue==="undefined"){GM_setValue=function(name,value){localStorage.setItem(name,value)}}if(typeof GM_deleteValue==="undefined"){GM_deleteValue=function(name){localStorage.removeItem(name)}}if(typeof GM_registerMenuCommand==="undefined"){GM_registerMenuCommand=function(){}}if(typeof GM_listValues==="undefined"){GM_listValues=function(){return Object.keys(localStorage)}}(function(){"use strict";let ElConfig={};let videoData={};const freshSpace=unsafeWindow?.__MIRROR_CONFIG__?.module==="fresh-space";function main(){if(!clearCache()){return}loadConfig();preloadStyle();settingPanel();if(!dedeUserID){log("请先进行登录~");toast("🎉请先进行登录~",ToastType.warn,2e3);return}const functions=ElSettings.reduce((list,item)=>{try{if(item&&isArray(item.functions)&&item.functions.length>0){list.push(...item.functions)}}catch(error){log("Error processing item:",error)}return list},[]).sort((a,b)=>{const sortA=a.sort??0;const sortB=b.sort??0;const diff=sortA-sortB;return diff===0?0:diff});debug("function list",functions);let sleep=0;functions.forEach(fun=>{if(typeof fun!=="object")return;const{id,main,title}=fun;if(!Object.hasOwnProperty.call(ElConfig,id)){return}if(ElConfig[id].enable){if(eval(`typeof ${main}`)==="function"){setTimeout(()=>{eval(`${main}(fun);`)},sleep++*500)}else{log("bilibili-toolbox:",`[${title}]方法没有找到`)}}})}function refreshPanel(){function getStatus(time,message){if(isToday(time)&&!isEmpty(time)){return{status:"success",message:"已完成"}}else if(isEmpty(message)||message==="未完成"){return{status:"primary",message:"未完成"}}else{return{status:"danger",message:message}}}function clearElementStatus(ele){const statusList=["primary","danger","success"];statusList.forEach(item=>{const cls=`el-switch-${item}`;ele.classList.remove(cls)})}function updateElementStatus(ele,status,message){clearElementStatus(ele);ele.classList.add(`el-switch-${status}`);ele.title=message}if(!ElConfig&&!isEmpty(ElConfig)){return}try{const entries=Object.entries(ElConfig);entries.forEach(([key,value])=>{const ele=$one(`#${panelEleId} .setting-switch[data-id="${key}"]`);if(!ele)return;const enable=parseBoolean(value.enable);const hasMessage=Object.hasOwnProperty.call(value,"message");if(!enable){clearElementStatus(ele);if(hasMessage)ele.title="未开启";return}if(!hasMessage){return}const time=value?.extra?.time??0;const message=value.message||"";const{status,message:newMessage}=getStatus(time,message);debug("switch status and message:",status,newMessage);updateElementStatus(ele,status,newMessage);if(newMessage!==message){Reflect.set(Reflect.get(ElConfig,key),"message",newMessage)}})}catch(error){log("Error in refreshPanel:",error)}}function saveConfig(){GM_setValue(ELIAUK_TOOLS_KEY.CONFIG,JSON.stringify(ElConfig));debug("saveConfig:",ElConfig)}function loadConfig(){const res=GM_getValue(ELIAUK_TOOLS_KEY.CONFIG);let config;if(res&&(res!=="undefined"&&res!=="null")){try{config=JSON.parse(res)}catch(e){config=res}}else{config=DefaultConfig;debug("default config:",config)}const handler={get:function(target,key){const res=Reflect.get(target,key);if(isObject(res)){return new Proxy(res,handler)}return res},set:function(target,key,value){Reflect.set(target,key,value);saveConfig();refreshPanel();debug("Proxy set:",target,key,value);return true}};ElConfig=new Proxy(config,handler)}function resetConfig(whitelist=[]){try{if(isEmpty(ELIAUK_TOOLS_KEY)){return}const whitelistKeys=new Set;for(const key in ELIAUK_TOOLS_KEY){if(whitelist.includes(key)){whitelistKeys.add(ELIAUK_TOOLS_KEY[key])}}debug("Resetting whitelist:",whitelistKeys);const allKeys=GM_listValues();allKeys.forEach(key=>{if(whitelistKeys.has(key))return;GM_deleteValue(key)})}catch(error){log("function resetConfig:","Error processing keys:",error)}}function clearCache(){if(typeof GM_info==="undefined"||typeof GM_getValue==="undefined"||typeof GM_setValue==="undefined"||typeof GM_deleteValue==="undefined"){log("bilibili-toolbox:","GM_getValue or GM_setValue or GM_deleteValue not found");return false}const remote_version=GM_info?.script.version;if(typeof remote_version==="undefined"){log("bilibili-toolbox:","version not found");return false}log("bilibili-toolbox:",`v${remote_version}`);const local_version=GM_getValue(ELIAUK_TOOLS_KEY.VERSION);if(typeof local_version==="undefined"||local_version!==remote_version){debug("bilibili-toolbox:",`local version: ${local_version}, remote version: ${remote_version}`);if(isCleanCache){if(isClearAllCache){debug("bilibili-toolbox:","clear all cache");resetConfig()}else{debug("bilibili-toolbox:","clean cache");resetConfig(ELIAUK_TOOLS_CLEAR_WHITE_LIST)}}GM_setValue(ELIAUK_TOOLS_KEY.VERSION,remote_version)}return true}function preloadStyle(){function loadResource(resourceName){const data=GM_getResourceText(resourceName);GM_addStyle(data)}loadResource("ArcoDesignStyle");GM_addStyle(aniStyle);GM_addStyle(toastStyle);GM_addStyle(globalStyle)}function settingPanel(){safeWaitFunc("body",()=>{retryInterval(async()=>{if(!render())return false;registerMenu();addAllEventListener();refreshPanel();debug("setting panel mount success");return true})});function settingChange(e){const $ev=e;const target=$ev.target||$ev.srcElement;const enable=parseBoolean(target.getAttribute("aria-checked"));const data_id=target.dataset.id;Reflect.get(ElConfig,data_id).enable=enable}function settingList(){debug("ElSettings:",ElSettings);return ElSettings.reduce((list,settings)=>{const functions=settings.functions;if(!functions||!functions.length)return list;const item=functions.reduce((items,config)=>{const itemConfig=Reflect.get(ElConfig,config.id);const message=itemConfig?.message;const titleAttr=!isEmpty(message)?`title="${message}"`:"";const enable=parseBoolean(itemConfig?.enable);return items.concat(`<div class="arco-collapse-item" title="${config?.desc}"><div class="arco-collapse-item-header arco-collapse-item-header-left"><div class="arco-collapse-item-header-title">${config?.title}</div><div class="arco-collapse-item-header-extra"><button ${titleAttr} type="button" role="switch" aria-checked="${enable}" class="setting-switch arco-switch arco-switch-type-circle arco-switch-small${enable?" arco-switch-checked":" "}" data-id="${config.id}"><span class="arco-switch-handle"><span class="arco-switch-handle-icon"></span></span></button></div></div></div>`)},"");return list.concat(`<div class="arco-divider arco-divider-horizontal arco-divider-with-text"><span class="arco-divider-text arco-divider-text-left el-noselect" title="${settings.desc}">${settings.title}</span></div><div class="arco-collapse">${item}</div>`)},"")}function addAllEventListener(){const element=$one(`#${panelEleId}`);const media=window.matchMedia("(prefers-color-scheme: dark)");const toggleTheme=e=>{const prefersDarkMode=e.matches;if(prefersDarkMode){element.setAttribute("arco-theme","dark")}else{element.removeAttribute("arco-theme")}};$all(`.close-button`,element).forEach(element=>{element.addEventListener("click",hide)});$all(`.arco-modal-body .arco-switch`,element).forEach(ele=>{ele.addEventListener("click",arcoSwitchChange)});if(typeof media.addEventListener==="function"){media.addEventListener("change",toggleTheme)}else if(typeof media.addListener==="function"){media.addListener(toggleTheme)}window.addEventListener("beforeunload",_=>{$all(`.setting-switch`,element).forEach(ele=>{ele.removeEventListener("change",settingChange)});if(typeof media.removeEventListener==="function"){media.removeEventListener("change",toggleTheme)}else if(typeof media.removeListener==="function"){media.removeListener(toggleTheme)}hide()})}function settingListListener(){$all(`#${panelEleId} .setting-switch`).forEach(ele=>{ele.addEventListener("change",settingChange)})}function show(){document.addEventListener("mousedown",insideClickCheck);const element=$one(`#${panelEleId}`);fadeInShow(element)}function hide(){fadeOutHide($one(`#${panelEleId}`));document.removeEventListener("mousedown",insideClickCheck)}function registerMenu(){GM_registerMenuCommand(`⚙️控制面板`,()=>{show()});GM_registerMenuCommand(`🔄脚本重置 - 修复脚本`,()=>{resetConfig();location.reload()})}function insideClickCheck(e){debug("panel inside check");if(!insideCheck(e,`#${panelEleId}`)){hide()}}function globalStyle(id){return`#${id} a,#${id} abbr,#${id} address,#${id} blockquote,#${id} caption,#${id} cite,#${id} code,#${id} dd,#${id} del,#${id} dfn,#${id} dl,#${id} dt,#${id} em,#${id} fieldset,#${id} form,#${id} h1,#${id} h2,#${id} h3,#${id} h4,#${id} h5,#${id} h6,#${id} iframe,#${id} img,#${id} ins,#${id} label,#${id} legend,#${id} li,#${id} object,#${id} ol,#${id} p,#${id} pre,#${id} q,#${id} small,#${id} strong,#${id} sub,#${id} sup,#${id} table,#${id} tbody,#${id} td,#${id} tfoot,#${id} th,#${id} thead,#${id} tr,#${id} ul{border:0;margin:0;padding:0}#${id} {position:fixed;top:3.9vw;right:12.5vw;z-index:999999;box-shadow:-2px 2px 5px rgb(0 0 0 / 30%);border-radius:var(--border-radius-medium);font-family:HarmonyOS Sans SC,Inter,-apple-system,BlinkMacSystemFont,PingFang SC,Hiragino Sans GB,noto sans,Microsoft YaHei,Helvetica Neue,Helvetica,Arial,sans-serif}#${id} .arco-modal{position:static;width:265px}#${id} .arco-collapse-item-header{background:transparent}#${id} .el-noselect{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}#${id} .arco-divider-text-left{left:10px}#${id} .arco-divider-text{padding:0 10px;font-size:12px;color:dodgerblue;transform:translateY(-70%);background:var(--color-bg-3)}#${id} .arco-collapse-item-header-left{padding-right:13px;padding-left:13px;cursor:default}#${id} .arco-modal-header{border-bottom:none}#${id} .arco-divider{margin:0;border:none;}#${id} .arco-divider-horizontal.arco-divider-with-text{margin:20px 0}#${id} .arco-modal-body{padding-top:0;padding-bottom:0;overflow:visible;margin-bottom:28px}#${id} .arco-modal-body .arco-divider-horizontal.arco-divider-with-text:first-child{margin-top:10px;margin-bottom: 0}#${id} .arco-collapse-item .arco-collapse-item-header .arco-collapse-item-header-title{font-weight:500}#${id} div::-webkit-scrollbar{width:10px;background:transparent}#${id} div::-webkit-scrollbar-thumb{background:var(--color-fill-3) content-box;border:2px solid transparent;border-radius:5px}`}function render(){if(!document.body)return false;if(!!$one(`#${panelEleId}`))return true;try{const modal=document.createElement("div");modal.id=panelEleId;modal.tabIndex=-1;modal.outline="0";modal.hidefocus="true";modal.className="el-hidden eliauk-container";modal.innerHTML=`<div class="arco-modal"><div class="arco-modal-header"><div class="arco-modal-title arco-modal-title-align-center">控制面板</div><div tabindex="-1" role="button" aria-label="Close" class="close-button arco-modal-close-btn"><span class="arco-icon-hover"><svg viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg" stroke="currentColor" class="arco-icon arco-icon-close" stroke-width="4" stroke-linecap="butt" stroke-linejoin="miter"><path d="M9.857 9.858 24 24m0 0 14.142 14.142M24 24 38.142 9.858M24 24 9.857 38.142"></path></svg></span></div></div><div class="arco-modal-body">${settingList()}</div></div>`;document.body.appendChild(modal);settingListListener();GM_addStyle(globalStyle(panelEleId));return true}catch(e){log("function render error:",e);return false}}}function getIndexRcmd(idx,ps=12){debug("get index rcmd loading");return request("https://api.bilibili.com/x/web-interface/wbi/index/top/feed/rcmd","GET",{ps:ps,fresh_idx:idx})}function dynamicFunction(fun){debug("dynamic function loading");if(!/https?:\/\/space\.bilibili\.com\/(\d+)(?=\/|\?|$)/.test(url)){debug("dynamicFunction:","该页面不适用");return}const mid=pathname?+pathname[0]:0;if(!(mid&&my_mid&&mid===my_mid)){return}let group,buttongroup;const id=prefix+randomString(8).toLocaleLowerCase();class Group{constructor(key,id,load){this.key=key;this.load=load;this.target=$one(`#${id} .target`);this.clean=$one(`#${id} .target .clean`);this.cleanEnter=$one(`#${id} .target .clean-enter`);this.children=$all(`#${id} .target .clean-children`)}status(){return!GM_getValue(this.key)}enable(){GM_deleteValue(this.key);if(this.load){this.clean.classList.remove("clean-loading")}}disable(){GM_setValue(this.key,true);if(this.load){this.clean.classList.add("clean-loading")}}buttongroup(){return{target:this.target,clean:this.clean,cleanEnter:this.cleanEnter,children:this.children}}}function initial(){const selector=freshSpace?"#app .space-main.route_dynamic .space-dynamic .space-dynamic__right":"#page-dynamic .section.user-info";debug("dynamic select:",`[${selector}]`);safeWaitFunc(selector,userEle=>{try{render(userEle)}catch(error){log("Error in initial render function:",error)}group=new Group(ELIAUK_TOOLS_KEY.DYNAMIC_KEY,id,true);buttongroup=group.buttongroup();buttonListener()})}function spaceDynamicApi(offset=null){return request("https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/space","GET",filterNullUndefined({host_mid:mid,offset:offset,timezone_offset:"-480",features:"itemOpusStyle"}))}function lotteryNoticeApi(dynamic_id){return request("https://api.vc.bilibili.com/lottery_svr/v1/lottery_svr/lottery_notice","GET",{business_type:4,business_id:dynamic_id})}function rmDynamicApi(dynamic_id){return request("https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/rm_dynamic","POST",{dynamic_id:dynamic_id,csrf_token:getUserCSRF()})}function isLotteryDynamic(summary){let rich_text_nodes=summary["rich_text_nodes"]??[];return rich_text_nodes.some(tag=>tag.type===DynamicType.lottery)}async function spaceDynamic(){let offset=null;let results=[];for(let has_more=1;has_more;){const res=await spaceDynamicApi(offset);debug("space items result:",res);if(!res||res.code||!res.data){break}const data=res.data;const items=data["items"];offset=data["offset"];has_more=data["has_more"];if(!items||items.length<1){continue}results=results.concat(items)}return results}async function rmDynamic(dynamic_id){if(!dynamic_id)return false;const result=await rmDynamicApi(dynamic_id);debug("rm_dynamic result:",result);return!(!result||result.code||!result.data)}async function hasLotteryResult(dynamic_id){const result=await lotteryNoticeApi(dynamic_id);if(!result||result.code||!result.data){return false}const notice=result.data;return!!notice["lottery_result"]}async function rmDynamicItem(dynamic){if(DynamicType.forward!==dynamic["type"]){debug("function rmDynamicItem:","该动态非转发动态");return 0}debug("function rmDynamicItem param:",dynamic);const origin_dynamic=dynamic["orig"];if(!origin_dynamic){debug("function rmDynamicItem:","orig is null");return 0}const modules=origin_dynamic["modules"];if(!modules){debug("function rmDynamicItem:","modules is null");return 0}const summary=acquireChain(["module_dynamic","major","opus","summary"],modules);if(isLotteryDynamic(summary)){const origin_id=origin_dynamic["id_str"];const pub_ts=acquireChain(["module_author","pub_ts"],modules);if(!isExpired(pub_ts*1e3,ELIAUK_DYNAMIC_EXPIRATION_IN_MILLIS)&&!await hasLotteryResult(origin_id)){debug("未过指定天数且未出结果",summary["text"]);return 0}return await rmDynamic(dynamic["id_str"])?1:0}else{debug("不是抽奖动态")}return 0}function render(userEle){if($one(`#${id}`)){return}if(!userEle){return}const ele=document.createElement("div");ele.id=id;ele.className="dynamic-aside-section";ele.innerHTML=`<div class="auth-section"><svg width="0" height="0" style="position: absolute;"><defs><filter id="goo"><feGaussianBlur in="SourceGraphic" stdDeviation="10" result="blur"/><feColorMatrix in="blur" mode="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 19 -9" result="goo"/><feComposite in="SourceGraphic" in2="goo" operator="atop"/></filter></defs></svg><div class="target el-noselect"><div class="clean clean-box">清理</div><span class="clean-children clean-box icon-clean-left">取消</span><span class="clean-children clean-box icon-clean-right clean-enter">确定</span></div></div>`;userEle.appendChild(ele);GM_addStyle(globalStyle(id))}function childrenClick(){buttongroup.target.classList.remove("checked");buttongroup.clean.addEventListener("click",cleanClick);buttongroup.children.forEach(ele=>{ele.removeEventListener("click",childrenClick)})}function cleanClick(){if(!group.status())return;buttongroup.target.classList.add("checked");buttongroup.children.forEach(ele=>{ele.addEventListener("click",childrenClick)});buttongroup.clean.removeEventListener("click",cleanClick)}async function cleanEnterClick(){if(!group.status())return;try{group.disable();debug("remove start");const dynamics=await spaceDynamic();debug("space dynamic list",dynamics);let success=await dynamics.reduce(async(cnt,dynamic)=>await cnt+await rmDynamicItem(dynamic),0);debug(`共有${dynamics.length}条动态, 已成功删除${success}条`);toast(`共有${dynamics.length}条动态, 已成功删除${success}条`,ToastType.success,2e3)}catch(e){log(`删除失败, ${e.message}`);toast(`删除失败, ${e.message}`,ToastType.error,2e3)}finally{debug("remove end");group.enable()}}function globalStyle(id){if(freshSpace){return`.clean-loading::after {content:'';position:absolute;top:0;left:0;right:0;bottom:0;margin:auto;border:5px solid transparent;border-left:5px solid #8f41e9;border-right:5px solid #8f41e9;border-radius:50%;animation:spin 1s linear infinite;}#${id}.join-button{position:relative;display:inline;cursor:pointer;height:20px;width:20px}#${id}.join-button__btn{color:#23c9ed;font-size:20px;text-align:center;border:none;font-size:20px;border-radius:4px}#${id}.join-button__btn.checked{background:#019cd3}#${id}.join-button__btn:active{color:#4FD4F1}#${id}.join-button__btn:after{content:attr(data-tips);position:absolute;white-space:nowrap;opacity:0;left:50%;transform:translateX(-50%);transition:.1s;font-size:16px;background-image:-webkit-linear-gradient(left,#00e0ee,#2d97ff);-webkit-background-clip:text;-webkit-text-fill-color:transparent;pointer-events:none}#${id}.join-button:hover .join-button__btn:after{opacity:1 !important;transform:translate(-50%,-150%)}.el-noselect{-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.target{width:100%;filter:url("#goo");text-align:center;margin:auto;position:relative}.clean{display:block;position:relative;z-index:1;scale:1}.clean-box{font-size:12px;color:#fff;background-image:linear-gradient(0deg,rgb(255 186 251),rgb(41 201 255));border-radius:50%;width:45px;line-height:45px;margin:auto;cursor:pointer;transition:1s ease}.clean-children{position:absolute;top:0;left:0;right:0}.target.checked .icon-clean-left{-ms-transform:translateX(-45px);-webkit-transform:translateX(-45px);transform:translateX(-45px)}.target.checked .icon-clean-right{-ms-transform:translateX(45px);-webkit-transform:translateX(45px);transform:translateX(45px)}.target.checked .clean{opacity:0;scale:0;cursor:default}`}return`.clean-loading::after {content:'';position:absolute;top:0;left:0;right:0;bottom:0;margin:auto;border:5px solid transparent;border-left:5px solid #8f41e9;border-right:5px solid #8f41e9;border-radius:50%;animation:spin 1s linear infinite;}#${id}{padding-top:18px;border-top:1px solid #e5e9ef;margin-top:10px}#${id}.join-button{position:relative;display:inline;cursor:pointer;height:20px;width:20px}#${id}.join-button__btn{color:#23c9ed;font-size:20px;text-align:center;border:none;font-size:20px;border-radius:4px}#${id}.join-button__btn.checked{background:#019cd3}#${id}.join-button__btn:active{color:#4FD4F1}#${id}.join-button__btn:after{content:attr(data-tips);position:absolute;white-space:nowrap;opacity:0;left:50%;transform:translateX(-50%);transition:.1s;font-size:16px;background-image:-webkit-linear-gradient(left,#00e0ee,#2d97ff);-webkit-background-clip:text;-webkit-text-fill-color:transparent;pointer-events:none}#${id}.join-button:hover .join-button__btn:after{opacity:1 !important;transform:translate(-50%,-150%)}.el-noselect{-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.target{max-width:200px;filter:url("#goo");text-align:center;margin:auto;position:relative}.clean{display:block;position:relative;z-index:1;scale:1}.clean-box{font-size:12px;color:#fff;background-image:linear-gradient(0deg,rgb(255 186 251),rgb(41 201 255));border-radius:50%;width:45px;line-height:45px;margin:auto;cursor:pointer;transition:1s ease}.clean-children{position:absolute;top:0;left:0;right:0}.target.checked .icon-clean-left{-ms-transform:translateX(-45px);-webkit-transform:translateX(-45px);transform:translateX(-45px)}.target.checked .icon-clean-right{-ms-transform:translateX(45px);-webkit-transform:translateX(45px);transform:translateX(45px)}.target.checked .clean{opacity:0;scale:0;cursor:default}`}function buttonListener(){buttongroup.clean.addEventListener("click",cleanClick);buttongroup.cleanEnter.addEventListener("click",cleanEnterClick);window.addEventListener("beforeunload",_=>{group.enable();buttongroup.clean.removeEventListener("click",cleanClick);buttongroup.cleanEnter.removeEventListener("click",cleanEnterClick)})}function loadSpace(targetNode){if(!targetNode){log("function loadSpace:","target node not found");return}const config={childList:true,subtree:true};const callback=function(mutationsList,observer){try{initial()}catch(error){log("Error in render function:",error)}};const observer=new MutationObserver(callback);observer.observe(targetNode,config);initial()}safeWaitFunc("#app",app=>{loadSpace(app)})}function followFunction(fun){if(freshSpace){if(!/https?:\/\/space\.bilibili\.com\/(\d+)\/relation\/follow(?=\/|\?|$)/.test(url)){debug("followFunction:","该页面不适用");return}}else if(!/https?:\/\/space\.bilibili\.com\/(\d+)\/fans\/follow(?=\/|\?|$)/.test(url)){debug("followFunction:","该页面不适用");return}const mid=pathname?+pathname[0]:0;if(!(mid&&my_mid&&mid===my_mid)){return}const id=prefix+randomString(8).toLocaleLowerCase();let eliauk_model;function initMessageBox(){if(!!$one(`#${id}`))return;let modal=document.createElement("div");modal.className=freshSpace?"el-hidden":"modal-container el-hidden";modal.id=id;if(freshSpace){modal.innerHTML=`<div class="vui_dialog--root"><div class="vui_dialog--mask"></div><div class="vui_dialog--wrapper"><div class="vui_dialog--content" style="width: 320px;"><div class="vui_dialog--close"><svg class="vui_icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20" height="20" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M4.106275 4.108583333333334C4.350341666666667 3.8645000000000005 4.746083333333333 3.8645000000000005 4.9901583333333335 4.108583333333334L9.998666666666667 9.117125L15.008583333333334 4.107216666666667C15.252625 3.8631333333333338 15.648375000000001 3.8631333333333338 15.892458333333334 4.107216666666667C16.136541666666666 4.351291666666667 16.136541666666666 4.747025000000001 15.892458333333334 4.9911L10.882541666666667 10.001000000000001L15.891375 15.009791666666667C16.135458333333332 15.253874999999999 16.135458333333332 15.649625 15.891375 15.893708333333334C15.647291666666668 16.13775 15.251541666666668 16.13775 15.0075 15.893708333333334L9.998666666666667 10.884875000000001L4.991233333333334 15.892333333333333C4.747158333333333 16.13641666666667 4.351425 16.13641666666667 4.10735 15.892333333333333C3.8632750000000002 15.648249999999999 3.8632750000000002 15.252541666666666 4.10735 15.008458333333333L9.114791666666667 10.001000000000001L4.106275 4.992466666666667C3.8621916666666665 4.7483916666666675 3.8621916666666665 4.352658333333333 4.106275 4.108583333333334z" fill="currentColor"></path></svg></div><div class="vui_dialog--header"><div class="vui_dialog--title">取消关注</div></div><div class="vui_dialog--body"></div><div class="vui_dialog--footer"><button class="vui_button vui_dialog--btn vui_dialog--btn-cancel">取消</button><button class="vui_button vui_button--blue vui_dialog--btn vui_dialog--btn-confirm">确定</button></div></div></div></div>`}else{modal.innerHTML=`<div class="modal-mask"></div><div class="modal-wrapper eliauk-message-wrapper"><div class="modal"><div class="modal-header"><i id="message-box-close" class="modal-header-close iconfont icon-ic_close"></i><div class="eliauk-modal-title modal-title"><p id="message-box-title">取消关注</p></div></div><div class="modal-body message-box-body"><div class="message-box-content"></div></div><div class="btn-container modal-footer"><button type="button" class="message-box-button" id="message-box-cancel"><span class="message-box-button-span">取消</span></button><button type="button" class="message-box-button" id="message-box-action"><span class="message-box-button-span">确定</span></button></div></div></div>`}document.body.appendChild(modal);eliauk_model=$one(`#${id}`);GM_addStyle(globalStyle(id))}async function messageBoxEnter(e){e.preventDefault();debug("_param:",this._param);await unfollows(this._param?.tag_id)}function loadMessageBox(tag_id){const dialogContentStr=freshSpace?".vui_dialog--body":".message-box-content";const btnConfirmStr=freshSpace?".vui_dialog--btn-confirm":"#message-box-action";const closeBtnStr=freshSpace?".vui_dialog--close":"#message-box-close";const dialogBtnStr=freshSpace?".vui_dialog--btn":".message-box-button";const dialogContent=$one(dialogContentStr,eliauk_model);dialogContent.innerHTML="确定取消本分组下所有关注?";fadeInShow(eliauk_model);const btnConfirm=$one(btnConfirmStr,eliauk_model);btnConfirm._param={tag_id:tag_id};btnConfirm.addEventListener("click",messageBoxEnter);$one(closeBtnStr,eliauk_model).addEventListener("click",exitMessageBox);$all(dialogBtnStr,eliauk_model).forEach(ele=>{ele.addEventListener("click",exitMessageBox)})}function exitMessageBox(){fadeOutHide(eliauk_model);const btnConfirmStr=freshSpace?".vui_dialog--btn-confirm":"#message-box-action";const closeBtnStr=freshSpace?".vui_dialog--close":"#message-box-close";const dialogBtnStr=freshSpace?".vui_dialog--btn":".message-box-button";$one(btnConfirmStr).removeEventListener("click",messageBoxEnter);$one(closeBtnStr).removeEventListener("click",exitMessageBox);$all(dialogBtnStr).forEach(ele=>{ele.removeEventListener("click",exitMessageBox)})}async function tagFollow(tag_id){const size=20;let page=1;let results=[];let length=0;do{const res=await tagFollowApi(tag_id,page++,size);debug("tag follow list:",res);if(!res||res.code||!res.data){break}const data=res.data;length=data.length;results=results.concat(data)}while(length===size);return results}function tagFollowApi(tag_id,pn,ps){return request("https://api.bilibili.com/x/relation/tag","GET",{mid:mid,tagid:tag_id,pn:pn,ps:ps})}function freshSpaceRender(sidebar){const sidebar_items=$all(".follow-sidebar-item",sidebar);if(!sidebar_items||sidebar_items.length<1)return;debug(sidebar_items);const sidebar_item=Array.from(sidebar_items).find(ele=>{const item_popover_i=$one("a > .vui_sidebar-item > .vui_sidebar-item-title > .menu-popover > i",ele);if(!item_popover_i)return;return item_popover_i.style.display!=="none"});const a=$one("a",sidebar_item);const href=a.href;const match=href.match(/tagid=(\d+)/);if(!match)return;const tag_id=match[1];log("tag_id:",tag_id);const popover=$all(".vui_popover .vui_popover-content .menu-popover__panel");popover.forEach(ele=>{const popover_item=$one(".menu-popover__panel-item",ele);debug(popover_item.innerText,popover_item);if(popover_item.innerText==="修改名称"){const cancel_follows=$one(".menu-popover__panel-item.cancel-follows",ele);if(!!cancel_follows)return;const dropdown_cancel=document.createElement("div");dropdown_cancel.className="menu-popover__panel-item cancel-follows";dropdown_cancel.innerHTML="取消关注";const attributes=ele.attributes;const regex=/^data-v-/;const data_v_attr=Array.from(attributes).find(attr=>regex.test(attr.name));debug(data_v_attr.name);dropdown_cancel.setAttribute(data_v_attr.name,data_v_attr.data??"");ele.insertBefore(dropdown_cancel,ele.children[0]);dropdown_cancel.addEventListener("click",()=>{loadMessageBox(tag_id)})}})}function render(sidebar){$all(".follow-list-container .follow-item.custom-group").forEach(ele=>{const dropdown_menu=$one(".be-dropdown-menu",ele);const cancel_follows=$all(".cancel-follows",dropdown_menu);if(!!cancel_follows&&cancel_follows.length>0){debug("该分组下已经存在");return}const dropdown_cancel=document.createElement("li");dropdown_cancel.className="be-dropdown-item be-dropdown-item-delimiter cancel-follows";dropdown_cancel.innerHTML="取消关注";const tag_id=ele.getAttribute("tagid");dropdown_menu.insertBefore(dropdown_cancel,dropdown_menu.children[0]);dropdown_cancel.addEventListener("click",()=>{loadMessageBox(tag_id)})})}function unfollowApi(uid){return request("https://api.bilibili.com/x/relation/modify","POST",{fid:uid,act:2,re_src:11,csrf:getUserCSRF()})}async function unfollow(uid){const res=await unfollowApi(uid);debug("unfollow result:",res);if(!res||res.code){return 0}return 1}function unfollow_disabled(tag_id){const cancelItemStr=freshSpace?".vui_popover .vui_popover-content .menu-popover__panel .menu-popover__panel-item.cancel-follows":`li[tagid="${tag_id}"] .cancel-follows`;const cancelItem=$all(cancelItemStr);cancelItem.forEach(ele=>{ele.classList.add("el-disabled")});return cancelItem}async function unfollows(tag_id){let cancel_item=[];try{debug("unfollow start");debug("tag id:",tag_id);cancel_item=unfollow_disabled(tag_id);const follows=await tagFollow(tag_id);if(follows?.length<1){toast("没有需要取消关注的up主",ToastType.info,2e3);return}const unfollow_list=follows.map(f=>f.mid);let success=await unfollow_list.reduce(async(cnt,uid)=>await cnt+await unfollow(uid),0);debug(`共有${unfollow_list.length}位up主需要取关, 已成功取关${success}位`);toast(`共有${unfollow_list.length}位up主需要取关, 已成功取关${success}位`,ToastType.success,2e3);location.reload()}catch(e){log(`取关失败, ${e.message}`);toast(`取关失败, ${e.message}`,ToastType.error,2e3)}finally{debug("unfollow end");cancel_item.forEach(ele=>{ele.classList.remove("el-disabled")})}}function globalStyle(id){if(freshSpace)return"";return`#${id} .eliauk-message-wrapper{width:420px}#${id} .eliauk-modal-title{padding:0 !important}#${id} .modal-wrapper .modal-footer{padding:5px 15px 10px;text-align:right}#${id} #message-box-title{text-align:left;padding:15px 15px 10px;margin-bottom:0;font-size:18px;line-height:1;color:#303133}#${id} .message-box-body{position:relative;color:#606266;padding:10px 15px !important}#${id} .message-box-content{position:relative;overflow:auto;text-align:left;height:auto !important}#${id} .message-box-button{margin-right:0;display:inline-block;padding:9px 15px;line-height:1;transition:all .2s ease;text-align:center;vertical-align:middle;outline:none;border-radius:3px;cursor:pointer;white-space:nowrap;box-sizing:border-box;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}#${id} #message-box-action{color:#fff;margin-left:10px;background-color:#00a1d6;border:1px solid #00a1d6}#${id} #message-box-cancel{background:#fff;border:1px solid #dcdfe6;color:#606266}#${id} #message-box-action:hover,#${id} #message-box-action:focus{color:#fff;background-color:#00b5e5;border-color:#00b5e5}#${id} #message-box-cancel:hover,#${id} #message-box-cancel:focus{color:#00a1d6;border-color:#c6e2ff;background-color:#ecf5ff}#${id} .el-disabled{cursor:not-allowed;color:#cfd0d3;pointer-events:none;}`}function initial(sidebar){if(freshSpace){const config={childList:true,subtree:true,attributes:true};const callback=function(mutationsList,observer){try{freshSpaceRender(sidebar)}catch(error){log("Error in render function:",error)}};const observer=new MutationObserver(callback);observer.observe(sidebar,config);freshSpaceRender(sidebar)}else{render(sidebar)}initMessageBox()}const sidebarStr=freshSpace?".space-follow .vui_collapse_item .vui_sidebar":".follow-list-container .follow-item.custom-group .be-dropdown-menu";safeWaitFunc(sidebarStr,sidebar=>{initial(sidebar)})}function experienceFunction(fun){debug("experience function loading");const uid=getCookie("buvid3");if(!dedeUserID||!uid){log("请先进行登录~");toast("🎉请先进行登录~",ToastType.warn,2e3);return}const config=Reflect.get(ElConfig,fun.id);function experienceApi(mid,uid,csrf){return request(`https://api.bilibili.com/x/vip/experience/add?mid=${mid}&buvid=${uid}&csrf=${csrf}`,"POST")}async function experience(){const lastTime=config?.extra?.last_time;if(!isEmpty(lastTime)&&!isExpired(lastTime,60*1e3)){log("function experience:","请求频繁, 请稍后再试");return}const{code,message}=await experienceApi(my_mid,uid,getUserCSRF());config.extra.last_time=Date.now();if(code===0){toast("🎉领取今日大会员经验成功!",ToastType.success,5e3);config.extra.time=Date.now()}else if(code===69198){debug("experience add result [69198]:",message);config.extra.time=Date.now()}else if(code===6034007){debug("experience add result [6034007]:",message);config.message=message}else{config.message=message;toast(message,ToastType.error,2e3)}}const time=config?.extra?.time;if(!time||!isToday(time)){experience().then()}else{log("🎉大会员每日经验已经领取过了~")}}function privilegeFunction(fun){debug("privilege function loading");if(!dedeUserID){log("请先进行登录~");toast("🎉请先进行登录~",ToastType.warn,2e3);return}const config=Reflect.get(ElConfig,fun.id);function privilegeApi(type,csrf){return request(`https://api.bilibili.com/x/vip/privilege/receive`,"POST",{platform:"web",type:type,csrf:csrf})}function periodApi(){return request(`https://api.bilibili.com/x/vip/privilege/my`)}async function period(){let period_times=config?.extra?.period_times;if(!isEmpty(period_times)){return period_times}period_times={};const{code,message,data}=await periodApi();if(code!==0){throw new Error(message)}const{list}=data;list.forEach(({type,period_end_unix})=>{Reflect.set(period_times,type,period_end_unix)});config.extra.period_times=period_times;return period_times}async function unreceived(){const privileges=[{type:1,name:"年度专享B币赠送"},{type:2,name:"年度专享会员购优惠券"},{type:3,name:"年度专享漫画礼包"},{type:4,name:"大会员专享会员购包邮券"},{type:5,name:"年度专享漫画礼包"},{type:6,name:"大会员专享会员体验卡"},{type:7,name:"大会员专享课堂优惠券"},{type:15,name:"年度专享会员购星光宝盒88折券"},{type:16,name:"大会员专享会员购10魔晶"},{type:17,name:"年度专享游戏优惠券"}];try{const period_times=await period();const expired_privileges=privileges.filter(privilege=>{if(!Object.hasOwnProperty.call(period_times,privilege.type)){return true}return isExpired(Reflect.get(period_times,privilege.type)*1e3,0)});if(expired_privileges.length>0){config.extra.period_times={}}log("function config:",config);return expired_privileges}catch(e){log("function unreceived:",e);return privileges}}async function privilege(){const privileges=await unreceived();if(privileges.length===0){log("🎉大会员权益已经领取过了~");config.extra.time=Date.now();return}const ps=[];const csrf=getUserCSRF();for(let i=0;i<privileges.length;i++){ps.push(new Promise((resolve,reject)=>{setTimeout(()=>{const{type,name}=privileges[i];privilegeApi(type,csrf).then(({code,message})=>{if(code===0){toast(`领取大会员权益${name}成功!`,ToastType.success,5e3);resolve(true)}else if(code===69801){debug("privilege receive result [69801]:",name,message);resolve(true)}else if(code===-412){debug("privilege receive result [-412]:",name,message);resolve(false)}else{toast(`领取大会员权益${name}失败!${message}.`,ToastType.error,2e3);reject()}}).catch(reason=>{log("privilege receive error:",reason);reject()})},i*1e3)}))}const results=await Promise.allSettled(ps);const successful=results.filter(result=>result.status==="fulfilled");if(successful.length===privileges.length){toast("🎉领取大会员权益全部成功!",ToastType.success,5e3);config.extra.time=Date.now()}}const time=config?.extra?.time;if(!time||!isToday(time)){privilege().then()}else{log("🎉大会员权益已经领取过了~")}}async function fetchIndexRcmd(){const{code,data,message}=await getIndexRcmd(1,1);if(code!==0){throw new Error(message)}return data.item}async function getValidItem(items){for(const item of items){if(Reflect.get(item,"goto")==="av"){return{aid:item.id,bvid:item.bvid,cid:item.cid}}}return null}async function getVideoId(maxRetries=5){if(!isEmpty(videoData)){return videoData}let result=null;for(let i=0;i<maxRetries;i++){try{const items=await fetchIndexRcmd();result=await getValidItem(items);if(!isEmpty(result)){break}}catch(error){log("Error in getVideoId:",error.message)}}if(!result){throw new Error("Failed to get valid video aid after multiple retries")}log("获取到视频相关id:",result);videoData=result;return result}function watchFunction(fun){if(!dedeUserID){log("请先进行登录~");toast("🎉请先进行登录~",ToastType.warn,2e3);return}const config=Reflect.get(ElConfig,fun.id);function watchApi(aid,bvid,cid){const body={aid:aid,cid:cid,mid:my_mid,start_ts:Math.floor(Date.now()/1e3),dt:2,play_type:0,realtime:1,played_time:1,real_played_time:1,csrf:getUserCSRF(),refer_url:"https://www.bilibili.com/"};return request("https://api.bilibili.com/x/click-interface/web/heartbeat","POST",body,{referer:`https://www.bilibili.com/video/${bvid}`})}async function watch(){try{const{aid,bvid,cid}=await getVideoId();const{code,message}=await watchApi(aid,bvid,cid);if(code===0){toast("🎉观看视频成功!",ToastType.success,5e3);config.extra.time=Date.now()}else{config.message=message;toast(message,ToastType.error,2e3)}}catch(e){config.message=e.message;log("function watch error:",e)}}const time=config?.extra?.time;if(!time||!isToday(time)){watch().then()}else{log("🎉每日视频已经观看过了~")}}function shareFunction(fun){if(!dedeUserID){log("请先进行登录~");toast("🎉请先进行登录~",ToastType.warn,2e3);return}const config=Reflect.get(ElConfig,fun.id);const appKey="783bbb7264451d82";const appSec="2653583c8873dea268ab9386918b1d65";function appSign(params,appKey,appSec){params.appkey=appKey;const searchParams=new URLSearchParams(params);searchParams.sort();return md5(searchParams.toString()+appSec)}async function getAccessKey(){const access_token=getCookie("access_token");debug("getAccessKey获取到缓存的access_token:",access_token);if(!isEmpty(access_token)){return access_token}function authCodeApi(){const body={appkey:appKey,local_id:0,ts:Date.now()};body.sign=appSign(body,appKey,appSec);return request("https://passport.bilibili.com/x/passport-tv-login/qrcode/auth_code","POST",body)}function authConfirmApi(auth_code){const body={auth_code:auth_code,build:7082e3,csrf:getUserCSRF()};body.sign=appSign(body,appKey,appSec);return request("https://passport.bilibili.com/x/passport-tv-login/h5/qrcode/confirm","POST",body)}function authPollApi(auth_code){const body={auth_code:auth_code,appkey:appKey,local_id:0,ts:Date.now()};body.sign=appSign(body,appKey,appSec);return request("https://passport.bilibili.com/x/passport-tv-login/qrcode/poll","POST",body)}async function authCode(){const{code,data,message}=await authCodeApi();if(code!==0){throw new Error(message)}return data.auth_code}async function authConfirm(auth_code){const{code,message}=await authConfirmApi(auth_code);if(code!==0){toast(message,ToastType.error,2e3);location.href="https://passport.bilibili.com/login";throw new Error(message)}debug("qrcode confirm result:","确认登录成功")}async function authPoll(auth_code){const{code,data,message}=await authPollApi(auth_code);if(code!==0){throw new Error(message)}const{access_token,expires_in}=data;debug("获取到 access_token:",access_token);if(!isEmpty(access_token)){addCookie("access_token",access_token,expires_in,"/")}return access_token}const auth_code=await authCode();await authConfirm(auth_code);return await authPoll(auth_code)}async function shareApi(aid,bvid,cid){const body={access_key:await getAccessKey(),oid:aid,build:7082e3,appkey:appKey,mobi_app:"android",platform:"android",panel_type:"1",share_channel:"biliDynamic",share_id:"main.ugc-video-detail.0.0.pv",share_origin:"vinfo_share",sid:cid,s_locale:"zh-Hans_CN",spm_id:"main.ugc-video-detail.0.0",ts:Math.floor(Date.now()/1e3),success:true};body.sign=appSign(body,appKey,appSec);return request("https://api.biliapi.net/x/share/finish","POST",body,{referer:`https://www.bilibili.com/video/${bvid}`})}async function share(){try{const{aid,bvid,cid}=await getVideoId();const{code,message}=await shareApi(aid,bvid,cid);if(code===0){toast("🎉分享视频成功!",ToastType.success,5e3);config.extra.time=Date.now()}else{config.message=message;toast(message,ToastType.error,2e3)}}catch(e){config.message=e.message;log("function share error:",e)}}const time=config?.extra?.time;if(!time||!isToday(time)){share().then()}else{log("🎉每日视频已经分享过了~")}}safeFunction(main,e=>{log(e)})})();