From 338c6b826c16f68fd0acfacb23c16471f48efa20 Mon Sep 17 00:00:00 2001 From: stv-beep Date: Wed, 18 Sep 2024 19:29:39 +0200 Subject: [PATCH] fix leclerc quotes not showing --- README.md | 2 +- src/routes/routes.ts | 7 +++---- src/services/quotes.ts | 5 +++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index f5ec724..1709591 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@

🏎 Formula 1 quotes API 🏎

-Version +Version

diff --git a/src/routes/routes.ts b/src/routes/routes.ts index e4b1416..0703883 100644 --- a/src/routes/routes.ts +++ b/src/routes/routes.ts @@ -16,7 +16,7 @@ const idNotFound: string = 'This driver doesn\'t have that number of quotes in t const idTooSmall: string = 'This driver doesn\'t have that number of quotes in the database. Try positive numbers.' const quoteContent: string = '.quoteContent' -const markupElements = ['.b-qt', 'blockquote', 'li div p a', 'blockquote', 'blockquote.data-event > p > em', 'div.sc-fotOHu.zwJMw p'] +const markupElements = ['.b-qt', 'blockquote', 'li div p a', 'blockquote', 'blockquote.data-event > p > em', '.iso-call p a'] const alphaRegex = new RegExp(/^[a-zA-Z]*$/) @@ -247,7 +247,7 @@ const scrapQuotes = (driverURL: string, authorName: string, req: Request, }).catch(err => console.log(err)) - } else if (w === 5 && driverURL.includes(sites[5])) {//takequotes.org + } else if (w === 5 && driverURL.includes(sites[5])) {//quotesforever.com axios.get(driverURL) .then(response => { const html = response.data @@ -255,8 +255,7 @@ const scrapQuotes = (driverURL: string, authorName: string, req: Request, //getting the quote div $(markupElements[w]).each(function () { index++ - //filtering the quote - let quote = $(this).contents().filter((i, el) => el.nodeType === 3).text().trim(); + let quote = $(this).text().trim() specificQuotes.push({ id: index, diff --git a/src/services/quotes.ts b/src/services/quotes.ts index 7ef5a26..5e6fc14 100644 --- a/src/services/quotes.ts +++ b/src/services/quotes.ts @@ -31,7 +31,8 @@ export const drivers = [ }, { name: 'Charles Leclerc', - address: 'https://takequotes.com/en/author/charlesleclerc', + //address: 'https://takequotes.com/en/author/charlesleclerc', + address: 'https://www.quoteforever.com/author/charles-leclerc?page=1', driverId: 'leclerc' }, { @@ -389,7 +390,7 @@ export const drivers = [ driverId: 'ferrari' } ] -export const sites = ['brainyquote', 'quotes.net', 'azquotes', 'quotetab', 'thesportsrush', 'takequotes.com'] +export const sites = ['brainyquote', 'quotes.net', 'azquotes', 'quotetab', 'thesportsrush', 'quoteforever.com'] export const topic = [