gpt4 book ai didi

javascript - Google 脚本 : Request failed for https://www. .. 返回代码 416。服务器被 chop

转载 作者:行者123 更新时间:2023-12-03 06:12:59 27 4
gpt4 key购买 nike

这是我的代码:

function myFunction() {
var test = DocumentApp.openById('someid');
test.clear();

var html = UrlFetchApp.fetch('https://www.crunchbase.com/organization/google').getContentText();
test.appendParagraph(html);
}

Request failed for https://www.crunchbase.com/organization/google returned code 416. Truncated server

如何解决这个问题?当我将网站设置为www.google.com时它可以工作,但当我设置为 https://www.crunchbase.com/organization/google 时失败.

最佳答案

这是因为 crunchbase.com 不允许机器人抓取其网站。为了避免脚本中出现错误,您需要将 muteHttpExceptions 参数添加到 urlfetch 请求中:

  var params = {muteHttpExceptions:true};
var response = UrlFetchApp.fetch('https://www.crunchbase.com/organization/google',params);
var html = response.getContentText();
test.appendParagraph(html);

然后您将能够看到响应:

Pardon Our Interruption


0

Pardon Our Interruption...

As you were browsing http://www.crunchbase.com something about your browser made us think you were a bot. There are a few reasons this might happen:

  • You're a power user moving through this website with super-human speed.
  • You've disabled JavaScript in your web browser.
  • A third-party browser plugin, such as Ghostery or NoScript, is preventing JavaScript from running. Additional information is available in this http://ds.tl/help-third-party-plugins' target='_blank'>support article.

To request an unblock, please fill out the form below and we will review it as soon as possible.

    <form id="zwxrztubr" method="POST" action="rytxecbxwsecazdrftrytxe.html"

style="display:none">Ignore: Ignore: Ignore: First Name Last Name E-mail City


Request Unblock You reached this page when attempting to access http://www.crunchbase.com/organization/google from 107.178.192.142 on 2016-08-31 07:38:18 GMT.
Trace: E2A843FA-6F4D-11E6-B2D7-9FC6DA1DE14E via c17ee8fd-4346-4832-a021-e5f8124f2861

关于javascript - Google 脚本 : Request failed for https://www. .. 返回代码 416。服务器被 chop ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39236597/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com