0
我有一个流星web应用程序。 (例如http://www.merafi.com
)。我想使用Google Apps脚本来抓取网站。我为此写了一个小脚本。我如何刮流星webapp?
function myFunction() {
const url = 'http://www.merafi.com';
const response = UrlFetchApp.fetch(url, {muteHttpExceptions: true});
return response.getContentText();
}
该脚本在Google Spreadsheet中用作宏。
=myFunction()
刮流星webapp的问题是,我得到一个空的身体,其中只有脚本标记。如何获取body标签内的内容?
您需要一些运行JS的抓取工具,例如phantomJS,nightmarejs或Selenium – Rentrop
不幸的是,我在Google Apps脚本中没有该工具。 https://developers.google.com/apps-script/reference/url-fetch/ – vijayst
好吧,那么要么你不得不使用Google Apps脚本以外的东西,否则你有很多工作需要重新编写。 – CodeChimp