// ==UserScript==
// @name 百度网盘领劵
// @name:zh 百度网盘领卷
// @namespace baiDuYunLingJuan
// @version 1.1.0
// @author TING软件科技
// @description 【官方渠道】解除百度网盘限速。每日领取【百度网盘】极速下载卷。每天都可以领3张。原理利用了官方游戏活动,【无封号风险】。联系作者请加QQ群:882776749【长期维护】
// @license AGPL v3
// @icon https://vitejs.dev/logo.svg
// @match https://pan.baidu.com/*
// @require https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.global.prod.js
// @require data:application/javascript,%3Bwindow.Vue%20%3D%20Vue%3B
// @require https://cdn.jsdelivr.net/npm/[email protected]/dist/index.full.min.js
// @connect wan.baidu.com
// @grant GM_addStyle
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_xmlhttpRequest
// @noframes
// ==/UserScript==
(e=>{if(typeof GM_addStyle=="function"){GM_addStyle(e);return}const a=document.createElement("style");a.textContent=e,document.head.append(a)})(" #AppBtn[data-v-6221d9fc]{position:fixed;bottom:100px;right:100px}#tingApp[data-v-24ee8511]{position:fixed;z-index:99999}body[data-v-24ee8511]{margin:0;padding:0;font-family:Segoe UI,Tahoma,Geneva,Verdana,sans-serif;background-color:#f5f7fa}.content[data-v-24ee8511]{flex:1;box-sizing:border-box;background-color:#fff}.header[data-v-24ee8511]{text-align:center;margin-bottom:10px;padding:20px;background:linear-gradient(120deg,#a1c4fd,#c2e9fb);box-shadow:0 4px 6px #0000001a}.header h1[data-v-24ee8511]{margin:0;color:#2c3e50;font-size:28px}.header p[data-v-24ee8511]{margin:10px 0 0;color:#7f8c8d;font-size:16px}.task-list[data-v-24ee8511]{display:grid;padding:10px;box-sizing:border-box;grid-template-columns:repeat(auto-fill,minmax(350px,1fr));gap:14px;margin-top:20px}.task-card[data-v-24ee8511]{background:#fff;border-radius:12px;box-shadow:0 4px 15px #0000001a;padding:14px;transition:all .3s ease;border-left:5px solid #3498db}.task-card[data-v-24ee8511]:hover{transform:translateY(-5px);box-shadow:0 8px 25px #00000026}.task-card.processing[data-v-24ee8511]{border-left-color:#f39c12}.task-card.completed[data-v-24ee8511]{border-left-color:#27ae60}.task-card.error[data-v-24ee8511]{border-left-color:#e74c3c}.task-title[data-v-24ee8511]{font-size:16px;font-weight:600;margin:0 0 10px;color:#2c3e50;display:flex;justify-content:space-between;align-items:center}.task-module[data-v-24ee8511]{background-color:#ecf0f1;color:#7f8c8d;padding:3px 8px;border-radius:12px;font-size:12px;font-weight:400}.task-info[data-v-24ee8511]{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:15px 0}.info-item[data-v-24ee8511]{font-size:14px}.info-label[data-v-24ee8511]{color:#7f8c8d;font-weight:500}.info-value[data-v-24ee8511]{color:#2c3e50;font-weight:600;word-break:break-all}.task-status[data-v-24ee8511]{padding:8px 12px;border-radius:20px;font-size:13px;font-weight:500;text-align:center;margin-top:10px}.status-pending[data-v-24ee8511]{background-color:#f8f9fa;color:#6c757d}.status-processing[data-v-24ee8511]{background-color:#fff3cd;color:#856404}.status-completed[data-v-24ee8511]{background-color:#d4edda;color:#155724}.status-error[data-v-24ee8511]{background-color:#f8d7da;color:#721c24}.progress-bar[data-v-24ee8511]{height:8px;background-color:#ecf0f1;border-radius:4px;margin:15px 0;overflow:hidden}.progress-fill[data-v-24ee8511]{height:100%;background:linear-gradient(90deg,#3498db,#2ecc71);border-radius:4px;transition:width .3s ease}.loading[data-v-24ee8511]{text-align:center;padding:40px;color:#7f8c8d}.loading-spinner[data-v-24ee8511]{border:4px solid #f3f3f3;border-top:4px solid #3498db;border-radius:50%;width:40px;height:40px;animation:spin-24ee8511 1s linear infinite;margin:0 auto 20px}@keyframes spin-24ee8511{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.empty-state[data-v-24ee8511]{text-align:center;padding:60px 20px;color:#7f8c8d}.empty-state i[data-v-24ee8511]{font-size:48px;margin-bottom:20px;display:block}#el[data-v-24ee8511]{display:flex;justify-content:space-between} ");
(function (vue, ElementPlus) {
'use strict';
const _export_sfc = (sfc, props) => {
const target = sfc.__vccOpts || sfc;
for (const [key, val] of props) {
target[key] = val;
}
return target;
};
const _sfc_main$1 = {
__name: "AppBtn",
setup(__props) {
return (_ctx, _cache) => {
return vue.openBlock(), vue.createBlock(vue.unref(ElementPlus.ElButton), {
type: "primary",
id: "AppBtn",
size: "large"
}, {
default: vue.withCtx(() => [
vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
]),
_: 3
});
};
}
};
const AppBtn = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-6221d9fc"]]);
const config = {
// 根据频道Id获取任务数组
channelArr: [10066, 10065],
// 过滤出免费任务
taskModules: ["game_return_play", "new_game_play"]
};
window.addEventListener("message", (e) => {
if (e.data.type === "start") {
start();
}
});
async function start(obj) {
const tasks = await getAllTask();
Promise.all(
tasks.map((item) => getOneDownload(item.selectGameParams, item))
).then();
}
async function getAllTask() {
const channelArr = config.channelArr;
const promises = channelArr.map(
(channel) => new Promise((resolve) => {
GM_xmlhttpRequest({
method: "GET",
url: `https://wan.baidu.com/gameapi?action=bonus_pan_task_list&channel=${channel}`,
headers: {
"Content-Type": "application/json",
Cookie: document.cookie
},
onload: function(response) {
resolve(JSON.parse(response.responseText));
}
});
})
);
const task_result = await Promise.all(promises);
const taskOneWei = [];
task_result.forEach((item) => {
if (item.errorNo === 0 && item.result && item.result.data) {
item.result.data.forEach((task) => {
if (Array.isArray(task.data)) {
taskOneWei.push(...task.data);
}
});
}
});
const taskMianFei = taskOneWei.filter(
(item) => config.taskModules.includes(item.taskModule)
);
const taskReal = taskMianFei.map((item) => {
let selectGame = getRandomItem(item.taskGames);
return {
...item,
selectGame,
selectGameParams: {
...url2obj(selectGame.gameUrl)
}
};
});
send_message({ type: "task_result", taskReal });
return taskReal;
}
async function getOneDownload({ gameId, taskId, activityId }, task) {
const sendApi = (params) => {
GM_xmlhttpRequest({
method: "GET",
url: `https://wan.baidu.com/gameapi?${obj2url(params)}`,
headers: {
"Content-Type": "application/json",
Cookie: document.cookie
},
onload: async function(response) {
const data = JSON.parse(response.responseText);
if (data.errorNo === 110503 || data.result && data.result.data && data.result.data.remainingTaskTime === 0) {
await setStorage(getId(taskId), 0);
return send_message({
type: "task_status_update",
taskId: params.taskId,
status: `completed`,
progress: 100
});
}
if (data.errorNo !== 0) {
return send_message({
type: "task_status_update",
taskId: params.taskId,
errorNo: data.errorNo,
status: `error`,
progress: 40,
errorMessage: `${data.message}(请刷新页面 或 重新登录 )`
});
}
if (data.result && data.result.data && data.result.data.remainingTaskTime) {
let finiTime = task.eachTaskNeedPlayTimeSecs - data.result.data.remainingTaskTime;
send_message({
type: "task_status_update",
taskId: params.taskId,
status: `processing`,
progress: parseInt(
finiTime / task.eachTaskNeedPlayTimeSecs * 100
)
});
await setStorage(getId(taskId), data.result.data.remainingTaskTime);
}
if (data.result && data.result.data && data.result.data.nextReportInterval) {
setTimeout(() => {
sendApi({ ...params, isFirstReport: 0 });
}, 10 * 1e3);
}
}
});
};
sendApi({
gameId,
isFirstReport: await getStorage(getId(taskId)) ? 0 : 1,
taskId,
activityId,
action: "bonus_task_game_play_report"
});
}
function send_message(data) {
window.postMessage({
type: data.type,
data
});
}
function getId(taskId) {
var date = /* @__PURE__ */ new Date();
var year = date.getFullYear();
var month = date.getMonth() + 1;
var day = date.getDate();
return year + "_" + month + "_" + day + "_" + taskId;
}
function getRandomItem(arr) {
return arr[Math.floor(Math.random() * arr.length)];
}
function url2obj(url) {
var obj = {};
var arr = url.split("?")[1].split("&");
for (var i = 0; i < arr.length; i++) {
var item = arr[i].split("=");
if (item[0].trim()) {
obj[item[0]] = item[1];
}
}
return obj;
}
function obj2url(obj) {
var url = "";
for (var key in obj) {
url += key + "=" + obj[key] + "&";
}
return url.substring(0, url.length - 1);
}
function setStorage(key, value) {
return new Promise((resolve) => {
GM_setValue(key, value);
resolve();
});
}
function getStorage(key) {
return new Promise((resolve) => {
resolve(GM_getValue(key, null));
});
}
const _hoisted_1 = { id: "el" };
const _hoisted_2 = { class: "content" };
const _hoisted_3 = {
key: 0,
class: "loading"
};
const _hoisted_4 = {
key: 1,
class: "empty-state"
};
const _hoisted_5 = {
key: 2,
class: "task-list"
};
const _hoisted_6 = { class: "task-title" };
const _hoisted_7 = { class: "task-module" };
const _hoisted_8 = { class: "task-info" };
const _hoisted_9 = { class: "info-item" };
const _hoisted_10 = { class: "info-value" };
const _hoisted_11 = { class: "info-item" };
const _hoisted_12 = { class: "info-value" };
const _hoisted_13 = {
key: 0,
class: "progress-bar"
};
const _hoisted_14 = { key: 0 };
const _hoisted_15 = { key: 1 };
const _hoisted_16 = { key: 2 };
const _hoisted_17 = { key: 3 };
const _hoisted_18 = { key: 4 };
const _sfc_main = {
__name: "App",
setup(__props) {
let drawer = vue.ref(false);
const tasks = vue.ref([]);
const loading = vue.ref(false);
const handleStartTask = () => {
loading.value = true;
window.postMessage({ type: "start" }, "*");
};
const init = () => {
const handleMessage = (event) => {
let eventData = event.data;
if (eventData.type === "task_result") {
tasks.value = eventData.data.taskReal.map((task) => ({
...task,
status: "pending",
progress: 0
}));
loading.value = false;
}
if (event.data.type === "task_status_update") {
const taskIndex = tasks.value.findIndex((task) => {
return +task?.taskId === +eventData.data.taskId;
});
if (taskIndex !== -1) {
tasks.value[taskIndex] = {
...tasks.value[taskIndex],
...eventData.data
};
if (eventData.data.errorNo === 110008) {
ElementPlus.ElMessage({
message: `请登录【百度网盘网页版】后再领取下载卷`,
duration: 5e3,
type: "warning"
});
}
} else {
console.log(`找不到:${taskIndex}`);
}
}
};
window.addEventListener("message", handleMessage);
vue.onBeforeUnmount(() => {
window.removeEventListener("message", handleMessage);
});
};
vue.onMounted(() => {
init();
});
return (_ctx, _cache) => {
const _component_el_button = vue.resolveComponent("el-button");
const _component_el_drawer = vue.resolveComponent("el-drawer");
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
vue.createVNode(AppBtn, {
onClick: _cache[0] || (_cache[0] = ($event) => vue.isRef(drawer) ? drawer.value = !vue.unref(drawer) : drawer = !vue.unref(drawer))
}, {
default: vue.withCtx(() => _cache[2] || (_cache[2] = [
vue.createTextVNode("打 开 插 件", -1)
])),
_: 1,
__: [2]
}),
vue.createVNode(_component_el_drawer, {
modelValue: vue.unref(drawer),
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => vue.isRef(drawer) ? drawer.value = $event : drawer = $event),
title: "百度下载卷领取助手"
}, {
default: vue.withCtx(() => [
vue.createElementVNode("div", null, [
vue.createVNode(_component_el_button, {
loading: loading.value,
onClick: handleStartTask,
type: "primary",
disabled: tasks.value.length
}, {
default: vue.withCtx(() => [
vue.createTextVNode(vue.toDisplayString(tasks.value.length ? "明天再来领取吧~" : "开始领取"), 1)
]),
_: 1
}, 8, ["loading", "disabled"])
]),
vue.createElementVNode("div", _hoisted_1, [
vue.createElementVNode("div", _hoisted_2, [
loading.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3, _cache[3] || (_cache[3] = [
vue.createElementVNode("div", { class: "loading-spinner" }, null, -1),
vue.createElementVNode("p", null, "正在加载可用下载卷...", -1)
]))) : tasks.value.length === 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4, _cache[4] || (_cache[4] = [
vue.createElementVNode("div", null, "📋", -1),
vue.createElementVNode("h3", null, "暂无任务,点击开始领取", -1)
]))) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_5, [
_cache[7] || (_cache[7] = vue.createElementVNode("p", { style: { "color": "orange", "text-align": "right" } }, " 请勿刷新页面,否则可能影响领卷~", -1)),
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(tasks.value, (task, index) => {
return vue.openBlock(), vue.createElementBlock("div", {
key: index,
class: vue.normalizeClass(["task-card", {
"processing": task.status === "processing",
"completed": task.status === "completed",
"error": task.status === "error"
}])
}, [
vue.createElementVNode("div", _hoisted_6, [
vue.createElementVNode("span", null, "极速下载卷 #" + vue.toDisplayString(index + 1), 1),
vue.createElementVNode("span", _hoisted_7, vue.toDisplayString(task.taskModule || "未知模块"), 1)
]),
vue.createElementVNode("div", _hoisted_8, [
vue.createElementVNode("div", _hoisted_9, [
_cache[5] || (_cache[5] = vue.createElementVNode("div", { class: "info-label" }, "程序ID", -1)),
vue.createElementVNode("div", _hoisted_10, vue.toDisplayString(task.selectGameParams?.gameId || "N/A"), 1)
]),
vue.createElementVNode("div", _hoisted_11, [
_cache[6] || (_cache[6] = vue.createElementVNode("div", { class: "info-label" }, "任务ID", -1)),
vue.createElementVNode("div", _hoisted_12, vue.toDisplayString(index + 1), 1)
])
]),
task.progress ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_13, [
vue.createElementVNode("div", {
class: "progress-fill",
style: vue.normalizeStyle({ width: task.progress + "%" })
}, null, 4)
])) : vue.createCommentVNode("", true),
vue.createElementVNode("div", {
class: vue.normalizeClass(["task-status", {
"status-pending": task.status === "pending",
"status-processing": task.status === "processing",
"status-completed": task.status === "completed",
"status-error": task.status === "error"
}])
}, [
task.status === "pending" ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_14, "等待领取")) : task.status === "processing" ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_15, "领取中... " + vue.toDisplayString(task.progress) + "%", 1)) : task.status === "completed" ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_16, "✅ 已领取,明天再来吧~")) : task.status === "error" ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_17, "❌ 错误: " + vue.toDisplayString(task.errorMessage), 1)) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_18, "未知状态"))
], 2)
], 2);
}), 128))
]))
])
])
]),
_: 1
}, 8, ["modelValue"])
], 64);
};
}
};
const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-24ee8511"]]);
var _GM_getValue = /* @__PURE__ */ (() => typeof GM_getValue != "undefined" ? GM_getValue : void 0)();
var _GM_setValue = /* @__PURE__ */ (() => typeof GM_setValue != "undefined" ? GM_setValue : void 0)();
var _GM_xmlhttpRequest = /* @__PURE__ */ (() => typeof GM_xmlhttpRequest != "undefined" ? GM_xmlhttpRequest : void 0)();
window.GM_xmlhttpRequest = _GM_xmlhttpRequest;
window.GM_setValue = _GM_setValue;
window.GM_getValue = _GM_getValue;
const link = document.createElement("link");
link.rel = "stylesheet";
link.href = "https://cdn.jsdelivr.net/npm/[email protected]/dist/index.css";
document.head.appendChild(link);
const appContainer = document.createElement("div");
const appId = `tingApp`;
appContainer.id = appId;
document.body.appendChild(appContainer);
vue.createApp(App).use(ElementPlus).mount(appContainer);
})(Vue, ElementPlus);