Skip to content

Commit

Permalink
add georgie porgies
Browse files Browse the repository at this point in the history
  • Loading branch information
jpchip committed Dec 23, 2024
1 parent 431bba2 commit 8926157
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
6 changes: 6 additions & 0 deletions importer/sites.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@
"url" : "https://www.popscustard.com/",
"script": "./sites/pops.ts",
"flavorOfTheDay": ""
},
{
"name": "Georgie Porgies",
"url" : "https://georgieporgies.com/georgies-flavor-forecast/",
"script": "./sites/georgie.ts",
"flavorOfTheDay": ""
}
]
}
27 changes: 27 additions & 0 deletions importer/sites/georgie.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/// <reference types="https://deno.land/x/puppeteer@16.2.0/vendor/puppeteer-core/puppeteer/common/Browser.d.ts" />
import { Browser } from "https://deno.land/x/puppeteer@16.2.0/vendor/puppeteer-core/puppeteer/common/Browser.js";
import { MkeFrozenTreatsImporter } from "../importer.interface.ts";

export async function load(browser: Browser, site: MkeFrozenTreatsImporter.Site): Promise<string> {
console.log('Loading Georgie Porgies...');
const page = await browser.newPage();
page.emulateTimezone('America/Chicago');

await page.goto(site.url);

const todayH2 = await page.waitForXPath(`//h2[contains(text(), "Today")]`, { timeout: 2000 });
const todayDivEl = await page.evaluateHandle(element =>
element.closest('div.et_pb_column'), todayH2
);


const flavorOfTheDay = await todayDivEl.$$eval('img', options => {
return options.map(option => option.getAttribute('alt'));
});
if(flavorOfTheDay.length > 0) {
const flavorOfTheDayText = flavorOfTheDay[0].replace('Flavor of the Day - ', '');
return flavorOfTheDayText;
}

return '';
}

0 comments on commit 8926157

Please sign in to comment.