Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

449
Views
Intentando obtener el valor del token específico en la variable, Titiritero NODEJS

Estoy tratando de obtener el valor del token específico de esta respuesta en el exterior del bucle para poder mostrar este valor del token en la página HTML.

 import puppeteer from 'puppeteer-extra' var http = import('http'); puppeteer.launch({ headless: true }).then(async (browser) => { const page = await browser.newPage(); const token=[]; await page.goto('https://orbitxch.com/customer/inplay/highlights/1'); page.on('request', req => { const tok = req.headers() console.log(tok) }); });

Respuesta:

 'x-csrf-token': 'c7474114cc5e6b5e5deda9f46a9978dd69', 'sec-ch-ua-mobile': '?0', 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/100.0.4889.0 Safari/537.36

Quiere obtener el valor del token x-csrf en una variable. a la derecha, este comando devuelve el encabezado HTTP del sitio web completo, por lo que hay muchos tokens x-csrf, pero todos son iguales. Solo quiero un token en token variable. algun experto en nodejs?

Probé esto:

 const token=[]; await page.goto('https://orbitxch.com/customer/inplay/highlights/1'); page.on('request', req => { const tok = req.headers() token.push(tok) // but this not working it return [] console.log(tok) });
over 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!