In the Script environment for Apps, the code is giving us the parsing error as the HTML page including an ERROR is returned to the remote server at times, rather than the expected JSON. Have shared my code below:-
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <TITLE>ERROR: The request could not be satisfied</TITLE>
</HEAD><BODY>
<H1>403 ERROR</H1>
<H2>The request could not be satisfied.</H2>
<HR noshade size="1px">
Request blocked.
We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
<BR clear="all">
If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
<BR clear="all">
<HR noshade size="1px">
<PRE>
Generated by cloudfront (CloudFront)
Request ID: UyFmlcv2qjKSBvlulcdv06KufF5KCoHm0CpZJu28tE5-aw9KvRquHw==
</PRE>
<ADDRESS>
</ADDRESS>
</BODY></HTML>
The request to CloudFront goes via Google servers. From my own experience, this happens often. It's probably because of the reason that so many Google users are trying to request the data that CloudFront blocks some of Google servers from flooding them with requests. If you're using Google Spreadsheets and you don't mind getting an estimate price instead of the exact price trading on Binance at the moment of the request, you can use the =GOOGLEFINANCE("CURRENCY:BTCUSD") formula to get the price of BTC provided by Google excluding BINANCE. You can request your own script (that is deployed outside of Google servers) in the Apps Script.
resBTCPrice = JSON.parse(UrlFetchApp.fetch('https://example.com/get-btc-price',options).getContentText());
This get-btc-price script then simply requests the original Binance API and prints the output. This way, you can bypass the rate limits (and error message) imposed by CloudFront to Google servers.