Skip to content

Commit 47d402b

Browse files
committed
Fixed spaces
1 parent 96cef5a commit 47d402b

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

src/scraper/driver-standings.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ export const getDriverStandings = async (year: number = new Date().getFullYear()
1616
const position: number = parseInt($(this).find("td:nth-child(1) > p:nth-child(1)").text().trim());
1717
const driver_1: string = $(this).find("td:nth-child(2) > p:nth-child(1) > a:nth-child(1) > span:nth-child(1)").text().trim();
1818
const driver_2: string = $(this).find("td:nth-child(2) > p:nth-child(1) > a:nth-child(1) > span:nth-child(2)").text().trim();
19-
const driver: string = driver_1.concat(" ", driver_2.slice(0, driver_2.length - 3)).trim();
19+
const driver: string = driver_1
20+
.concat(" ", driver_2.slice(0, driver_2.length - 3))
21+
.trim()
22+
.replace(/\u00a0/g, " ");
2023
const nationality: string = $(this).find(" td:nth-child(3) > p:nth-child(1)").text();
2124
const team: string = $(this).find("td:nth-child(4) > p:nth-child(1) > a:nth-child(1)").text();
2225
const points: number = parseInt($(this).find(" td:nth-child(5) > p:nth-child(1) ").text());

src/scraper/fastest-laps.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ export const getFastestLaps = async (year: number = new Date().getFullYear()): P
1515
$(".f1-table > tbody:nth-child(2) > tr").each(function () {
1616
const grandPrixAll: string = $(this).find("td:nth-child(1) > p:nth-child(1) > a").contents().get()[1];
1717
const grandPrix: string = $(grandPrixAll).text();
18-
const driverName: string = $(this).find("td:nth-child(2) > p:nth-child(1) > span:nth-child(1)").text().trim();
18+
const driverName: string = $(this)
19+
.find("td:nth-child(2) > p:nth-child(1) > span:nth-child(1)")
20+
.text()
21+
.trim()
22+
.replace(/\u00a0/g, " ");
1923
const car: string = $(this).find("td:nth-child(3) > p:nth-child(1)").text().trim();
2024
const time: string = $(this).find("td:nth-child(4) > p:nth-child(1)").text().trim();
2125

src/scraper/race-results.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const getRaceResults = async (year: number = new Date().getFullYear()): P
1616
const grandPrixAll: string = $(this).find("td:nth-child(1) > p:nth-child(1) > a:nth-child(1)").contents().get()[1];
1717
const raceDate: string = $(this).find("td:nth-child(2) > p:nth-child(1)").text().trim();
1818
const driverName: string = $(this).find("td:nth-child(3) > p:nth-child(1) > span:nth-child(1)").text().trim();
19-
const winner: string = driverName.slice(0, driverName.length - 3);
19+
const winner: string = driverName.slice(0, driverName.length - 3).replace(/\u00a0/g, " ");
2020
const car: string = $(this).find("td:nth-child(4) > p:nth-child(1)").text().trim();
2121
const laps: number = parseInt($(this).find("td:nth-child(5) > p:nth-child(1)").text().trim());
2222
const time: string = $(this).find("td:nth-child(6) > p:nth-child(1)").text().trim();

0 commit comments

Comments
 (0)