<div id="breakingviews-widget">

  <h3 style="margin: 0 0 15px 0; padding-bottom: 8px; border-bottom: 2px solid #c00; font-family: Arial, sans-serif; color: #333;">
    Reuters Breakingviews
  </h3>
  
  <div id="bv-items" style="font-family: Arial, sans-serif; font-size: 14px; line-height: 1.5;">
    Loading latest Breakingviews...
  </div>
  
  <div style="margin-top: 15px; font-size: 12px; text-align: right;">
    <a href="https://www.reuters.com/commentary/breakingviews/" target="_blank" style="color: #c00; text-decoration: none;">
      View all on Reuters →
    </a>
  </div>
</div>

<script>
// Simple scraper for Breakingviews (works as of April 2026)
async function loadBreakingviews() {
  const container = document.getElementById('bv-items');
  
  try {
    // Using a public RSS proxy/generator (rss.app)
    const rssUrl = 'https://rss.app/feeds/v1.1/0bKzqX9vR8vJ.json'; // You can replace with your own generated feed if needed
    
    const response = await fetch(`https://api.rss2json.com/v1/api.json?rss_url=https://www.reuters.com/commentary/breakingviews/`);
    const data = await response.json();
    
    let html = '';
    
    data.items.slice(0, 8).forEach(item => {   // Show top 8 articles
      const date = new Date(item.pubDate);
      const timeAgo = Math.floor((Date.now() - date.getTime()) / (1000*60*60));
      
      html += `
        <div style="margin-bottom: 18px; border-bottom: 1px solid #eee; padding-bottom: 14px;">
          <a href="${item.link}" target="_blank" style="text-decoration: none; color: #1a73e8; font-weight: 600; line-height: 1.4;">
            ${item.title}
          </a>
          <div style="margin-top: 6px; font-size: 12px; color: #666;">
            ${timeAgo} hours ago • ${item.author || 'Breakingviews'}
          </div>
        </div>
      `;
    });
    
    container.innerHTML = html || '<p>No articles loaded at the moment.</p>';
    
  } catch (err) {
    // Fallback: Static recent articles (update occasionally)
    container.innerHTML = `
      <div style="color:#d00; font-size:13px;">
        Unable to load live feed.<br>
        <a href="https://www.reuters.com/commentary/breakingviews/" target="_blank" style="color:#c00;">Visit Reuters Breakingviews directly →</a>
      </div>
    `;
    console.log("Breakingviews widget error:", err);
  }
}

// Load when gadget is ready
window.onload = loadBreakingviews;
</script>

<style>
#breakingviews-widget {
  background: #fff;
  border: 1px solid #ddd;
  padding: 18px;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
#breakingviews-widget a:hover {
  text-decoration: underline;
}
</style>

0 $type={blogger}:

Post a Comment