We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import jsdom from 'jsdom'
const virtualConsole = new jsdom.VirtualConsole() const userAgent = await jsdom.JSDOM.fromURL('https://www.useragents.me', {virtualConsole}).then(_ => _.window.document.evaluate('//textarea[@Class="form-control ua-textarea" and contains(text(), "Linux x86_64")]/text()', .window.document, null, 2, null).stringValue) console.log(userAgent) const resources = new jsdom.ResourceLoader({userAgent, strictSSL:false}) console.log(await jsdom.JSDOM.fromURL('https://www.youtube.com/@Travelkel', { resources, virtualConsole, runScripts:'dangerously'}).then( => _.window.ytInitialData))
show: undefined
But if I remove resources, the actual ytInitialData is show import jsdom from 'jsdom'
const virtualConsole = new jsdom.VirtualConsole() const userAgent = await jsdom.JSDOM.fromURL('https://www.useragents.me', {virtualConsole}).then(_ => _.window.document.evaluate('//textarea[@Class="form-control ua-textarea" and contains(text(), "Linux x86_64")]/text()', .window.document, null, 2, null).stringValue) console.log(userAgent) const resources = new jsdom.ResourceLoader({userAgent, strictSSL:false}) console.log(await jsdom.JSDOM.fromURL('https://www.youtube.com/@Travelkel', { virtualConsole, runScripts:'dangerously'}).then( => _.window.ytInitialData))
Any idea how to change the useragent and also {runScripts:'dangerously'}
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Basic info:
Minimal reproduction case
import jsdom from 'jsdom'
const virtualConsole = new jsdom.VirtualConsole()
const userAgent = await jsdom.JSDOM.fromURL('https://www.useragents.me', {virtualConsole}).then(_ => _.window.document.evaluate('//textarea[@Class="form-control ua-textarea" and contains(text(), "Linux x86_64")]/text()', .window.document, null, 2, null).stringValue)
console.log(userAgent)
const resources = new jsdom.ResourceLoader({userAgent, strictSSL:false})
console.log(await jsdom.JSDOM.fromURL('https://www.youtube.com/@Travelkel', { resources, virtualConsole, runScripts:'dangerously'}).then( => _.window.ytInitialData))
show: undefined
But if I remove resources, the actual ytInitialData is show
import jsdom from 'jsdom'
const virtualConsole = new jsdom.VirtualConsole()
const userAgent = await jsdom.JSDOM.fromURL('https://www.useragents.me', {virtualConsole}).then(_ => _.window.document.evaluate('//textarea[@Class="form-control ua-textarea" and contains(text(), "Linux x86_64")]/text()', .window.document, null, 2, null).stringValue)
console.log(userAgent)
const resources = new jsdom.ResourceLoader({userAgent, strictSSL:false})
console.log(await jsdom.JSDOM.fromURL('https://www.youtube.com/@Travelkel', { virtualConsole, runScripts:'dangerously'}).then( => _.window.ytInitialData))
Any idea how to change the useragent and also {runScripts:'dangerously'}
The text was updated successfully, but these errors were encountered: