From 6dada6607961b259244664fbc069e6ecf2689b38 Mon Sep 17 00:00:00 2001 From: Amelia <9247739-limesey@users.noreply.gitlab.com> Date: Sat, 4 Jun 2022 17:34:58 +0100 Subject: [PATCH] Remove old code && unnecessary @ts-ignore --- src/scraper.ts | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/src/scraper.ts b/src/scraper.ts index e32fa5c..bdb7fef 100644 --- a/src/scraper.ts +++ b/src/scraper.ts @@ -78,7 +78,6 @@ function getDefinitions(term: string) { // TODO: Finish ratings // const upvotes = $(this).find(".thumbs[data-direction=up]").find("span"); - // @ts-ignore const definition = { meaning: meaning, example: example, @@ -92,8 +91,6 @@ function getDefinitions(term: string) { }, }; - //console.log(definition); - defintions.push(definition); }); } @@ -102,26 +99,4 @@ function getDefinitions(term: string) { }); } -getDefinitions("yogurt"); - -export default function scrapeData(url: string) { - return new Promise(async function (resolve, reject) { - const [success, data] = await handlePromise(axios.get(url)); - - if (success) { - const html = data.data; - - const $ = cheerio.load(html); - - // For now, only scraping the first/top meaning; - - const meaning = $(".meaning.mb-4").first().text().trim(); - - resolve(meaning); - } else { - console.error(data); - - reject(data); - } - }); -} +export { getDefinitions };