Added Burning Angel affiliate. Fixed Gamma banner tool breaking on invalid URL.
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -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());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user