mirror of
https://github.com/TheNetsky/Microsoft-Rewards-Script.git
synced 2026-01-19 06:23:58 +00:00
1.0.7
This commit is contained in:
@@ -8,35 +8,24 @@ import { headless } from '../config.json'
|
||||
|
||||
puppeteer.use(StealthPlugin())
|
||||
|
||||
export async function Browser(email: string) {
|
||||
const userAgent = await getUserAgent(false)
|
||||
class Browser {
|
||||
|
||||
const browser = await puppeteer.launch({
|
||||
headless: headless,
|
||||
userDataDir: await loadSesion(email),
|
||||
args: [
|
||||
'--no-sandbox',
|
||||
'--disable-setuid-sandbox',
|
||||
`--user-agent=${userAgent.userAgent}`
|
||||
]
|
||||
})
|
||||
async createBrowser(email: string, isMobile: boolean) {
|
||||
const userAgent = await getUserAgent(isMobile)
|
||||
|
||||
return browser
|
||||
const browser = await puppeteer.launch({
|
||||
headless: headless,
|
||||
userDataDir: await loadSesion(email),
|
||||
args: [
|
||||
'--no-sandbox',
|
||||
'--disable-setuid-sandbox',
|
||||
`--user-agent=${userAgent.userAgent}`,
|
||||
isMobile ? '--window-size=568,1024' : ''
|
||||
]
|
||||
})
|
||||
|
||||
return browser
|
||||
}
|
||||
}
|
||||
|
||||
export async function mobileBrowser(email: string) {
|
||||
const userAgent = await getUserAgent(true)
|
||||
|
||||
const browser = await puppeteer.launch({
|
||||
headless: headless,
|
||||
userDataDir: await loadSesion(email),
|
||||
args: [
|
||||
'--no-sandbox',
|
||||
'--disable-setuid-sandbox',
|
||||
`--user-agent=${userAgent.userAgent}`,
|
||||
'--window-size=568,1024'
|
||||
]
|
||||
})
|
||||
|
||||
return browser
|
||||
}
|
||||
export default Browser
|
||||
@@ -218,4 +218,11 @@ export async function checkQuizCompleted(page: Page) {
|
||||
} catch (error) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
export async function refreshCheerio(page: Page) {
|
||||
const html = await page.content()
|
||||
const $ = load(html)
|
||||
|
||||
return $
|
||||
}
|
||||
Reference in New Issue
Block a user