← back to Gmc Titlefix
spotcheck500.js
20 lines
const {token,MERCHANT}=require('./_auth');
const list=require('./gmc_titlefix_list.json');
// sample 8 offers from within the 500 batch (rows 1..499), spread out
const idxs=[1,50,120,200,275,350,425,499];
(async()=>{
const tok=await token();
let flipped=0, notyet=0;
for(const i of idxs){
const row=list[i];
const url=`https://shoppingcontent.googleapis.com/content/v2.1/${MERCHANT}/products/online:en:US:${row.offerId}`;
const r=await fetch(url,{headers:{Authorization:'Bearer '+tok}});
if(!r.ok){ console.log(`row ${i}: HTTP ${r.status} ${(await r.text()).slice(0,80)}`); continue; }
const j=await r.json();
const isSample=/^Sample:/.test(j.title||'');
if(isSample) flipped++; else notyet++;
console.log(`row ${i}: ${isSample?'✅ FLIPPED':'⏳ not yet'} | ${(j.title||'').slice(0,70)}`);
}
console.log(`\nSAMPLE RESULT: ${flipped}/${idxs.length} flipped, ${notyet} not yet`);
})();