I’d just like to begin with this is my first time using the Cheerio Library so I could be making a simple mistake. I am attempting to scrape a Google Maps page for the phone number listed. When I use a JQuery via dev console on the site I am able to return the text, but when I use the same div class within Google Apps Scripts my results are always empty.
The code I am using is very simple. This code returns the following error :”We’re sorry, a server error occurred. Please wait a bit and try again.”. However, if I were to do this within the dev console I would not receive an error using jquery.
The website I am attempting to scrape is here.
function getContent_(url) {
return UrlFetchApp.fetch(url).getContentText()
}
function testScrape(){
const content = getContent_('https://www.google.com/maps/place/AutoZone+Auto+Parts/@33.6938582,-78.88908,15z/data=!4m6!3m5!1s0x890069a9c33250a3:0x8ce735a50e16e70b!8m2!3d33.6938582!4d-78.88908!16s%2Fg%2F1tdl2f1b?entry=ttu');
const $ = Cheerio.load(content);
Logger.log($('div.rogA2c'));
}