所以我正在写一个脚本,查看 review done on google+ pages
并更新谷歌电子表格。
我发现 html 中包含此值的行是
<span class="A7a">103</span>
我只需要让我能够在只知道 URL 和 html 代码的情况下从页面中提取。
最佳答案
用
var response = UrlFetchApp.fetch("http://www.website.com/");
获取页面的html。然后使用类似的东西
var cut = response.substring( str.indexOf( "<span class="A7a">" ), response.length);
var value = cut.substring(0, cut.indexOf("</span>"));
https://developers.google.com/apps-script/reference/url-fetch/url-fetch-app#fetch(String)
关于html - 从网站中提取数据的 Google App 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22282344/