Aggiornare le quote Pinnacle in Google Sheets con un timer
Risposta: usa Apps Script UrlFetchApp su GET /v1/odds, poi installa un trigger temporale (ogni 15 minuti). Script completo: guida Google Sheets. Basta il piano Free (30 s di ritardo, 1.000 req/giorno).
Snippet del trigger#
const KEY = PropertiesService.getScriptProperties().getProperty("PINNFEED_KEY");
const SPORT = "soccer";
function refreshOdds() {
const url = "https://pinnfeed.io/v1/odds"
+ "?sport=" + encodeURIComponent(SPORT)
+ "&market=moneyline&main=true&limit=30";
const res = UrlFetchApp.fetch(url, {
headers: { "x-api-key": KEY, accept: "application/json" },
muteHttpExceptions: true,
});
if (res.getResponseCode() !== 200) throw new Error(res.getContentText());
const events = JSON.parse(res.getContentText()).events || [];
const sheet = SpreadsheetApp.getActive().getSheetByName("Odds");
const rows = [["home", "away", "home_dec", "away_dec", "fair_home", "updated"]];
for (const ev of events) {
const m = (ev.markets || []).find((x) => x.type === "moneyline");
if (!m) continue;
const by = Object.fromEntries((m.outcomes || []).map((o) => [o.name, o]));
rows.push([
ev.home, ev.away,
by.home?.decimal, by.away?.decimal, by.home?.fair,
new Date().toISOString(),
]);
}
sheet.clearContents();
sheet.getRange(1, 1, rows.length, rows[0].length).setValues(rows);
}
/** Run once from the editor to install the 15-minute trigger. */
function installTrigger() {
ScriptApp.getProjectTriggers().forEach((t) => ScriptApp.deleteTrigger(t));
ScriptApp.newTrigger("refreshOdds").timeBased().everyMinutes(15).create();
}
Conserva la chiave in Impostazioni progetto → Proprietà script, mai nelle celle. Per Excel, vedi Power Query (EN). Il push live richiede ancora Builder (99 €/mese). Piani a pagamento: prova di 3 giorni; carta richiesta, addebitata dopo il giorno 3 salvo disdetta.
Contenuto educativo per maggiorenni (18+): non pronostici né promesse di guadagno. In Italia scommetti solo con operatori autorizzati ADM.
Domande frequenti#
15 minuti consumano la quota Free?#
96 chiamate/giorno se il trigger è da solo — sotto il tetto Free di 1.000/giorno. Aggiungi sport con cautela.
IMPORTDATA può farlo?#
IMPORTDATA non può inviare x-api-key. Usa Apps Script (questa pagina) o la risposta IMPORTDATA solo con un proxy pubblico che controlli tu — noi non ne forniamo uno.