From 7f77d6c9d7ddfe804fdaffadb987f1e0de51058d Mon Sep 17 00:00:00 2001 From: Josiah Campbell <9521010+jocmp@users.noreply.github.com> Date: Fri, 1 May 2026 21:24:06 -0500 Subject: [PATCH] feat: Add motorsport.com custom parser --- .../www.motorsport.com/1770093049254.html | 8933 +++++++++++++++++ src/extractors/custom/index.js | 1 + .../custom/www.motorsport.com/index.js | 31 + .../custom/www.motorsport.com/index.test.js | 80 + 4 files changed, 9045 insertions(+) create mode 100644 fixtures/www.motorsport.com/1770093049254.html create mode 100644 src/extractors/custom/www.motorsport.com/index.js create mode 100644 src/extractors/custom/www.motorsport.com/index.test.js diff --git a/fixtures/www.motorsport.com/1770093049254.html b/fixtures/www.motorsport.com/1770093049254.html new file mode 100644 index 00000000..78a9601f --- /dev/null +++ b/fixtures/www.motorsport.com/1770093049254.html @@ -0,0 +1,8933 @@ + + "Very unfortunate" Isack Hadjar crash leaves Red Bull undecided on third F1 test day + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ Skip to main content + +
+
+ + + +
+ +
+ +
+ + + + + + + + + + + + + +
+
+ +
+ + +
+ +
+
+
+ +
+ +
+ + + + + + + + + + + + + + + + +
+ +
+
+ + +
+ + + +
+ +
+
+

Sign up for free

+
+
    +
  • + +

    Get quick access to your favorite articles

    +
  • +
  • + +

    Manage alerts on breaking news and favorite drivers

    +
  • +
  • + +

    Make your voice heard with article commenting.

    +
  • +
+
+ + +
+ + + +
+ + + + +
+
+
+
+ + + + + + +
+ + +

+ Recommended for you + +

+ + + + + + +
+
+ + + +
+ + + + + + + +
+

+ Kyle Busch says 'we got away from the Chase for a reason'

+
+ +
+ + + +
+ + NASCAR Cup +
+ + + + + + + +
+ + + +
+ +
+
+
+ +
+ + + NASCAR Cup + +
+ +
+ + Cook Out Clash at Bowman Gray +
+ + + + + + +
+ + +
Kyle Busch says 'we got away from the Chase for a reason'
+ + +
+
+ + +
+ + + + + + + +
+

+ Abbi Pulling explains why Formula E is "cut-throat" after Miami ePrix rookie run

+
+ +
+ + + +
+ + Formula E +
+ + + + + + + +
+ + + +
+ +
+
+
+ +
+ + + Formula E + +
+ +
+ + Miami ePrix +
+ + + + + + +
+ + +
Abbi Pulling explains why Formula E is "cut-throat" after Miami ePrix rookie run
+ + +
+
+ + +
+ + + + + + + +
+

+ Mercedes announces new development driver signing as full line-up confirmed

+
+ +
+ + + +
+ + Formula 1 +
+ + + + + + + +
+ + + +
+ +
+
+
+ +
+ + + Formula 1 + +
+ +
+ + Mercedes launch +
+ + + + + + +
+ + +
Mercedes announces new development driver signing as full line-up confirmed
+ + +
+
+ + +
+ + + + + + + +
+

+ NASCAR Cup drivers are helping shovel snow at Bowman Gray after storm

+
+ +
+ + + +
+ + NASCAR Cup +
+ + + + + + + +
+ + + +
+ +
+
+
+ +
+ + + NASCAR Cup + +
+ +
+ + Cook Out Clash at Bowman Gray +
+ + + + + + +
+ + +
NASCAR Cup drivers are helping shovel snow at Bowman Gray after storm
+ + +
+
+ + +
+ + + + + + + +
+

+ F1 management set for new 93,500 sq ft London headquarters

+
+ +
+ + + +
+ + Formula 1 +
+ + + + + + + +
+ + + +
+ +
+
+
+ +
+ + + Formula 1 + +
+
+ + + + + + +
+ + +
F1 management set for new 93,500 sq ft London headquarters
+ + +
+
+ + +
+ + + + + + + +
+

+ MotoGP Sepang test: Schedule, entry list and how to follow

+
+ +
+ + + +
+ + MotoGP +
+ + + + + + + +
+ + + +
+ +
+
+
+ +
+ + + MotoGP + +
+
+ + + + + + +
+ + +
MotoGP Sepang test: Schedule, entry list and how to follow
+ + +
+
+ + +
+ + + + + + + +
+

+ Kaulig Racing reveals crew chief roster for five-truck Ram program

+
+ +
+ + + +
+ + NASCAR Truck +
+ + + + + + + +
+ + + +
+ +
+
+
+ +
+ + + NASCAR Truck + +
+
+ + + + + + +
+ + +
Kaulig Racing reveals crew chief roster for five-truck Ram program
+ + +
+
+ + +
+ + + + + + + +
+

+ What’s behind Cadillac's strikingly low LMDh rear wing?

+
+ +
+ + + +
+ + IMSA +
+ + + + + + + +
+ + + +
+ +
+
+
+ +
+ + + IMSA + +
+ +
+ + Rolex 24 Hours +
+ + + + + + +
+ + +
What’s behind Cadillac's strikingly low LMDh rear wing?
+ + +
+
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+
+ +
+ + + + +
+

+ "Very unfortunate" Isack Hadjar crash leaves Red Bull undecided on third F1 test day

+

+ Hadjar crashed his Red Bull RB22 on a treacherous wet second day of Formula 1's Barcelona shakedown

+
+ +
+ + +
+
+ +
+ Filip Cleeren + +
+
+ Filip Cleeren + + +
+ Edited: + +
+
+
+ +
+
+ + + + + + + + +
+ + +
+ +
+ + + + + + + Add as a preferred source + + + + + +
+
+ + + +
+
+
+ + +
+ + + + + + Isack Hadjar, Red Bull Racing
+ + +

Isack Hadjar, Red Bull Racing

+ +

Photo by: Red Bull Content Pool

+ +
+ +
+
+
+ +
+ + + + +
+ + +

The Red Bull Formula 1 team is still evaluating its plans for a final day of Barcelona running after Isack Hadjar suffered a crash with the new RB22 on Tuesday.

+

In tricky wet conditions, Hadjar spun backwards into the wall at Barcelona's final corner, damaging the rear of Red Bull's 2026 challenger in the process and ending the Frenchman's day. Given the limited information available from the behind-closed-doors test, it is not yet clear whether Hadjar made an error or whether there was an issue with his car.

+
Read Also: + +
+

Hadjar's team-mate Max Verstappen had completed the morning session, getting only one dry run in before the expected rain arrived. But given the huge amount Red Bull has to discover about its car and its first-ever in-house power unit, it felt running in the wet was still worth it.

+

Red Bull team principal Laurent Mekies says the team is still evaluating its plans for the coming days following Hadjar's accident. With Red Bull having tested on Monday and all 11 teams restricted to three days out of a possible five, the squad is not under pressure to get out on Wednesday morning as it has already completed two days.

+

"There was some good learning on the wet,” Mekies said. “Unfortunately, it didn't end up in the right way, but what is important [is] that Isack is okay and we'll try our best to repair the car and to see what's coming next.

+

"It was a very tricky condition this afternoon, so very unfortunate that it finished that way, but it's part of the game. Again, very tricky, a lot of work to do on many aspects and these sorts of things can happen. These difficulties today came after a very, very positive day yesterday in terms of the number of laps Isack could complete in the car and in terms of his learning and development and feedback to the engineers.

+

"It's something we are trying to analyse now and hopefully we get some answer a bit later on. The priority right now is to assess the damage on the car and to see what it gives us in terms of opportunities to run in the next day. We only have one day left, so we have to make sure we place that card carefully and it's an analysis that will take still a few hours."

+
Laurent Mekies, Red Bull Racing Team Team Principal +

Laurent Mekies, Red Bull Racing Team Team Principal

+

Photo by: Red Bull Content Pool

+
+

Mekies hailed the Milton Keynes squad for its otherwise productive start to the 2026 pre-season, facing the huge task of bedding in its Red Bull Powertrains power units, which it developed together with Ford.

+

"We knew it would be a very special moment to be here for the first time with RB22, with our own power unit," the Frenchman explained. "The last few months and weeks have been incredibly hectic to be ready, but ultimately we were ready on Monday morning to run and I can only take that opportunity to say a big thank you and well done to everybody back in Milton Keynes chassis and power unit side, because it was incredible to see the car going out at a few minutes past nine on Monday morning with our own power unit.

+

"Of course, it's very early days and of course, nothing is perfect, but we could run, we could start to learn, work as one team. So that was a huge satisfaction. It doesn't change the size of the journey in front of us, but certainly it's a first moment that everybody in MK should be proud of."

+

Photos from Barcelona shakedown

+
+
+ +
+ + + + + + Franco Colapinto, Alpine + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Ferrari motorhome + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Liam Lawson, Racing Bulls + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Laurent Mekies, Red Bull Racing Team Team Principal, Ben Waterhouse, Red Bull Racing Head of Performance Engineering + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Charles Leclerc, Ferrari + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Isack Hadjar, Red Bull Racing
+ + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Andrea Kimi Antonelli, Mercedes W17  + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Sergio Perez, Valtteri Bottas, Cadillac + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Franco Colapinto, Alpine + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Isack Hadjar, Red Bull Racing  + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Esteban Ocon, Haas F1 Team + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Max Verstappen, Red Bull Racing + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Lewis Hamilton, Ferrari + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Oliver Bearman, Haas F1 Team + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Gabriel Bortoleto, Audi + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Lando Norris, Mclaren + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Arvid Lindblad, Racing Bulls + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Isack Hadjar, Red Bull Racing
+ + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Franco Colapinto, Alpine + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Lando Norris, McLaren + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + George Russell, Mercedes + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Helmet of Gabriel Bortoleto, Audi + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Laura Mueller, Race Engineer Haas F1 Team + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Charles Leclerc, Ferrari + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Max Verstappen, Red Bull Racing  + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Andrea Kimi Antonelli, Mercedes W17 + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Liam Lawson, Racing Bulls  + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Lando Norris, McLaren MCL40 + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Charles Leclerc, Ferrari + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Liam Lawson, Racing Bulls  + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Nico Hulkenberg, Audi F1 Team + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Laurent Mekies, Red Bull Racing Team Team Principal + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Oliver Bearman, Haas + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Liam Lawson, Racing Bulls  + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Franco Colapinto, Alpine + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Isack Hadjar, Red Bull Racing  + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Lewis Hamilton, Ferrari + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Andrea Kimi Antonelli, Mercedes W17 + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Max Verstappen, Red Bull Racing + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Audi R26 in the pitlane + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Esteban Ocon, Haas + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Liam Lawson, Racing Bulls  + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Charles Leclerc, Ferrari + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Isack Hadjar, Red Bull Racing
+ + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Sergio Perez, Cadillac F1 Team + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Max Verstappen, Red Bull Racing + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Oliver Bearman, Haas F1 Team + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + George Russell, Mercedes + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Max Verstappen, Red Bull Racing + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Lewis Hamilton, Ferrari + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Mattia Binotto, Audi + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Charles Leclerc, Ferrari + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Oscar Piastri, McLaren + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Franco Colapinto, Alpine + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Gabriel Bortoleto, Audi F1 Team + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Charles Leclerc, Ferrari + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Lewis Hamilton, Ferrari + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Oliver Bearman, Haas + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Pierre Gasly, Alpine + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Max Verstappen, Red Bull Racing + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Lewis Hamilton, Ferrari + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Lance Stroll, Aston Martin + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Lando Norris, McLaren + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Isack Hadjar, Red Bull Racing  + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Oliver Bearman, Haas F1 Team + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Lewis Hamilton, Ferrari + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Arvid Lindblad, Racing Bulls + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Lando Norris, McLaren + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Arvid Lindblad, Racing Bulls + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + George Russell, Mercedes W17 + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Esteban Ocon, Haas F1 Team + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Andrea Kimi Antonelli, Mercedes + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Oscar Piastri, McLaren + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Lewis Hamilton, Ferrari + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Lando Norris, McLaren MCL40 + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Pierre Gasly, Alpine + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Arvid Lindblad, Racing Bulls + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Lewis Hamilton, Ferrari + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ + + + + + Esteban Ocon, Haas F1 Team + +
+ +
+ +
+ +
+
+ +

Barcelona shakedown, in photos

+ +
+ +
+ +
+ + + +
+ + Formula 1 +
+ +
+ + + 79 +
+
+
Read Also: + +
+ + + + + + + + + +
+
+ +
+ + + + +
+ + + +
+
+

Share Or Save This Story

+ +
+
+ + + + + + + + + +
+
+ +
+ + +
+
+ +
+ + + +
+ Previous article + Here's what happened on day two of F1’s secretive closed-door 2026 shakedown +
+
+ + +
+ Next article + LIVE: F1 Barcelona pre-season testing - Day 3 +
+ + +
+
+
+
+
+ +
+

Top Comments

+ +
+ +
+ + + + +
+
+
+
+ +
+ +
+ +
+ + + + + + + +
+ + +
+
+ +

+
+ + Latest news + +
+ + +
+ +

+
+ +
+ +
+ + + + + + +
+ + + + + + + +
+

+ Kyle Busch says 'we got away from the Chase for a reason'

+
+ +
+ + + +
+ + NASCAR Cup +
+ + + + + + + +
+ + + +
+ +
+
+
+ +
+ + NAS + + NASCAR Cup + +
+ +
+ + Cook Out Clash at Bowman Gray +
+ + + + + + +
+ + +
Kyle Busch says 'we got away from the Chase for a reason'
+ + +
+
+ + + + +
+ + + + + + + +
+

+ Abbi Pulling explains why Formula E is "cut-throat" after Miami ePrix rookie run

+
+ +
+ + + +
+ + Formula E +
+ + + + + + + +
+ + + +
+ +
+
+
+ +
+ + FE + + Formula E + +
+ +
+ + Miami ePrix +
+ + + + + + +
+ + +
Abbi Pulling explains why Formula E is "cut-throat" after Miami ePrix rookie run
+ + +
+
+ + + + +
+ + + + + + + +
+

+ Mercedes announces new development driver signing as full line-up confirmed

+
+ +
+ + + +
+ + Formula 1 +
+ + + + + + + +
+ + + +
+ +
+
+
+ +
+ + F1 + + Formula 1 + +
+ +
+ + Mercedes launch +
+ + + + + + +
+ + +
Mercedes announces new development driver signing as full line-up confirmed
+ + +
+
+ + + + +
+ + + + + + + +
+

+ NASCAR Cup drivers are helping shovel snow at Bowman Gray after storm

+
+ +
+ + + +
+ + NASCAR Cup +
+ + + + + + + +
+ + + +
+ +
+
+
+ +
+ + NAS + + NASCAR Cup + +
+ +
+ + Cook Out Clash at Bowman Gray +
+ + + + + + +
+ + +
NASCAR Cup drivers are helping shovel snow at Bowman Gray after storm
+ + +
+
+ + +
+ +
+ + +
+ + + + + + +
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + \ No newline at end of file diff --git a/src/extractors/custom/index.js b/src/extractors/custom/index.js index 1450eb20..0979c252 100644 --- a/src/extractors/custom/index.js +++ b/src/extractors/custom/index.js @@ -196,3 +196,4 @@ export * from './www.blick.de'; export * from './www.euronews.com'; export * from './gr.euronews.com'; export * from './www.ilfattoquotidiano.it'; +export * from './www.motorsport.com'; diff --git a/src/extractors/custom/www.motorsport.com/index.js b/src/extractors/custom/www.motorsport.com/index.js new file mode 100644 index 00000000..4cf7891f --- /dev/null +++ b/src/extractors/custom/www.motorsport.com/index.js @@ -0,0 +1,31 @@ +export const WwwMotorsportComExtractor = { + domain: 'www.motorsport.com', + + title: { + selectors: [['meta[name="og:title"]', 'value']], + }, + + author: { + selectors: ['.msnt-author-toolbar a[href*="/info/about-us/"]'], + }, + + date_published: { + selectors: [['meta[name="datePublished"]', 'value']], + }, + + dek: { + selectors: ['h2.text-article-description'], + }, + + lead_image_url: { + selectors: [['meta[name="og:image"]', 'value']], + }, + + content: { + selectors: ['.ms-article-content'], + transforms: { + h2: node => node.attr('class', 'mercury-parser-keep'), + }, + clean: ['.relatedContent', '.ms-apb', '.ms-ap-native', '.outstream_partner'], + }, +}; diff --git a/src/extractors/custom/www.motorsport.com/index.test.js b/src/extractors/custom/www.motorsport.com/index.test.js new file mode 100644 index 00000000..b777b933 --- /dev/null +++ b/src/extractors/custom/www.motorsport.com/index.test.js @@ -0,0 +1,80 @@ +import assert from 'assert'; +import * as cheerio from 'cheerio'; + +import Parser from 'mercury'; +import getExtractor from 'extractors/get-extractor'; +import { excerptContent } from 'utils/text'; + +const fs = require('fs'); + +describe('WwwMotorsportComExtractor', () => { + describe('initial test case', () => { + let result; + let url; + beforeAll(() => { + url = + 'https://www.motorsport.com/f1/news/very-unfortunate-isack-hadjar-crash-leaves-red-bull-undecided-on-third-f1-test-day/10793339/?utm_source=RSS&utm_medium=referral&utm_campaign=RSS-F1&utm_term=News&utm_content=www'; + const html = fs.readFileSync( + './fixtures/www.motorsport.com/1770093049254.html' + ); + result = Parser.parse(url, { html, fallback: false }); + }); + + it('is selected properly', () => { + const extractor = getExtractor(url); + assert.strictEqual(extractor.domain, new URL(url).hostname); + }); + + it('returns the title', async () => { + const { title } = await result; + + assert.strictEqual( + title, + `"Very unfortunate" Isack Hadjar crash leaves Red Bull undecided on third F1 test day` + ); + }); + + it('returns the author', async () => { + const { author } = await result; + + assert.strictEqual(author, 'Filip Cleeren'); + }); + + it('returns the date_published', async () => { + const { date_published } = await result; + + assert.strictEqual(date_published, `2026-01-27T20:16:22.000Z`); + }); + + it('returns the dek', async () => { + const { dek } = await result; + + assert.strictEqual( + dek, + `Hadjar crashed his Red Bull RB22 on a treacherous wet second day of Formula 1's Barcelona shakedown` + ); + }); + + it('returns the lead_image_url', async () => { + const { lead_image_url } = await result; + + assert.strictEqual( + lead_image_url, + `https://cdn-2.motorsport.com/images/amp/01QdMbx0/s6/isack-hadjar-red-bull-racing.jpg` + ); + }); + + it('returns the content', async () => { + const { content } = await result; + + const $ = cheerio.load(content || ''); + + const first13 = excerptContent($('*').first().text(), 13); + + assert.strictEqual( + first13, + 'The Red Bull Formula 1 team is still evaluating its plans for a' + ); + }); + }); +});