Skip to content

Commit 28fbd74

Browse files
committed
新增:OPQuests验证任务及获取Key;
优化:OPQuests鉴赏家任务识别
1 parent 9049949 commit 28fbd74

19 files changed

+678
-118
lines changed

.github/workflows/Release.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@ jobs:
2121
uses: softprops/action-gh-release@v1
2222
with:
2323
prerelease: false
24-
tag_name: v4.2.24
25-
name: 4.2.24
26-
body: '- GiveeClub新增Twitter任务识别'
24+
tag_name: v4.2.25
25+
name: 4.2.25
26+
body: |-
27+
- 新增:OPQuests验证任务及获取Key
28+
- 优化:OPQuests鉴赏家任务识别
2729
files: |-
2830
dist/auto-task-v4-for-giveawaysu.user.js
2931
dist/auto-task-v4.compatibility.user.js

dist/auto-task-v4-for-giveawaysu.all.user.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/auto-task-v4-for-giveawaysu.user.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/auto-task-v4.all.user.js

Lines changed: 112 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// ==UserScript==
22
// @name auto-task-v4
33
// @namespace auto-task-v4
4-
// @version 4.2.24
4+
// @version 4.2.25
55
// @description 自动完成 Freeanywhere,Giveawaysu,GiveeClub,Givekey,Gleam,Indiedb,keyhub,OpiumPulses,Opquests,SweepWidget 等网站的任务。
66
// @description:en Automatically complete the tasks of FreeAnyWhere, GiveawaySu, GiveeClub, Givekey, Gleam, Indiedb, keyhub, OpiumPulses, Opquests, SweepWidget websites.
77
// @author HCLonely
@@ -9544,18 +9544,20 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
95449544
curatorLikeLinks: []
95459545
}
95469546
};
9547+
var Opquests_verify = new WeakSet();
95479548
var Opquests_getGiveawayId = new WeakSet();
95489549
var Opquests_checkLogin = new WeakSet();
95499550
class Opquests extends website_Website {
95509551
constructor() {
95519552
super(...arguments);
95529553
Opquests_classPrivateMethodInitSpec(this, Opquests_checkLogin);
95539554
Opquests_classPrivateMethodInitSpec(this, Opquests_getGiveawayId);
9555+
Opquests_classPrivateMethodInitSpec(this, Opquests_verify);
95549556
Opquests_defineProperty(this, 'name', 'Opquests');
95559557
Opquests_defineProperty(this, 'undoneTasks', {
95569558
...Opquests_defaultTasks
95579559
});
9558-
Opquests_defineProperty(this, 'buttons', [ 'doTask' ]);
9560+
Opquests_defineProperty(this, 'buttons', [ 'doTask', 'verifyTask', 'getKey' ]);
95599561
}
95609562
static test() {
95619563
return window.location.host === 'opquests.com';
@@ -9616,7 +9618,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
96169618
} else if (/follow/gim.test(taskDes)) {
96179619
this.undoneTasks.steam.followLinks.push(link);
96189620
}
9619-
} else if (/store\.steampowered\.com\/(publisher|developer)\//.test(link) && /follow/gim.test(taskDes)) {
9621+
} else if (/store\.steampowered\.com\/(publisher|developer|curator)\//.test(link) && /follow/gim.test(taskDes)) {
96209622
this.undoneTasks.steam.curatorLikeLinks.push(link);
96219623
} else {
96229624
scripts_echoLog({}).warning(`${i18n('unKnownTaskType')}: ${taskDes}(${link})`);
@@ -9633,6 +9635,113 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
96339635
return false;
96349636
}
96359637
}
9638+
async verifyTask() {
9639+
try {
9640+
const tasks = $.makeArray($('div.w-full').find('.items-center').has('button.submit-loader')).map(ele => ({
9641+
token: $(ele).find('input[name="_token"]').val(),
9642+
taskId: $(ele).find('input[name="task_id"]').val(),
9643+
title: $(ele).find('span.text-sm').text().trim()
9644+
}));
9645+
const pro = [];
9646+
for (const task of tasks) {
9647+
pro.push(Opquests_classPrivateMethodGet(this, Opquests_verify, Opquests_verify2).call(this, task));
9648+
await delay(1e3);
9649+
}
9650+
await Promise.all(pro);
9651+
scripts_echoLog({}).success(i18n('allTasksComplete'));
9652+
if (await this.getKey()) {
9653+
return true;
9654+
}
9655+
window.location.reload();
9656+
return false;
9657+
} catch (error) {
9658+
throwError(error, 'Opquests.verifyTask');
9659+
return false;
9660+
}
9661+
}
9662+
async getKey(isButton) {
9663+
try {
9664+
const logStatus = scripts_echoLog({
9665+
text: i18n('gettingKey')
9666+
});
9667+
const {
9668+
result,
9669+
statusText,
9670+
status,
9671+
data
9672+
} = await tools_httpRequest({
9673+
url: 'https://opquests.com/keys',
9674+
method: 'GET'
9675+
});
9676+
if (result === 'Success') {
9677+
if (data !== null && data !== void 0 && data.responseText) {
9678+
const key = $(data === null || data === void 0 ? void 0 : data.responseText).find(`div.items-center:contains("${$('h1.font-bold').text().trim().replace(' Quest', '')}")`).find('div.font-bold').next().text();
9679+
if (!key) {
9680+
logStatus.error('Error: Key was not found');
9681+
if (isButton) {
9682+
window.open('https://opquests.com/keys', '_self');
9683+
}
9684+
return false;
9685+
}
9686+
logStatus.success();
9687+
scripts_echoLog({}).success(key);
9688+
return true;
9689+
}
9690+
logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`);
9691+
return false;
9692+
}
9693+
logStatus.error(`${result}:${statusText}(${status})`);
9694+
return false;
9695+
} catch (error) {
9696+
throwError(error, 'Opquests.getGiveawayId');
9697+
return false;
9698+
}
9699+
}
9700+
}
9701+
async function Opquests_verify2(task) {
9702+
try {
9703+
const logStatus = scripts_echoLog({
9704+
html: `<li>${i18n('verifyingTask')}${task.title.trim()}...<font></font></li>`
9705+
});
9706+
const {
9707+
result,
9708+
statusText,
9709+
status,
9710+
data
9711+
} = await tools_httpRequest({
9712+
url: 'https://opquests.com/entries',
9713+
method: 'POST',
9714+
dataType: 'json',
9715+
nochche: true,
9716+
headers: {
9717+
origin: 'https://opquests.com',
9718+
pragma: 'no-cache',
9719+
referer: window.location.href,
9720+
'content-type': 'application/x-www-form-urlencoded'
9721+
},
9722+
data: `_token=${task.token}&task_id=${task.taskId}`
9723+
});
9724+
if (result === 'Success') {
9725+
var _data$responseText, _data$responseText2, _$$find$attr;
9726+
if (data !== null && data !== void 0 && (_data$responseText = data.responseText) !== null && _data$responseText !== void 0 && _data$responseText.includes('Successfully completed task') || data !== null && data !== void 0 && (_data$responseText2 = data.responseText) !== null && _data$responseText2 !== void 0 && _data$responseText2.includes('unlocked the key')) {
9727+
logStatus.success();
9728+
return true;
9729+
}
9730+
const key = (_$$find$attr = $((data === null || data === void 0 ? void 0 : data.responseText) || '').find('button[data-clipboard-text]:contains("Copy")').attr('data-clipboard-text')) === null || _$$find$attr === void 0 ? void 0 : _$$find$attr.trim();
9731+
if (key) {
9732+
logStatus.success();
9733+
scripts_echoLog({}).success(key);
9734+
return true;
9735+
}
9736+
logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`);
9737+
return false;
9738+
}
9739+
logStatus.error(`${result}:${statusText}(${status})`);
9740+
return false;
9741+
} catch (error) {
9742+
throwError(error, 'Opquests.verify');
9743+
return false;
9744+
}
96369745
}
96379746
function Opquests_getGiveawayId2() {
96389747
try {

dist/auto-task-v4.compatibility.all.user.js

Lines changed: 22 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/auto-task-v4.compatibility.user.js

Lines changed: 22 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/auto-task-v4.user.js

Lines changed: 112 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// ==UserScript==
22
// @name auto-task-v4
33
// @namespace auto-task-v4
4-
// @version 4.2.24
4+
// @version 4.2.25
55
// @description 自动完成 Freeanywhere,Giveawaysu,GiveeClub,Givekey,Gleam,Indiedb,keyhub,OpiumPulses,Opquests,SweepWidget 等网站的任务。
66
// @description:en Automatically complete the tasks of FreeAnyWhere, GiveawaySu, GiveeClub, Givekey, Gleam, Indiedb, keyhub, OpiumPulses, Opquests, SweepWidget websites.
77
// @author HCLonely
@@ -9525,18 +9525,20 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
95259525
curatorLikeLinks: []
95269526
}
95279527
};
9528+
var Opquests_verify = new WeakSet();
95289529
var Opquests_getGiveawayId = new WeakSet();
95299530
var Opquests_checkLogin = new WeakSet();
95309531
class Opquests extends website_Website {
95319532
constructor() {
95329533
super(...arguments);
95339534
Opquests_classPrivateMethodInitSpec(this, Opquests_checkLogin);
95349535
Opquests_classPrivateMethodInitSpec(this, Opquests_getGiveawayId);
9536+
Opquests_classPrivateMethodInitSpec(this, Opquests_verify);
95359537
Opquests_defineProperty(this, 'name', 'Opquests');
95369538
Opquests_defineProperty(this, 'undoneTasks', {
95379539
...Opquests_defaultTasks
95389540
});
9539-
Opquests_defineProperty(this, 'buttons', [ 'doTask' ]);
9541+
Opquests_defineProperty(this, 'buttons', [ 'doTask', 'verifyTask', 'getKey' ]);
95409542
}
95419543
static test() {
95429544
return window.location.host === 'opquests.com';
@@ -9597,7 +9599,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
95979599
} else if (/follow/gim.test(taskDes)) {
95989600
this.undoneTasks.steam.followLinks.push(link);
95999601
}
9600-
} else if (/store\.steampowered\.com\/(publisher|developer)\//.test(link) && /follow/gim.test(taskDes)) {
9602+
} else if (/store\.steampowered\.com\/(publisher|developer|curator)\//.test(link) && /follow/gim.test(taskDes)) {
96019603
this.undoneTasks.steam.curatorLikeLinks.push(link);
96029604
} else {
96039605
scripts_echoLog({}).warning(`${i18n('unKnownTaskType')}: ${taskDes}(${link})`);
@@ -9614,6 +9616,113 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
96149616
return false;
96159617
}
96169618
}
9619+
async verifyTask() {
9620+
try {
9621+
const tasks = $.makeArray($('div.w-full').find('.items-center').has('button.submit-loader')).map(ele => ({
9622+
token: $(ele).find('input[name="_token"]').val(),
9623+
taskId: $(ele).find('input[name="task_id"]').val(),
9624+
title: $(ele).find('span.text-sm').text().trim()
9625+
}));
9626+
const pro = [];
9627+
for (const task of tasks) {
9628+
pro.push(Opquests_classPrivateMethodGet(this, Opquests_verify, Opquests_verify2).call(this, task));
9629+
await delay(1e3);
9630+
}
9631+
await Promise.all(pro);
9632+
scripts_echoLog({}).success(i18n('allTasksComplete'));
9633+
if (await this.getKey()) {
9634+
return true;
9635+
}
9636+
window.location.reload();
9637+
return false;
9638+
} catch (error) {
9639+
throwError(error, 'Opquests.verifyTask');
9640+
return false;
9641+
}
9642+
}
9643+
async getKey(isButton) {
9644+
try {
9645+
const logStatus = scripts_echoLog({
9646+
text: i18n('gettingKey')
9647+
});
9648+
const {
9649+
result,
9650+
statusText,
9651+
status,
9652+
data
9653+
} = await tools_httpRequest({
9654+
url: 'https://opquests.com/keys',
9655+
method: 'GET'
9656+
});
9657+
if (result === 'Success') {
9658+
if (data !== null && data !== void 0 && data.responseText) {
9659+
const key = $(data === null || data === void 0 ? void 0 : data.responseText).find(`div.items-center:contains("${$('h1.font-bold').text().trim().replace(' Quest', '')}")`).find('div.font-bold').next().text();
9660+
if (!key) {
9661+
logStatus.error('Error: Key was not found');
9662+
if (isButton) {
9663+
window.open('https://opquests.com/keys', '_self');
9664+
}
9665+
return false;
9666+
}
9667+
logStatus.success();
9668+
scripts_echoLog({}).success(key);
9669+
return true;
9670+
}
9671+
logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`);
9672+
return false;
9673+
}
9674+
logStatus.error(`${result}:${statusText}(${status})`);
9675+
return false;
9676+
} catch (error) {
9677+
throwError(error, 'Opquests.getGiveawayId');
9678+
return false;
9679+
}
9680+
}
9681+
}
9682+
async function Opquests_verify2(task) {
9683+
try {
9684+
const logStatus = scripts_echoLog({
9685+
html: `<li>${i18n('verifyingTask')}${task.title.trim()}...<font></font></li>`
9686+
});
9687+
const {
9688+
result,
9689+
statusText,
9690+
status,
9691+
data
9692+
} = await tools_httpRequest({
9693+
url: 'https://opquests.com/entries',
9694+
method: 'POST',
9695+
dataType: 'json',
9696+
nochche: true,
9697+
headers: {
9698+
origin: 'https://opquests.com',
9699+
pragma: 'no-cache',
9700+
referer: window.location.href,
9701+
'content-type': 'application/x-www-form-urlencoded'
9702+
},
9703+
data: `_token=${task.token}&task_id=${task.taskId}`
9704+
});
9705+
if (result === 'Success') {
9706+
var _data$responseText, _data$responseText2, _$$find$attr;
9707+
if (data !== null && data !== void 0 && (_data$responseText = data.responseText) !== null && _data$responseText !== void 0 && _data$responseText.includes('Successfully completed task') || data !== null && data !== void 0 && (_data$responseText2 = data.responseText) !== null && _data$responseText2 !== void 0 && _data$responseText2.includes('unlocked the key')) {
9708+
logStatus.success();
9709+
return true;
9710+
}
9711+
const key = (_$$find$attr = $((data === null || data === void 0 ? void 0 : data.responseText) || '').find('button[data-clipboard-text]:contains("Copy")').attr('data-clipboard-text')) === null || _$$find$attr === void 0 ? void 0 : _$$find$attr.trim();
9712+
if (key) {
9713+
logStatus.success();
9714+
scripts_echoLog({}).success(key);
9715+
return true;
9716+
}
9717+
logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`);
9718+
return false;
9719+
}
9720+
logStatus.error(`${result}:${statusText}(${status})`);
9721+
return false;
9722+
} catch (error) {
9723+
throwError(error, 'Opquests.verify');
9724+
return false;
9725+
}
96179726
}
96189727
function Opquests_getGiveawayId2() {
96199728
try {

0 commit comments

Comments
 (0)