Skip to content

Commit

Permalink
优化:Gleam任务识别优化
Browse files Browse the repository at this point in the history
  • Loading branch information
HCLonely committed Jan 3, 2023
1 parent f249173 commit 7b80940
Show file tree
Hide file tree
Showing 19 changed files with 161 additions and 119 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@ jobs:
uses: softprops/action-gh-release@v1
with:
prerelease: false
tag_name: v4.2.26
name: 4.2.26
body: |-
- 优化:Steam凭证更新方式
- 修复:Steam通知相关问题
tag_name: v4.2.27
name: 4.2.27
body: '- 优化:Gleam任务识别优化'
files: |-
dist/auto-task-v4-for-giveawaysu.user.js
dist/auto-task-v4.compatibility.user.js
Expand Down
2 changes: 1 addition & 1 deletion dist/auto-task-v4-for-giveawaysu.all.user.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/auto-task-v4-for-giveawaysu.user.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 14 additions & 15 deletions dist/auto-task-v4.all.user.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==
// @name auto-task-v4
// @namespace auto-task-v4
// @version 4.2.26
// @version 4.2.27
// @description 自动完成 Freeanywhere,Giveawaysu,GiveeClub,Givekey,Gleam,Indiedb,keyhub,OpiumPulses,Opquests,SweepWidget 等网站的任务。
// @description:en Automatically complete the tasks of FreeAnyWhere, GiveawaySu, GiveeClub, Givekey, Gleam, Indiedb, keyhub, OpiumPulses, Opquests, SweepWidget websites.
// @author HCLonely
Expand Down Expand Up @@ -8937,16 +8937,12 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
if (action !== 'do') {
continue;
}
const link = aElements.attr('href');
if (!link) {
continue;
}
const gleamLink = await this.#getGleamLink(link);
const gleamLink = await this.#getGleamLink(taskText);
if (!gleamLink) {
continue;
}
this.undoneTasks.extra.gleam.push(gleamLink);
} else if (socialIcon.hasClass('fa-question') || socialIcon.hasClass('fa-reddit') || socialIcon.hasClass('fa-instagram') || socialIcon.hasClass('fa-facebook-f') || socialIcon.hasClass('fa-telegram-plane') || socialIcon.hasClass('fa-envelope') || socialIcon.hasClass('fa-shield') && taskText.includes('Check out')) {} else {
} else if (socialIcon.hasClass('fa-question') || socialIcon.hasClass('fa-reddit') || socialIcon.hasClass('fa-instagram') || socialIcon.hasClass('fa-facebook-f') || socialIcon.hasClass('fa-telegram-plane') || socialIcon.hasClass('fa-envelope') || socialIcon.hasClass('fa-gift') || socialIcon.hasClass('fa-shield') && taskText.includes('Check out')) {} else {
scripts_echoLog({}).warning(`${i18n('unKnownTaskType')}: ${taskText}`);
}
}
Expand Down Expand Up @@ -9062,7 +9058,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
return false;
}
}
async #getGleamLink(link) {
async #getGleamLink(title) {
try {
const logStatus = scripts_echoLog({
text: i18n('gettingGleamLink')
Expand All @@ -9073,16 +9069,19 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
status,
data
} = await tools_httpRequest({
url: link,
method: 'GET'
url: 'https://www.vloot.io/api/v1/giveaways',
method: 'GET',
responseType: 'json'
});
if (result === 'Success') {
if ((data === null || data === void 0 ? void 0 : data.status) === 200) {
var _data$responseText$ma;
const gleamLink = (_data$responseText$ma = data.responseText.match(/href="(https:\/\/gleam\.io\/.*?\/.+?)"/)) === null || _data$responseText$ma === void 0 ? void 0 : _data$responseText$ma[1];
if (gleamLink) {
var _data$response, _data$response2;
if ((data === null || data === void 0 ? void 0 : data.status) === 200 && (data === null || data === void 0 ? void 0 : (_data$response = data.response) === null || _data$response === void 0 ? void 0 : _data$response.Success) === true && data !== null && data !== void 0 && (_data$response2 = data.response) !== null && _data$response2 !== void 0 && _data$response2.Data) {
const {
link
} = data.response.Data.find(giveaway => title.replace(/[\s]/g, '').toLowerCase().includes(giveaway.title.replace(/[\s]/g, '').toLowerCase())) || {};
if (link) {
logStatus.success();
return gleamLink;
return link;
}
logStatus.error(`Error:${i18n('getLinkFailed')}`);
return false;
Expand Down
20 changes: 10 additions & 10 deletions dist/auto-task-v4.compatibility.all.user.js

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions dist/auto-task-v4.compatibility.user.js

Large diffs are not rendered by default.

29 changes: 14 additions & 15 deletions dist/auto-task-v4.user.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==
// @name auto-task-v4
// @namespace auto-task-v4
// @version 4.2.26
// @version 4.2.27
// @description 自动完成 Freeanywhere,Giveawaysu,GiveeClub,Givekey,Gleam,Indiedb,keyhub,OpiumPulses,Opquests,SweepWidget 等网站的任务。
// @description:en Automatically complete the tasks of FreeAnyWhere, GiveawaySu, GiveeClub, Givekey, Gleam, Indiedb, keyhub, OpiumPulses, Opquests, SweepWidget websites.
// @author HCLonely
Expand Down Expand Up @@ -8918,16 +8918,12 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
if (action !== 'do') {
continue;
}
const link = aElements.attr('href');
if (!link) {
continue;
}
const gleamLink = await this.#getGleamLink(link);
const gleamLink = await this.#getGleamLink(taskText);
if (!gleamLink) {
continue;
}
this.undoneTasks.extra.gleam.push(gleamLink);
} else if (socialIcon.hasClass('fa-question') || socialIcon.hasClass('fa-reddit') || socialIcon.hasClass('fa-instagram') || socialIcon.hasClass('fa-facebook-f') || socialIcon.hasClass('fa-telegram-plane') || socialIcon.hasClass('fa-envelope') || socialIcon.hasClass('fa-shield') && taskText.includes('Check out')) {} else {
} else if (socialIcon.hasClass('fa-question') || socialIcon.hasClass('fa-reddit') || socialIcon.hasClass('fa-instagram') || socialIcon.hasClass('fa-facebook-f') || socialIcon.hasClass('fa-telegram-plane') || socialIcon.hasClass('fa-envelope') || socialIcon.hasClass('fa-gift') || socialIcon.hasClass('fa-shield') && taskText.includes('Check out')) {} else {
scripts_echoLog({}).warning(`${i18n('unKnownTaskType')}: ${taskText}`);
}
}
Expand Down Expand Up @@ -9043,7 +9039,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
return false;
}
}
async #getGleamLink(link) {
async #getGleamLink(title) {
try {
const logStatus = scripts_echoLog({
text: i18n('gettingGleamLink')
Expand All @@ -9054,16 +9050,19 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载');
status,
data
} = await tools_httpRequest({
url: link,
method: 'GET'
url: 'https://www.vloot.io/api/v1/giveaways',
method: 'GET',
responseType: 'json'
});
if (result === 'Success') {
if ((data === null || data === void 0 ? void 0 : data.status) === 200) {
var _data$responseText$ma;
const gleamLink = (_data$responseText$ma = data.responseText.match(/href="(https:\/\/gleam\.io\/.*?\/.+?)"/)) === null || _data$responseText$ma === void 0 ? void 0 : _data$responseText$ma[1];
if (gleamLink) {
var _data$response, _data$response2;
if ((data === null || data === void 0 ? void 0 : data.status) === 200 && (data === null || data === void 0 ? void 0 : (_data$response = data.response) === null || _data$response === void 0 ? void 0 : _data$response.Success) === true && data !== null && data !== void 0 && (_data$response2 = data.response) !== null && _data$response2 !== void 0 && _data$response2.Data) {
const {
link
} = data.response.Data.find(giveaway => title.replace(/[\s]/g, '').toLowerCase().includes(giveaway.title.replace(/[\s]/g, '').toLowerCase())) || {};
if (link) {
logStatus.success();
return gleamLink;
return link;
}
logStatus.error(`Error:${i18n('getLinkFailed')}`);
return false;
Expand Down
Loading

1 comment on commit 7b80940

@vercel
Copy link

@vercel vercel bot commented on 7b80940 Jan 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.