From 0500f7eda8a2d3375ad4ed3ff8b419c4dd5eee5a Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Mon, 2 Mar 2026 05:52:46 +0100 Subject: [PATCH] Added Burning Angel affiliate. Fixed Gamma banner tool breaking on invalid URL. --- seeds/06_affiliates.js | 6 ++++++ src/tools/gamma_banners.js | 26 ++++++++++++++++++-------- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/seeds/06_affiliates.js b/seeds/06_affiliates.js index 1ba81e95..66d0bffd 100755 --- a/seeds/06_affiliates.js +++ b/seeds/06_affiliates.js @@ -545,6 +545,12 @@ const affiliates = [ url: 'https://www.g2fame.com/biphoria/go.php?pr=8&su=2&si=418&ad=277470&pa=index&ar=&buffer=', comment: 'per signup', }, + // gamma > burningangel + { + channel: 'burningangel', + url: 'https://www.g2fame.com/burningangel/go.php?pr=8&su=2&si=174&ad=277470&pa=index&ar=&buffer=', + comment: 'per signup', + }, // kelly madison / 8k { network: 'kellymadison', diff --git a/src/tools/gamma_banners.js b/src/tools/gamma_banners.js index 0536f4f5..eb5aba7d 100644 --- a/src/tools/gamma_banners.js +++ b/src/tools/gamma_banners.js @@ -75,7 +75,13 @@ async function init() { await chain; const channel = slugify(banner.SiteTag, ''); - const url = `https://cdn.banhq.com${banner.MediaLocation}`; + const url = unprint.prefixUrl(banner.MediaLocation || banner.CreativeURL, 'https://cdn.banhq.com'); + + if (!url) { + console.log('No URL found'); + console.log(banner); + return; + } const tags = await matchTags([ ...banner.Tags?.map((tag) => tag.Value) || [], @@ -100,16 +106,20 @@ async function init() { await fs.promises.mkdir(`/tmp/gamma/${channel}`, { recursive: true }); - const res = await fetch(url); + try { + const res = await fetch(url); - if (res.ok && res.body) { - const writer = fs.createWriteStream(filepath); + if (res.ok && res.body) { + const writer = fs.createWriteStream(filepath); - await pipeline(Readable.fromWeb(res.body), writer); + await pipeline(Readable.fromWeb(res.body), writer); - console.log(`Saved ${url} to ${filepath}`); - } else { - console.log(`Failed to fetch ${url}`); + console.log(`Saved ${url} to ${filepath}`); + } else { + console.log(`Failed to fetch ${url} (${res.status})`); + } + } catch (error) { + console.log(`Failed to fetch ${url}: ${error.message}`); } }, Promise.resolve());