From 3b485e4da7defe08289c99c46c746f076ab8dadc Mon Sep 17 00:00:00 2001 From: Nick Leeman Date: Tue, 20 Jun 2023 15:39:04 +0200 Subject: [PATCH] cleanup --- src/modules/websites.ts | 80 ----------------------------------------- 1 file changed, 80 deletions(-) diff --git a/src/modules/websites.ts b/src/modules/websites.ts index 4548a35..cef7408 100644 --- a/src/modules/websites.ts +++ b/src/modules/websites.ts @@ -15,41 +15,6 @@ export namespace Template { } -export namespace FitnessKoerier { - export async function check(html: string) { - try { - const $ = cheerio.load(html); - if ($('.product-list .stock-msg').find("[itemprop=availability]").attr("content") == "out_of_stock") { - return false; - } else { - return true; - } - } catch (error) { - console.log(error); - console.error(`Error occured during stock check!`); - return false; - } - } -} - - -export namespace FitnessApparaat { - export async function check(html: string) { - try { - const $ = cheerio.load(html); - if ($('[itemprop="offers"]').find(".stock-red").length >= 1) { - return false; - } else { - return true; - } - } catch (error) { - console.log(error); - console.error(`Error occured during stock check!`); - return false; - } - } -} - export namespace BolCom { export async function check(html: string) { try { @@ -78,49 +43,4 @@ export namespace BolCom { } } -export namespace WifiMedia { - export async function check(html: string) { - try { - const $ = cheerio.load(html); - - if ($("[itemprop=availability]").first().attr("content") == "http://schema.org/InStock") { - return true; - } - - return false; - } catch (error) { - console.log(error); - console.error(`Error occured during stock check!`); - return false; - } - } -} - -export namespace Maxiaxi { - export async function check(html: string) { - try { - const $ = cheerio.load(html); - let stock = false; - - $('script[type="application/ld+json"]').each((index, element) => { - let json = JSON.parse($(element).html()); - - if (json["@type"]) { - if (json["@type"] == "Product") { - if (json["offers"][0]["availability"] == "http://schema.org/InStock") { - stock = true; - return; - } - } - } - }); - - return stock; - } catch (error) { - console.log(error); - console.error(`Error occured during stock check!`); - return false; - } - } -} \ No newline at end of file