您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
用户登录(不可用)后进入微博主页,获取超级话题并自动签到
当前为
// ==UserScript== // @name 微博超话自动签到 // @description 用户登录(不可用)后进入微博主页,获取超级话题并自动签到 // @homepageURL https://github.com/Deuscx/WB_SIGN_EXT // @supportURL https://github.com/Deuscx/WB_SIGN_EXT/issues // @grant none // @version 2.0.1 // @author deus // @match https://weibo.com/* // @match https://www.weibo.com/* // @require https://cdn.jsdelivr.net/combine/npm/@violentmonkey/dom@1,npm/@violentmonkey/[email protected] // @require https://cdn.jsdelivr.net/npm/[email protected]/dist/axios.min.js // @namespace https://deuscx.github.io/ // ==/UserScript== !function(){"use strict";const e=(new Date).getTimezoneOffset()+480,t=Date.now,o=t=>{if(!t)return!0;const o=new Date(t);o.setMinutes(o.getMinutes()+e),o.setHours(0,0,0,0);const r=new Date;return r.setMinutes(o.getMinutes()+e),r-o>864e5},r={set:function(e,t){localStorage.setItem(e,JSON.stringify(t))},get:function(e){const t=localStorage.getItem(e);try{return JSON.parse(t)}catch(e){return t}},remove:function(e){localStorage.removeItem(e)},has:function(e){return Reflect.has(localStorage,e)}},n=(a=0,()=>a++);var a;const c="WB_SIGNED_ARR",i="WB_CONFIG",s="success",l="error",d="info",m="warning"; // global CSS let u=r.get(i);let p=0;const g={type:d,timeout:5e3},b=(()=>{const e=VM.createElement("div",{className:"msgContainer"},VM.createElement("style",null,".msgContainer{position:fixed;background-color:initial;top:4rem;right:40px}@keyframes slide-in-right{0%{transform:translateX(1000px);opacity:0}to{transform:translateX(0);opacity:1}}@keyframes slide-out-right{0%{transform:translateX(0);opacity:1}to{transform:translateX(1000px);opacity:0}}.removing{animation:slide-out-right .5s cubic-bezier(.55,.085,.68,.53) both}.toastItem{background-color:#fff;background-color:rgba(255,255,255,var(--bg-opacity));border-width:1px;--border-opacity:1;border-color:#cbd5e0;border-color:rgba(203,213,224,var(--border-opacity));border-radius:.375rem;max-width:20rem;--text-opacity:1;color:#fff;color:rgba(255,255,255,var(--text-opacity));z-index:10;padding:1rem 1.5rem;cursor:pointer;--bg-opacity:1;background-color:#3182ce;background-color:rgba(49,130,206,var(--bg-opacity));opacity:.8;margin-bottom:.5rem;animation:slide-in-right .5s cubic-bezier(.25,.46,.45,.94) both}.toast-info{--bg-opacity:1;background-color:#63b3ed;background-color:rgba(99,179,237,var(--bg-opacity))}.toast-default{--bg-opacity:1;background-color:#3182ce;background-color:rgba(49,130,206,var(--bg-opacity))}.toast-success{--bg-opacity:1;background-color:#48bb78;background-color:rgba(72,187,120,var(--bg-opacity))}.toast-error{background-color:#ff5252}.toast-warning{--bg-opacity:1;background-color:#f6e05e;background-color:rgba(246,224,94,var(--bg-opacity))}")),t=document.body.appendChild(e),o=(e,o)=>{if(!r.get(i).SHOW_TOAST)return;const a=Object.assign({},g,{id:n()},o,{content:e});// Show Toast p<8&&(p++,t.appendChild((e=>{const{content:t,type:o,timeout:r}=e;function n(){const t=document.querySelector(`[data-tid='${e.id}']`);t.classList.add("removing"),requestAnimationFrame((()=>{t.parentNode.removeChild(t),p--}))}return r&&setTimeout((()=>{n()}),r),VM.createElement(VM.Fragment,null,VM.createElement("div",{"data-tid":e.id,className:"toastItem toast-"+o,onClick:n},t))})(a)))};return o.success=(e,t)=>o(e,Object.assign({},t,{type:s})),o.error=(e,t)=>o(e,Object.assign({},t,{type:l})),o.info=(e,t)=>o(e,Object.assign({},t,{type:d})),o.warn=(e,t)=>o(e,Object.assign({},t,{type:m})),o})(),f={AUTO_SIGN:!0,SHOW_TOAST:!0,TIMEOUT:1e3},h=axios.create({baseURL:"https://weibo.com/",timeout:5e3});// 设置post请求头 h.defaults.headers.post["Content-Type"]="application/x-www-form-urlencoded", /** * 请求拦截器 * 每次请求前,如果存在token则在请求头中携带token */ h.interceptors.request.use((e=>e),(e=>Promise.error(e))),// 响应拦截器 h.interceptors.response.use((// 请求成功 e=>200===e.status?Promise.resolve(e):Promise.reject(e)),(// 请求失败 e=>{const{response:t}=e;return t?( // 请求已发出,但是不在2xx的范围 console.log("发送请求失败 "+t),Promise.reject(t)):// 处理断网的情况 window.navigator.onLine?Promise.reject(e):void console.error("断网")}));const y=r.get("lastCheck");let w=r.get(c)||[];const O=(e,o)=>new Promise(((n,a)=>{(e=>h({url:"p/aj/general/button", // eslint-disable-next-line no-undef params:{ajwvr:6,api:"http://i.huati.weibo.com/aj/super/checkin",texta:encodeURI("签到"),textb:encodeURI("已签到"),status:0,id:e, // 话题id location:"page_100808_super_index",timezone:"GMT 0800",lang:"zh-cn",plat:"Windows",ua:"Opera/9.80 (Windows NT 6.0) Presto/2.12.388 Version/12.14",screen:"1920*1080",__rnd:(new Date).getTime()}}))(e).then((e=>{const{data:i}=e;"100000"===i.code?(window.toast.success(`[${o}签到成功]${i.msg} ---${i.data.alert_title}`),r.set("lastCheck",t()),w.push(o),w=Array.from(new Set(w)),r.set(c,w)):(window.toast.warn(`[${o}超话签到]${i.msg}`),382004!==i.code? // 其他错误 a("error"):( // 已经签到 r.set("lastCheck",t()),w.push(o),w=Array.from(new Set(w)),r.set(c,w))),n()}),(e=>{a(e),window.toast.error(`[${o}超话签到]签到失败,请检查网络`)}))}));var k=new class extends class{ /** * @param {*} name 配置的名称 */ constructor({name:e}){this.launch=()=>{},this.name=e}get store(){const e=r.get(this.name);if(e)return e;r.set(this.name,void 0)}set store(e){r.set(this.name,e)}init(){return new Promise(((e,t)=>{try{this.launch(),e(this)}catch(e){console.log(`run ${this.name} error`),t(e)}}))}}{constructor(){super({name:i}),this.launch=async()=>{if(!super.store.AUTO_SIGN)return;if(r.get("isCheck")&&!o(y))return void window.toast.info("今日已签到");// 每天重新签到时 清空已经签到列表 o(y)&&(r.remove(c),r.set("isCheck",!1));const e=await new Promise(((e,t)=>{h({url:"ajax/profile/topicContent?tabid=231093_-_chaohua"}).then((o=>{const{data:{data:r,ok:n}}=o; /** * * @param {*} oid * @returns 超话id */ function a(e){return e.slice(5)}1!==n&&t("获取关注超话失败");const c=r.list.map((({oid:e,topic_name:t})=>({id:a(e),name:t})));e(c)}),(e=>{console.error("[WB]",e),t("获取hash失败")}))}));// 当所有都签到成功后,就设置'isCheck'为true Promise.all(e.map((({name:e,id:t})=>O(t,e)))).then((()=>{r.set("isCheck",!0)}))}}run(){this.init().then((e=>{}))}};function T(){return new Promise(((e,t)=>{try{const e=VM.createElement(VM.Fragment,null,VM.createElement("div",{className:"configContainer"},VM.createElement("label",{htmlFor:"AUTO_SIGN",className:"cItem"},VM.createElement("span",{className:"des"},"自动签到"),VM.createElement("input",{id:"AUTO_SIGN",type:"checkbox",onInput:e=>{const t=e.target.checked,o=Object.assign({},u,{AUTO_SIGN:t});u=o,r.set(i,u)},checked:u.AUTO_SIGN})),VM.createElement("label",{htmlFor:"SHOW_TOAST",className:"cItem"},VM.createElement("span",{className:"des"},"是否展示气泡"),VM.createElement("input",{id:"SHOW_TOAST",type:"checkbox",onInput:e=>{const t=e.target.checked,o=Object.assign({},u,{SHOW_TOAST:t});u=o,r.set(i,u)},checked:u.SHOW_TOAST})),VM.createElement("label",{htmlFor:"TIMEOUT",className:"cItem"},VM.createElement("span",{className:"des"},"气泡展示时间"),VM.createElement("input",{id:"TIMEOUT",type:"number",onInput:e=>{const t=e.target.value,o=Object.assign({},u,{TIMEOUT:t});u=o,r.set(i,u)},min:"0",value:parseInt(u.TIMEOUT,10),placeholder:"单位为毫秒"})),VM.createElement("div",{className:"action",onClick:()=>{document.querySelector(".configContainer").classList.toggle("active")}},"收放")),VM.createElement("style",null,".configContainer{display:flex;flex-direction:column;position:fixed;--bg-opacity:1;background-color:#fff;background-color:rgba(255,255,255,var(--bg-opacity));z-index:10;border-radius:.25rem;border-width:1px;--border-opacity:1;border-color:#cbd5e0;border-color:rgba(203,213,224,var(--border-opacity));padding:.75rem .5rem;max-width:190px;bottom:80px;right:0;transform:translateX(100%);transition-duration:.5s;transition-timing-function:cubic-bezier(.22,1,.36,1);transition-property:transform}.configContainer .cItem{font-size:.875rem;display:flex;justify-content:space-between;cursor:pointer}.configContainer .cItem .des{--text-opacity:1;color:#718096;color:rgba(113,128,150,var(--text-opacity))}#TIMEOUT{-webkit-appearance:none;-moz-appearance:none;appearance:none;display:inline-block;width:60px}.configContainer .action{padding-top:.5rem;padding-bottom:.5rem;border-radius:.25rem;background-color:#fff;cursor:pointer;position:absolute;top:50%;left:0;transform:translate3d(-100%,-50%,0)}.configContainer .action:hover{color:#ccc}.active{transform:translateX(0)}"));document.body.appendChild(e)}catch(e){throw new Error("初始化DOM失败")}}))}function v(){r.get(i)||r.set(i,f),// 初始化Toast window.toast=b}v(), // 初始化界面 T(),// 未签到 k.run()}();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址