想请问一下
我要在google apps script做一个函数
让使用者可以在google sheet输入关键字和一个网站的网址
计算出在用google搜寻该关键字时
该网站会排在第几名
我的google apps script程式码:
function getGoogleRank(keyword, url) {
var searchUrl = 'https://www.google.com/search?q=' + encodeURIComponent(keywor
d) + '&num=100';
var response = UrlFetchApp.fetch(searchUrl);
var content = response.getContentText();
var regex = new RegExp(url, 'i');
var rank = content.search(regex);
if (rank == -1) {
return '未排名';
} else {
return rank + 1;
}
}
出现以下的错误讯息:
Exception: Request failed for https://www.google.com returned code 429. Truncate
d server response: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN
">
<html>
<head><meta http-equiv="content-type" content="text/html; charset=utf-8"><me...
(use muteHttpExceptions option to examine full response)
好像是太过频繁跟google请求
该如何解决这个问题呢
谢谢