* fix misspelling

* fix: avoid skipping eligible items in "More Promotion"

* remove unnecessary output

* Fix Formatting

* replace checking variable

* decrease id length

* revert previous commit

* change condition for eligible promo

* Other fixes

---------

Co-authored-by: TheNetsky <56271887+TheNetsky@users.noreply.github.com>
This commit is contained in:
HMCDAT
2024-10-02 23:37:06 +07:00
committed by GitHub
parent 7939196e88
commit 09ddbee45a
7 changed files with 17 additions and 17 deletions

View File

@@ -34,9 +34,9 @@
"dependencies": {
"axios": "^1.7.5",
"cheerio": "^1.0.0",
"fingerprint-generator": "^2.1.54",
"fingerprint-injector": "^2.1.54",
"playwright": "^1.46.1",
"fingerprint-generator": "^2.1.56",
"fingerprint-injector": "^2.1.56",
"playwright": "^1.47.2",
"ts-node": "^10.9.2"
}
}

View File

@@ -13,6 +13,7 @@ import { AccountProxy } from '../interface/Account'
https://abrahamjuliot.github.io/creepjs/
https://botcheck.luminati.io/
http://f.vision/
https://pixelscan.net/
*/
class Browser {
@@ -61,7 +62,7 @@ class Browser {
const fingerPrintData = new FingerprintGenerator().getFingerprint({
devices: this.bot.isMobile ? ['mobile'] : ['desktop'],
operatingSystems: this.bot.isMobile ? ['android'] : ['windows'],
browsers: ['edge']
browserListQuery: 'last 2 edge version'
})
return fingerPrintData

View File

@@ -160,7 +160,7 @@ export default class BrowserFunc {
if (data.morePromotions?.length) {
data.morePromotions.forEach(x => {
// Only count points from supported activities
if (['quiz', 'urlreward'].includes(x.promotionType) && !x.attributes.is_unlocked) {
if (['quiz', 'urlreward'].includes(x.promotionType) && x.exclusiveLockedFeatureStatus !== 'locked') {
totalEarnablePoints += (x.pointProgressMax - x.pointProgress)
}
})

View File

@@ -16,7 +16,7 @@
},
"globalTimeout": 30000,
"searchSettings": {
"useGeoLocaleQueries": false,
"useGeoLocaleQueries": true,
"scrollRandomResults": true,
"clickRandomResults": true,
"searchDelay": {

View File

@@ -87,7 +87,7 @@ export class Workers {
morePromotions.push(data.promotionalItem as unknown as MorePromotion)
}
const activitiesUncompleted = morePromotions?.filter(x => !x.complete && x.pointProgressMax > 0 && !x.attributes.is_unlocked) ?? []
const activitiesUncompleted = morePromotions?.filter(x => !x.complete && x.pointProgressMax > 0 && x.exclusiveLockedFeatureStatus !== 'locked') ?? []
if (!activitiesUncompleted.length) {
this.bot.log('MORE-PROMOTIONS', 'All "More Promotion" items have already been completed')

View File

@@ -144,9 +144,6 @@ export class Search extends Workers {
window.scrollTo(0, 0)
})
// Set it since params get added after visiting
this.searchPageURL = searchPage.url()
await this.bot.utils.wait(500)
const searchBar = '#sb_form_q'
@@ -259,7 +256,7 @@ export class Search extends Workers {
return response.data[1] as string[]
} catch (error) {
this.bot.log('SEARCH-BING-RELTATED', 'An error occurred:' + error, 'error')
this.bot.log('SEARCH-BING-RELATED', 'An error occurred:' + error, 'error')
}
return []
}
@@ -291,13 +288,13 @@ export class Search extends Workers {
try {
await page.click('#b_results .b_algo h2', { timeout: 2000 }).catch(() => { }) // Since we don't really care if it did it or not
// Stay for 10 seconds for page to load and "visit"
await this.bot.utils.wait(10_000)
// Will get current tab if no new one is created, this will always be the visited site or the result page if it failed to click
let lastTab = await this.bot.browser.utils.getLatestTab(page)
// Stay for 10 seconds
await this.bot.utils.wait(10_000)
let lastTabURL = new URL(lastTab.url()) // Get new tab info, this is the website we've visited
let lastTabURL = new URL(lastTab.url()) // Get new tab info, this is the website we're visiting
// Check if the URL is different from the original one, don't loop more than 5 times.
let i = 0
@@ -332,10 +329,10 @@ export class Search extends Workers {
await this.bot.utils.wait(3000)
this.searchPageURL = newPage.url()
// Else reset the last tab back to the search listing
// Else reset the last tab back to the search listing or Bing.com
} else {
lastTab = await this.bot.browser.utils.getLatestTab(lastTab)
await lastTab.goto(this.searchPageURL)
await lastTab.goto(this.searchPageURL ? this.searchPageURL : this.bingHome)
}
}

View File

@@ -351,6 +351,8 @@ export interface MorePromotion {
legalText: string;
legalLinkText: string;
deviceType: string;
exclusiveLockedFeatureType: string;
exclusiveLockedFeatureStatus: string;
}
export interface PunchCard {