This commit is contained in:
TheNetsky
2023-09-25 12:16:40 +02:00
parent 0a675dd6e0
commit c802492f18
27 changed files with 2115 additions and 1 deletions

40
src/Browser.ts Normal file
View File

@@ -0,0 +1,40 @@
import puppeteer from 'puppeteer-extra'
import StealthPlugin from 'puppeteer-extra-plugin-stealth'
import { getUserAgent } from './util/UserAgent'
import { loadSesion } from './BrowserFunc'
puppeteer.use(StealthPlugin())
export async function Browser(email: string, headless = false) {
const userAgent = await getUserAgent(false)
const browser = await puppeteer.launch({
headless: headless, // Set to true for a headless browser
userDataDir: await loadSesion(email),
args: [
'--no-sandbox',
'--disable-setuid-sandbox',
`--user-agent=${userAgent.userAgent}`
]
})
return browser
}
export async function mobileBrowser(email: string, headless = false) {
const userAgent = await getUserAgent(true)
const browser = await puppeteer.launch({
headless: headless, // Set to true for a headless browser,
userDataDir: await loadSesion(email),
args: [
'--no-sandbox',
'--disable-setuid-sandbox',
`--user-agent=${userAgent.userAgent}`,
'--window-size=568,1024'
]
})
return browser
}