-1

There is a global variable on a page that contains an object that I'd like to set up a scraper for. What's the best way to do this with Node / Express / potentially Cheerio?

I understand Cheerio's benefit in traversing a DOM, but I know the name of the global variable I want to scrape and just need to extract its information on a set schedule

lfkwtz
  • 1,007
  • 2
  • 11
  • 25
  • 1
    What is a "global variable on a page"? you mean a javascript variable in the code inserted in the page? – PA. Jan 08 '17 at 19:38
  • Yeah. There is a global variable on a website which is an object. If I go to this site and enter that variable name into my console, it returns the object I want. Is there a way with Node I can scrape that variable? – lfkwtz Jan 08 '17 at 19:43
  • Please show the page. If the variable is raw in a ` – ggorlen Jan 04 '23 at 19:13

1 Answers1

2

Cheerio is just a dom parser, so you wont have acces to any javascriot or any javascript generated content.

What you need is something like PhantomJS that simulates a browser. Have a look at this Stackoverflow answer

Community
  • 1
  • 1
charly rl
  • 845
  • 2
  • 7
  • 15