Remove old code && unnecessary @ts-ignore

This commit is contained in:
Amelia 2022-06-04 17:34:58 +01:00
parent 008e7c1cf4
commit 6dada66079
1 changed files with 1 additions and 26 deletions

View File

@ -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 };