BBC News Scraper
Fetches the BBC News homepage and extracts story titles and URLs.
Sample Data
https://www.bbc.com/news
Result
null
Transform Function
async (url) => {
const response = await axios.get(url);
const $ = cheerio.load(response.data);
const stories = [];
$('h2').each((i, el) => {
const title = $(el).text().trim();
const link = $(el).closest('a').attr('href');
if (title && link && stories.length < 10) {
stories.push({
title,
url: link.startsWith('http') ? link : `https://www.bbc.com${link}`
});
}
});
return stories;
}