Posts

Image
const fs = require('fs'); const axios = require('axios'); const cheerio = require('cheerio'); const Parser = require('rss-parser'); const parser = new Parser(); const rssUrl = 'https://feeds.bbci.co.uk/news/world/rss.xml'; const outputFile = 'index.html'; // Function to clean text (remove extra whitespace) const cleanText = (text) => text.replace(/\s+/g, ' ').trim(); // Function to scrape full article content from a URL async function scrapeArticle(url) { try { const { data } = await axios.get(url, { headers: { 'User-Agent': 'Mozilla/5.0' } // Mimic browser to avoid blocking }); const $ = cheerio.load(data); // BBC article content selectors (adjust based on BBC's HTML structure) const articleContent = $('article').find('p').map((i, el) => $(el).text()).get().join(' '); const mainImage = $('img[src*="news"]').first().attr('sr...
BBC World News Blog BBC World News Loading news...