Наггетс сыграли вничью со Стадом! ! !
Я так долго копил руду Наггетс. Извините, что не стад. Мне жаль Наггетс. Мне жаль огромное количество рабочих. Я видел некоторые ошибки в коде стад, написанном некоторыми друзья.Братья скрины до точки кипения йо.
(async () => {
const res = await fetch('https://api.juejin.cn/growth_api/v1/get_cur_point', {
headers: {
cookie: document.cookie
},
method: 'GET',
credentials: 'include'
}).then((res) => res.json());
let score = res.data; // 当前分数
if (score < 200) return console.warn('分都不够想啥呢?');
const award = {};
const draw = async () => {
if (score < 200) {
console.log('梭哈结束!');
console.table(award);
alert(JSON.stringify(award, null, 2));
return;
}
const result = await fetch('https://api.juejin.cn/growth_api/v1/lottery/draw', {
headers: {
cookie: document.cookie
},
method: 'POST',
credentials: 'include'
}).then((res) => res.json());
if (result.err_no !== 0) {
console.log('梭哈结束!');
console.table(award);
alert(JSON.stringify(award, null, 2));
return;
}
score -= 200;
if (result.data.lottery_type === 1) score += 66;
if (award[result.data.lottery_name]) award[result.data.lottery_name]++;
else award[result.data.lottery_name] = 1;
console.log(`获得:${result.data.lottery_name}`);
draw();
};
console.log('开始梭哈!');
draw();
})();
Скопируйте приведенный выше код в консоль браузера и нажмите Enter, чтобы начать! ! !
сценарий масляной обезьяны
После напоминания трудящихся, обновите его, добавьте скрипт масляной обезьяны, скопируйте его прямо в масляную обезьяну, если это необходимо, спасибо здесь西门飘飘
Предоставленный совет
В обновлении добавлены функции 5 последовательных розыгрышей и 10 последовательных розыгрышей.
// ==UserScript==
// @name 掘金梭哈抽奖
// @namespace http://tampermonkey.net/
// @version 1.0.0
// @description 一键梭哈抽奖
// @author 无仙
// @match https://juejin.cn/*
// @icon https://lf3-cdn-tos.bytescm.com/obj/static/xitu_juejin_web//static/favicons/favicon-32x32.png
// @grant none
// ==/UserScript==
(function () {
'use strict';
// 抽奖逻辑
let loading = false;
const draw = async (times) => {
if (loading) return;
const res = await fetch('https://api.juejin.cn/growth_api/v1/get_cur_point', {
headers: {
cookie: document.cookie
},
method: 'GET',
credentials: 'include'
}).then((res) => res.json());
let score = res.data; // 当前分数
if (score < 200 * (times || 1)) return console.warn('分都不够想啥呢?');
let i = 0;
const award = {};
const draw = async () => {
if (score < 200 || i === times) {
loading = false;
i = 0;
console.log(`${times ? times + '连抽' : '梭哈'}结束!`);
console.table(award);
alert(JSON.stringify(award, null, 2));
return;
}
const result = await fetch('https://api.juejin.cn/growth_api/v1/lottery/draw', {
headers: {
cookie: document.cookie
},
method: 'POST',
credentials: 'include'
}).then((res) => res.json());
if (result.err_no !== 0) {
loading = false;
i = 0;
console.log(`${times ? times + '连抽' : '梭哈'}结束!`);
console.table(award);
alert(JSON.stringify(award, null, 2));
return;
}
i++;
score -= 200;
if (result.data.lottery_type === 1) score += 66;
if (award[result.data.lottery_name]) award[result.data.lottery_name]++;
else award[result.data.lottery_name] = 1;
console.log(`抽到:${result.data.lottery_name}`);
draw();
};
console.log(`开始${times ? times + '连抽' : '梭哈'}!`);
loading = true;
draw();
};
// 插入DOM
const container = document.createElement('div');
container.id = 'wx_draw_wrap';
container.innerHTML = `
<div id="wx_draw_all_in">梭哈抽奖</div>
<ul id="wx_draw_list">
<li id="wx_draw_5">5连抽</li>
<li id="wx_draw_10">10连抽</li>
</ul>
`;
document.body.appendChild(container);
// 获取DOM
const all_in_btn = document.getElementById('wx_draw_all_in');
const draw_5_btn = document.getElementById('wx_draw_5');
const draw_10_btn = document.getElementById('wx_draw_10');
// 事件绑定
all_in_btn.addEventListener('click', draw);
draw_5_btn.addEventListener('click', () => draw(5));
draw_10_btn.addEventListener('click', () => draw(10));
// 处理样式
const style = `
#wx_draw_wrap {
box-sizing: border-box;
position: fixed;
top: 50%;
left: 0px;
z-index: 999999;
margin-top: -20px;
}
#wx_draw_all_in {
box-sizing: border-box;
width: 40px;
height: 40px;
line-height: 16px;
font-size: 12px;
padding: 4px;
background-color: rgb(232, 243, 255);
border: 1px solid rgb(232, 243, 255);
color: rgb(30, 128, 255);
text-align: center;
overflow: hidden;
cursor: pointer;
}
#wx_draw_wrap:hover {
width: 128px;
}
#wx_draw_wrap:hover #wx_draw_list {
display: block;
}
#wx_draw_list {
display: none;
width: 80px;
position: absolute;
right: 0;
top: 0;
}
#wx_draw_list li {
box-sizing: border-box;
cursor: pointer;
margin-bottom: 4px;
background-color: rgb(232, 243, 255);
border: 1px solid rgb(232, 243, 255);
color: rgb(30, 128, 255);
font-size: 12px;
height: 18px;
line-height: 18px;
text-align: center;
}
`;
const styleEl = document.createElement('style');
styleEl.textContent = style;
document.head.appendChild(styleEl);
})();
Последняя визуализация масляной обезьяны
Последний скрипт использует petite-vue для визуализации,кодовый адрес
масляная обезьянаадрес установки, превью последнего скрипта: