Google App脚本从网站中提取数据 [英] Google App script extracting data from website

查看:131
本文介绍了Google App脚本从网站中提取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我正在编写一个脚本,查看在Google +页面上完成的审核
,然后更新一个google电子表格。

So I am writing a script which look at review done on google+ pages and updates a google spreadsheet.

我发现html中包含这个值的行是

I have found out that the line in the html which holds this value is

<span class="A7a">103</span> 

我只需要让我可以在知道URL的情况下从页面中提取出来, html代码。

I just need to make it possible for me to extract from the page with just knowing the URL and that html code.

推荐答案

使用

Use

var response = UrlFetchApp.fetch("http://www.website.com/");

获取页面的html。然后使用类似于

To fetch the html of the page. Then use something like

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 )

这篇关于Google App脚本从网站中提取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆