src/api/instagram.js
/**
     * Create the browser and page, then visit the url
     */
Create the browser and page, then visit the url
Create the browser and page then visit the url
async constructPage() {
        const args = [];
        if (process.env.NO_SANDBOX) {
            args.push("--no-sandbox");
            args.push("--disable-setuid-sandbox");
        }
        if (this.proxyURL !== undefined) {
            args.push("--proxy-server=" + this.proxyURL);
        }
        const options = {
            args,
            headless: this.headless,
        };
        if (this.executablePath !== undefined) {
            options.executablePath = this.executablePath;
        }
        if (!this.sameBrowser || (this.sameBrowser && !this.started)) {
            await this.progress(Progress.LAUNCHING);
            this.browser = await puppeteer_1.launch(options);
            this.browserDisconnected = false;
            this.browser.on("disconnected", () => (this.browserDisconnected = true));
        }
        this.page = await this.browser.newPage();
        await this.progress(Progress.OPENING);
        await this.page.goto(this.url);
        await this.page.evaluate(() => {
            setInterval(() => {
                try {
                    document.body.style.overflow = "";
                }
                catch (e) {
                    console.log("Failed to update style");
                    console.error(e.message);
                }
            }, 10000);
        });
    }
async constructPage ( ) { const args = [ ] ; if ( process . env . NO_SANDBOX ) { args . push ( "--no-sandbox" ) ; args . push ( "--disable-setuid-sandbox" ) ; } if ( this . proxyURL !== undefined ) { args . push ( "--proxy-server=" + this . proxyURL ) ; } const options = { args , headless : this . headless , } ; if ( this . executablePath !== undefined ) { options . executablePath = this . executablePath ; } if ( ! this . sameBrowser || ( this . sameBrowser && ! this . started ) ) { await this . progress ( Progress . LAUNCHING ) ; this . browser = await puppeteer_1 . launch ( options ) ; this . browserDisconnected = false ; this . browser . on ( "disconnected" , ( ) => ( this . browserDisconnected = true ) ) ; } this . page = await this . browser . newPage ( ) ; await this . progress ( Progress . OPENING ) ; await this . page . goto ( this . url ) ; await this . page . evaluate ( ( ) => { setInterval ( ( ) => { try { document . body . style . overflow = "" ; } catch ( e ) { console . log ( "Failed to update style" ) ; console . error ( e . message ) ; } } , 10000 ) ; } ) ; }
Create the browser and page, then visit the url
Create the browser and page then visit the url
// Browser args // Browser launch options // Launch browser // New page // Fix issue with disabled scrolling /* istanbul ignore next */ // tslint:disable-next-line:no-console // tslint:disable-next-line:no-console