我是這個論壇的新手,想知道是否有人能夠幫助我。Google腳本403每週2/7天出錯
我使用Google腳本來追蹤Google公司Instagram帳戶中Google追蹤者的數量。
劇本很好地跑了大約六個星期,但在過去2週期間,在每週連續兩天我得到一個錯誤的電子郵件,上面寫着:
請求失敗https://www.instagram.com/hy.am_studios/?__a=1 返回碼403 。截斷的服務器響應:< html ...(使用 muteHttpExceptions選項來檢查完整響應)。 (第14行,文件 "代碼")
腳本的代碼如下:
// the name of the sheet within your document
var sheetName = "Marketing // Instagram Follower Tracker";
// the name of the Instagram account you want the follower count for
var instagramAccountName = "hy.am_studios";
function insertFollowerCount() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName(this.sheetName);
sheet.appendRow([Utilities.formatDate(new Date(), "GMT", "dd/MM/yyyy"), getInstagramFollowerCount(this.instagramAccountName)]);
};
function getInstagramFollowerCount(username) {
var url = "https://www.instagram.com/" + username + "/?__a=1";
var response = UrlFetchApp.fetch(url).getContentText();
return JSON.parse(response).user.followed_by.count;
}
任何人都可以做的這個任何意義?真正讓我惱火的是腳本每週運行五天,但每週兩天都會產生這個錯誤。
在此先感謝您的幫助!
最良好的祝願,
大衛
謝謝,請試試看! –