the scryfall API sometimes stops generic requests and wants some form of identification (not a full key just an identifier)
adding a few lines to the code worked for me:
const HEADER_OPTIONS = {
"method": "get",
"headers": {
// 1. Name of your project / version
// 2. A way to contact you (highly recommended for "good citizenship")
"User-Agent": "MyMtgProject/1.0 (Contact: yourname@example.com)",
// Scryfall specifically asks for this header
"Accept": "application/json"
},
// Good for debugging option
"muteHttpExceptions": true
};
then change:
response = JSON.parse(UrlFetchApp.fetch(`${scryfall_url}&page=${page}`).getContentText());
into:
response = JSON.parse(UrlFetchApp.fetch(`${scryfall_url}&page=${page}`,HEADER_OPTIONS).getContentText());
the scryfall API sometimes stops generic requests and wants some form of identification (not a full key just an identifier)
adding a few lines to the code worked for me:
then change:
into: