mirror of
https://github.com/TheNetsky/Microsoft-Rewards-Script.git
synced 2026-01-11 10:56:17 +00:00
1.4.11 (#146)
* 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:
@@ -34,9 +34,9 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.7.5",
|
"axios": "^1.7.5",
|
||||||
"cheerio": "^1.0.0",
|
"cheerio": "^1.0.0",
|
||||||
"fingerprint-generator": "^2.1.54",
|
"fingerprint-generator": "^2.1.56",
|
||||||
"fingerprint-injector": "^2.1.54",
|
"fingerprint-injector": "^2.1.56",
|
||||||
"playwright": "^1.46.1",
|
"playwright": "^1.47.2",
|
||||||
"ts-node": "^10.9.2"
|
"ts-node": "^10.9.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import { AccountProxy } from '../interface/Account'
|
|||||||
https://abrahamjuliot.github.io/creepjs/
|
https://abrahamjuliot.github.io/creepjs/
|
||||||
https://botcheck.luminati.io/
|
https://botcheck.luminati.io/
|
||||||
http://f.vision/
|
http://f.vision/
|
||||||
|
https://pixelscan.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Browser {
|
class Browser {
|
||||||
@@ -61,7 +62,7 @@ class Browser {
|
|||||||
const fingerPrintData = new FingerprintGenerator().getFingerprint({
|
const fingerPrintData = new FingerprintGenerator().getFingerprint({
|
||||||
devices: this.bot.isMobile ? ['mobile'] : ['desktop'],
|
devices: this.bot.isMobile ? ['mobile'] : ['desktop'],
|
||||||
operatingSystems: this.bot.isMobile ? ['android'] : ['windows'],
|
operatingSystems: this.bot.isMobile ? ['android'] : ['windows'],
|
||||||
browsers: ['edge']
|
browserListQuery: 'last 2 edge version'
|
||||||
})
|
})
|
||||||
|
|
||||||
return fingerPrintData
|
return fingerPrintData
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ export default class BrowserFunc {
|
|||||||
if (data.morePromotions?.length) {
|
if (data.morePromotions?.length) {
|
||||||
data.morePromotions.forEach(x => {
|
data.morePromotions.forEach(x => {
|
||||||
// Only count points from supported activities
|
// 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)
|
totalEarnablePoints += (x.pointProgressMax - x.pointProgress)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
},
|
},
|
||||||
"globalTimeout": 30000,
|
"globalTimeout": 30000,
|
||||||
"searchSettings": {
|
"searchSettings": {
|
||||||
"useGeoLocaleQueries": false,
|
"useGeoLocaleQueries": true,
|
||||||
"scrollRandomResults": true,
|
"scrollRandomResults": true,
|
||||||
"clickRandomResults": true,
|
"clickRandomResults": true,
|
||||||
"searchDelay": {
|
"searchDelay": {
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ export class Workers {
|
|||||||
morePromotions.push(data.promotionalItem as unknown as MorePromotion)
|
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) {
|
if (!activitiesUncompleted.length) {
|
||||||
this.bot.log('MORE-PROMOTIONS', 'All "More Promotion" items have already been completed')
|
this.bot.log('MORE-PROMOTIONS', 'All "More Promotion" items have already been completed')
|
||||||
|
|||||||
@@ -144,9 +144,6 @@ export class Search extends Workers {
|
|||||||
window.scrollTo(0, 0)
|
window.scrollTo(0, 0)
|
||||||
})
|
})
|
||||||
|
|
||||||
// Set it since params get added after visiting
|
|
||||||
this.searchPageURL = searchPage.url()
|
|
||||||
|
|
||||||
await this.bot.utils.wait(500)
|
await this.bot.utils.wait(500)
|
||||||
|
|
||||||
const searchBar = '#sb_form_q'
|
const searchBar = '#sb_form_q'
|
||||||
@@ -259,7 +256,7 @@ export class Search extends Workers {
|
|||||||
|
|
||||||
return response.data[1] as string[]
|
return response.data[1] as string[]
|
||||||
} catch (error) {
|
} 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 []
|
return []
|
||||||
}
|
}
|
||||||
@@ -291,13 +288,13 @@ export class Search extends Workers {
|
|||||||
try {
|
try {
|
||||||
await page.click('#b_results .b_algo h2', { timeout: 2000 }).catch(() => { }) // Since we don't really care if it did it or not
|
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
|
// 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)
|
let lastTab = await this.bot.browser.utils.getLatestTab(page)
|
||||||
|
|
||||||
// Stay for 10 seconds
|
let lastTabURL = new URL(lastTab.url()) // Get new tab info, this is the website we're visiting
|
||||||
await this.bot.utils.wait(10_000)
|
|
||||||
|
|
||||||
let lastTabURL = new URL(lastTab.url()) // Get new tab info, this is the website we've visited
|
|
||||||
|
|
||||||
// Check if the URL is different from the original one, don't loop more than 5 times.
|
// Check if the URL is different from the original one, don't loop more than 5 times.
|
||||||
let i = 0
|
let i = 0
|
||||||
@@ -332,10 +329,10 @@ export class Search extends Workers {
|
|||||||
await this.bot.utils.wait(3000)
|
await this.bot.utils.wait(3000)
|
||||||
this.searchPageURL = newPage.url()
|
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 {
|
} else {
|
||||||
lastTab = await this.bot.browser.utils.getLatestTab(lastTab)
|
lastTab = await this.bot.browser.utils.getLatestTab(lastTab)
|
||||||
await lastTab.goto(this.searchPageURL)
|
await lastTab.goto(this.searchPageURL ? this.searchPageURL : this.bingHome)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -351,6 +351,8 @@ export interface MorePromotion {
|
|||||||
legalText: string;
|
legalText: string;
|
||||||
legalLinkText: string;
|
legalLinkText: string;
|
||||||
deviceType: string;
|
deviceType: string;
|
||||||
|
exclusiveLockedFeatureType: string;
|
||||||
|
exclusiveLockedFeatureStatus: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PunchCard {
|
export interface PunchCard {
|
||||||
|
|||||||
Reference in New Issue
Block a user