mirror of
https://github.com/TheNetsky/Microsoft-Rewards-Script.git
synced 2026-01-18 05:53:57 +00:00
1.2.1
This commit is contained in:
@@ -157,13 +157,14 @@ async function solveActivities(page: Page, activities: PromotionalItem[] | MoreP
|
||||
await doUrlReward(activityPage)
|
||||
break
|
||||
|
||||
// Misc
|
||||
// Misc, Usually UrlReward Type
|
||||
default:
|
||||
log('ACTIVITY', `Found activity type: "Misc" title: "${activity.title}"`)
|
||||
await doUrlReward(activityPage)
|
||||
break
|
||||
}
|
||||
|
||||
// Cooldown
|
||||
await wait(1500)
|
||||
} catch (error) {
|
||||
log('ACTIVITY', 'An error occurred:' + error, 'error')
|
||||
|
||||
@@ -13,10 +13,6 @@ import { GoogleTrends } from '../../interface/GoogleDailyTrends'
|
||||
import { GoogleSearch } from '../../interface/Search'
|
||||
|
||||
export async function doSearch(page: Page, data: DashboardData, mobile: boolean) {
|
||||
const locale = await page.evaluate(() => {
|
||||
return navigator.language
|
||||
})
|
||||
|
||||
log('SEARCH-BING', 'Starting bing searches')
|
||||
|
||||
const mobileData = data.userStatus.counters?.mobileSearch ? data.userStatus.counters.mobileSearch[0] : null // Mobile searches
|
||||
@@ -33,7 +29,7 @@ export async function doSearch(page: Page, data: DashboardData, mobile: boolean)
|
||||
}
|
||||
|
||||
// Generate search queries
|
||||
let googleSearchQueries = await getGoogleTrends(locale, missingPoints) as GoogleSearch[]
|
||||
let googleSearchQueries = await getGoogleTrends(data.userProfile.attributes.country, missingPoints)
|
||||
googleSearchQueries = shuffleArray(googleSearchQueries)
|
||||
|
||||
// Deduplicate the search terms
|
||||
@@ -185,10 +181,14 @@ async function bingSearch(page: Page, searchPage: Page, query: string) {
|
||||
return await getSearchPoints(page)
|
||||
}
|
||||
|
||||
async function getGoogleTrends(locale: string, queryCount: number): Promise<GoogleSearch[]> {
|
||||
async function getGoogleTrends(geoLocale: string, queryCount: number): Promise<GoogleSearch[]> {
|
||||
const queryTerms: GoogleSearch[] = []
|
||||
let i = 0
|
||||
|
||||
geoLocale = (searchSettings.useGeoLocaleQueries && geoLocale.length === 2) ? geoLocale.toUpperCase() : 'US'
|
||||
|
||||
log('SEARCH-GOOGLE-TRENDS', `Generating search queries, can take a while! | GeoLocale: ${geoLocale}`)
|
||||
|
||||
while (queryCount > queryTerms.length) {
|
||||
i += 1
|
||||
const date = new Date()
|
||||
@@ -197,7 +197,7 @@ async function getGoogleTrends(locale: string, queryCount: number): Promise<Goog
|
||||
|
||||
try {
|
||||
const request = {
|
||||
url: `https://trends.google.com/trends/api/dailytrends?geo=US&hl=en&ed=${formattedDate}&ns=15`,
|
||||
url: `https://trends.google.com/trends/api/dailytrends?geo=${geoLocale}&hl=en&ed=${formattedDate}&ns=15`,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
@@ -283,13 +283,11 @@ async function clickRandomLink(page: Page) {
|
||||
// Check if the URL is different from the original one, don't loop more than 5 times.
|
||||
let i = 0
|
||||
while (lastTabURL.href !== searchListingURL.href && i < 5) {
|
||||
|
||||
// If hostname is still bing, (Bing images/news etc)
|
||||
if (lastTabURL.hostname == searchListingURL.hostname) {
|
||||
await lastTab.goBack()
|
||||
|
||||
lastTab = await getLatestTab(page) // Get last opened tab
|
||||
lastTabURL = new URL(lastTab.url())
|
||||
|
||||
// If "goBack" didn't return to search listing (due to redirects)
|
||||
if (lastTabURL.hostname !== searchListingURL.hostname) {
|
||||
|
||||
@@ -2,9 +2,9 @@ import { Page } from 'puppeteer'
|
||||
|
||||
import { wait } from '../../util/Utils'
|
||||
import { log } from '../../util/Logger'
|
||||
import { getQuizData } from '../../browser/BrowserFunc'
|
||||
|
||||
export async function doThisOrThat(page: Page) {
|
||||
return // Todo
|
||||
log('THIS-OR-THAT', 'Trying to complete ThisOrThat')
|
||||
|
||||
try {
|
||||
@@ -22,7 +22,9 @@ export async function doThisOrThat(page: Page) {
|
||||
await wait(2000)
|
||||
|
||||
// Solving
|
||||
|
||||
const quizData = await getQuizData(page)
|
||||
quizData // correctAnswer property is always null?
|
||||
|
||||
log('THIS-OR-THAT', 'Completed the ThisOrthat successfully')
|
||||
} catch (error) {
|
||||
await page.close()
|
||||
|
||||
Reference in New Issue
Block a user