DEV Community

Tugelbay Konabayev
Tugelbay Konabayev

Posted on • Originally published at about-kazakhstan.com

Web Scraping Real Price Data for Content Accuracy

The Problem with Stale Prices

Travel content with outdated prices loses credibility and rankings. Manually checking prices across dozens of articles is impractical. I built a pipeline that verifies and updates price data automatically.

Data Sources

  • Numbeo API: cost of living indices by city
  • Booking.com: hotel prices (via Exa AI search)
  • Airline sites: flight costs (via search aggregation)
  • Local sources: grocery and transport prices

Using Exa AI for Price Verification

Exa AI provides instant search results perfect for price checking:

async function verifyPrice(query) {
  const res = await fetch("https://api.exa.ai/search", {
    method: "POST",
    headers: {
      "x-api-key": process.env.EXA_API_KEY,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      query,
      type: "instant",
      numResults: 3,
      highlights: true
    })
  });

  const data = await res.json();
  return data.results.map(r => ({
    title: r.title,
    url: r.url,
    highlights: r.highlights
  }));
}
Enter fullscreen mode Exit fullscreen mode

Content Freshness Scanner

The freshness checker scans all articles for outdated patterns:

function checkFreshness(content) {
  const issues = [];
  const currentYear = new Date().getFullYear();

  // Find year references
  const years = content.match(/20\d{2}/g) || [];
  const outdated = years.filter(y => parseInt(y) < currentYear - 1);

  if (outdated.length > 0) {
    issues.push("Contains outdated year references");
  }

  // Find price patterns that might be stale
  const prices = content.match(/\$\d+/g) || [];
  if (prices.length > 0) {
    issues.push("Contains price data - verify against current sources");
  }

  return issues;
}
Enter fullscreen mode Exit fullscreen mode

Results

Automated price verification caught 12 outdated prices across 83 articles in the first run. Updated prices with source links improved E-E-A-T signals and content freshness for search engines.

Fresh, accurate data is a competitive advantage in travel content.

Top comments (0)