2015-08-28 17 views
0

我在this script中實現了以下幾行。從另一個腳本獲取JSON輸出

return ContentService 
    .createTextOutput(JSON.stringify(data)) 
    .setMimeType(ContentService.MimeType.JSON); 

他們返回{"title":"My book","description":"Memories"}我可以看到URL的變化。

我也寫了一個腳本來獲取這些信息。它包含以下行:

UrlFetchApp.fetch(wsURL).getContentText(); 

出於某種原因,我收到以下HTML:

<!DOCTYPE html> 
<html lang="en"> 
    <head> 
     <meta charset="utf-8"> 
     <meta content="width=300, initial-scale=1" name="viewport"> 
     <meta name="description" content="Google Drive is a free way to keep your files backed up and easy to reach from any phone, tablet, or computer. Start with 15GB of Google storage – free."> 
     <meta name="google-site-verification" content="LrdTUW9psUAMbh4Ia074-BPEVmcpBxF6Gwf0MSgQXZs"> 
     <title>Meet Google Drive – One place for all your files</title> 
     <style> @font-face { font-family: 'Open Sans'; font-style: normal; font-weight: 300; src: local('Open Sans Light'), local('OpenSans-Light'), url(//fonts.gstatic.com/s/opensans/v13/DXI1ORHCpsQm3Vp6mXoaTYnF5uFdDttMLvmWuJdhhgs.ttf) format('truetype'); 

      ......................... 

      }); })(); 
     </script> 
    </body> 
</html> 

我不知道爲什麼它返回這個HTML。如何讓我的Google腳本接收外部腳本的輸出JSON?

回答

0

由於發佈不正確,您正在到達登錄頁面。發佈以「我」的身份運行,每個人都是匿名的。確保使用版本控制。查看有關發佈腳本以獲取更多信息的官方文檔。