Get text from an HTML that uses JavaScript

Posted on
Mon Feb 16, 2015 11:47 am
davinci offline

Get text from an HTML that uses JavaScript

I have an HTML page that executes some JavaScript. When I load the page with curl to get the text displayed it loads the source code because curl doesn't have an interpreter for JS. What can I do to get this data anyway?

Posted on
Mon Feb 16, 2015 6:55 pm
jay (support) offline
Site Admin
User avatar
Posts: 18224
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Get text from an HTML that uses JavaScript

I don't really know.

[MODERATOR NOTE] moved to the appropriate forum.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Mon Feb 23, 2015 11:59 am
davinci offline

Re: Get text from an HTML that uses JavaScript

Just for the record. You can use JSC to run a javascript file. Already preinstalled on your Mac.

Posted on
Mon Feb 23, 2015 2:35 pm
roussell offline
User avatar
Posts: 1108
Joined: Aug 18, 2008
Location: Alabama

Re: Get text from an HTML that uses JavaScript

You've got a couple of options:

1. You can dissect the source of the page to determine from where the javascript is getting it's data. It may lead back to a json, rest, xml, or soap URL that you can use directly.

2. Have a look at PhantomJS. It's basically a scriptable, headless Webkit based browser that will render the page as would a normal browser and allow you to script/parse the resultant data. http://phantomjs.org/

Terry

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 10 guests