1

I'm making a Telegram bot with the node-telegram-api running on node.js. I want it to retrieve (scrape) client-side javascript values from a website.

The website is an online calendar (which data is stored in a javascript object) and the events are stored in this object's "events" attribute (which is an array).

How can node.js retrieve this array's values? In other words, can node.js "read" this website as a browser and retrieve the client-side javascript values of this website?

Thank you in advance for your help :)

dialexo
  • 11
  • 1
  • Depends on how it puts the values in there. If it's a chunk of JS code inside a JS script block, probably ew. – Dave Newton Nov 12 '15 at 18:54
  • It could be done with PhantomJS: http://stackoverflow.com/questions/18831098/reading-javascript-variable-from-website-using-phantomjs – ciscoheat Nov 12 '15 at 19:06
  • Is that page rendering that objects or fetching them after page loaded? If it's rendering, your process is simple. Just make a `request()` to page and parse it using [cheerio](https://www.npmjs.com/package/cheerio). – Ozgur Nov 12 '15 at 20:22
  • I suggest you this library https://github.com/lapwinglabs/x-ray Here is a list of web scraping packages: http://blog.webkid.io/nodejs-scraping-libraries/ – ilbonte May 15 '16 at 14:18

0 Answers0