25 lines
		
	
	
		
			882 B
		
	
	
	
		
			JavaScript
		
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			882 B
		
	
	
	
		
			JavaScript
		
	
	
	
// import puppeteer from 'puppeteer';
 | 
						|
import puppeteer from 'puppeteer-extra';
 | 
						|
import CONSTANTS from './constants.js';
 | 
						|
import StealthPlugin from 'puppeteer-extra-plugin-stealth';
 | 
						|
 | 
						|
puppeteer.use(StealthPlugin());
 | 
						|
const browser = await puppeteer.launch({
 | 
						|
    headless: process.env.ENVIRONMENT === 'prod' ? true : false,
 | 
						|
    // userDataDir: CONSTANTS.PROFILE_PATH, // Thư mục lưu profile
 | 
						|
    timeout: 60000,
 | 
						|
    args: [
 | 
						|
        '--no-sandbox',
 | 
						|
        '--disable-setuid-sandbox',
 | 
						|
        '--disable-backgrounding-occluded-windows',
 | 
						|
        '--disable-renderer-backgrounding',
 | 
						|
        '--disable-ipc-flooding-protection',
 | 
						|
        '--disable-features=CalculateNativeWinOcclusion,AudioServiceOutOfProcess',
 | 
						|
        '--disable-background-timer-throttling',
 | 
						|
        '--ignore-certificate-errors',
 | 
						|
        '--start-maximized',
 | 
						|
    ],
 | 
						|
});
 | 
						|
 | 
						|
export default browser;
 |