Skip to content

Commit

Permalink
fix leclerc quotes not showing
Browse files Browse the repository at this point in the history
  • Loading branch information
stv-beep committed Sep 18, 2024
1 parent 70e1c6c commit 338c6b8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<h1>🏎 Formula 1 quotes API 🏎</h1>

<p>
<img alt="Version" src="https://img.shields.io/badge/version-0.8.1-greenyellow.svg"/>
<img alt="Version" src="https://img.shields.io/badge/version-0.8.2-greenyellow.svg"/>
<img src="https://img.shields.io/badge/npm-%3E%3D8.5.0-blue.svg"/>
<img src="https://img.shields.io/badge/node-%3E%3D16.14.2-blue.svg"/>
</p>
Expand Down
7 changes: 3 additions & 4 deletions src/routes/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]*$/)
Expand Down Expand Up @@ -247,16 +247,15 @@ 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
const $ = load(html)
//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,
Expand Down
5 changes: 3 additions & 2 deletions src/services/quotes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
},
{
Expand Down Expand Up @@ -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 = [
Expand Down

0 comments on commit 338c6b8

Please sign in to comment.