Reputation: 91
I'm trying to get data from this webpage:
by UrlFetchApp.fetch(url).getContentText() but I don't get all the data from the page:
UrlFetchApp.fetch(url).getContentText() give me:
<ul id=""size-options-ul"" class=""size-options""> <!-- AJAX DATA -->
but within this directory have an extra code (I click in Google Chrome, right-click on the page, then Inspect Element. Chrome gives me all the code of this page)
<ul id="size-options-ul" class="size-options"><li id="1689949376460861_0" title="0-3 mos"><a href="javascript:DoSmth()" title="0-3 mos"><span>0-3 mos</span></a></li><li id="1689949376460862_1" title="3-6 mos" class=""><a href="javascript:DoSmth()" title="3-6 mos"><span>3-6 mos</span></a></li><li id="1689949376460864_2" title="6-12 mos" class="selected"><a href="javascript:DoSmth()" title="6-12 mos"><span>6-12 mos</span></a></li><li id="1689949376460865_3" title="12-18 mos" class=""><a href="javascript:DoSmth()" title="12-18 mos"><span>12-18 mos</span></a></li><li id="1689949376460866_4" title="18-24 mos"><a href="javascript:DoSmth()" title="18-24 mos"><span>18-24 mos</span></a></li></ul>
How can i get full code? maybe some arguments of UrlFetch can do it? I think this page dynamically generated via Javascript... but somehow Chrome takes all the data from the page and the script maybe possible.
Thanks! Ivan.
Upvotes: 1
Views: 829
Reputation: 423
Apps Script's UrlFetchApp
does not interprets anything, as it does make a HTTP request and return just a response from server.
But Chrome interprets the JavaScript after the page loads and inserts the results in the DOM (so you can view the current state in Inspect Element).
You need to use tools that can "interpret" the JavaScript See these links
Upvotes: 0