I'm trying to fetch the top 20 trends from the following page: https://trends.google.com/trends/trendingsearches/daily?geo=US using UrlFetchApp
and Cheerio
but I keep getting the following content for my divs
:
You are using unsupported browser. Some features may not work correctly. Upgrade to a modern browser, such as Google Chrome.Trends has upgraded to a newer version, which is not supported by this device.dismiss, You are using unsupported browser. Some features may not work correctly. Upgrade to a modern browser, such as Google Chrome.Trends has upgraded to a newer version, which is not supported by this device.dismiss, , Google apps, Google apps
I've tried setting the header
option to a bunch of different combinations but all rendered uselessly. I've also tried using Postman and it came out with the same result.
This is my base code:
function getSearchTrends(url) {
var response = UrlFetchApp.fetch(url);
var status_code = response.getResponseCode();
if (status_code == 200) {
var content = response.getContentText();
const $ = Cheerio.load(content)
const divs = [];
$('div').each(function(i, elem) {
divs[i] = $(this).text();
});
Logger.log(divs);
}
}
Is there some sort of workaround to get a useful HTML response? Thanks.