【发布时间】:2021-08-02 09:47:17
【问题描述】:
任何人都可以帮助我转换此站点的响应的代码吗 https://services.sia.homeoffice.gov.uk/PublicRegister/
我需要它从谷歌表格中读取许可证号 - 例如: 1012894854698842
并将结果填充到同一个电子表格中
我一直在玩邮递员和网站抓取工具,但仍然无法弄清楚
请帮忙!! 谢谢你
function senddatatoform() {
var url = 'https://services.sia.homeoffice.gov.uk/PublicRegister/SearchPublicRegisterByLicence'; // this is the 'request url' as shown in your browser (not always the url of the form).
var payload = {
LicenseNo: "1012894854698842",
}//continue with all required post data
var options = {
method: "POST",
payload: payload
}
var response = UrlFetchApp.fetch(url,options);
/*this is where what you need to do next might vary -- if you're looking for a 'success' page, you might write some code here to verify that the http response is correct based on your needs.
*/
const content = response.getContentText();
const regEx = /<div class="ax_h5">\s*(\S+)/g;
while (match = regEx.exec(content)) {
console.log(match[1]);
}
};
Logger.log
我需要的信息是
名字
姓
牌照号码
角色
许可部门
有效期
状态
状态说明
附加许可条件
许可证编号在每个员工的电子表格中
【问题讨论】:
-
请分享您到目前为止所尝试的内容。见how do I ask a good question
标签: api google-sheets