Estoy en una máquina con Windows 10, descargué el navegador Tor y usar el navegador Tor normalmente funciona bien, pero me gustaría hacer que Puppeteer use Tor para iniciar en un modo sin cabeza, veo mucho sobre el Proxy de Socks5, pero no puede averiguar cómo configurarlo y por qué no funciona. Presumiblemente, cuando se ejecuta el método de inicio, ¿se inicia Tor en segundo plano?
Aquí está mi código JS en el nodo hasta ahora...
// puppeteer-extra is a drop-in replacement for puppeteer, // it augments the installed puppeteer with plugin functionality const puppeteer = require('puppeteer-extra') // add stealth plugin and use defaults (all evasion techniques) const StealthPlugin = require('puppeteer-extra-plugin-stealth') puppeteer.use(StealthPlugin()) // artificial sleep function const sleep = async (ms) => { return new Promise((res, rej) => { setTimeout(() => { res() }, ms) }) } // login function const emulate = async () => { // initiate a Puppeteer instance with options and launch const browser = await puppeteer.launch({ headless: false, args: [ '--proxy-server=socks5://127.0.0.1:1337' ] }); // launch Facebook and wait until idle const page = await browser.newPage() // go to Tor await page.goto('https://check.torproject.org/'); const isUsingTor = await page.$eval('body', el => el.innerHTML.includes('Congratulations. This browser is configured to use Tor') ); if (!isUsingTor) { console.log('Not using Tor. Closing...') return await browser.close() } // do something... } // kick it off emulate() Esto me da un error ERR_PROXY_CONNECTION_FAILED en cromo, ¿por qué no se inicia usando Tor?
Hay muchos más pasos que debe tomar.