Skip to content
This repository was archived by the owner on May 21, 2026. It is now read-only.

fix: Improve Open Graph fetch reliability#489

Open
rmdes wants to merge 7 commits into
milanmdev:mainfrom
rmdes:fix/opengraph-reliability
Open

fix: Improve Open Graph fetch reliability#489
rmdes wants to merge 7 commits into
milanmdev:mainfrom
rmdes:fix/opengraph-reliability

Conversation

@rmdes
Copy link
Copy Markdown

@rmdes rmdes commented Jan 11, 2026

Problem

Many Open Graph fetches fail with "Error fetching Open Graph data" because:

  1. Empty ogUserAgent config causes requests without a proper user agent
  2. No timeout means slow sites can hang indefinitely
  3. Missing accept headers that some sites require

Solution

  • Default user agent: Falls back to modern Chrome UA when ogUserAgent is empty
  • Timeout: 10 second timeout prevents hanging on slow/unresponsive sites
  • Additional headers: Adds accept and accept-language headers

Testing

Before: BBC News/Politico fetch with empty UA - fails
After: BBC News/Politico fetch with default UA + headers - succeeds

rmdes and others added 7 commits January 11, 2026 17:49
 reamaining 1 Including the just-posted item in the calculation ensures the spacing window accounts for all posts in the sequence, which is especially important for small queues where the difference between dividing by 2 versus 3 significantly affects the delay.
  Some websites return og:url values like 'https//example.com' (missing
  colon after protocol). These get treated as relative URLs and
  concatenated with the base URL, creating broken links.

  This fix:
  - Adds fixMalformedUrl() to correct 'https//' -> 'https://'
  - Improves URL validation regex to require proper protocol
  - Validates the corrected URL before using it
  - Add default Chrome user agent when ogUserAgent config is empty
  - Add 10 second timeout to prevent hanging on slow sites
  - Add accept and accept-language headers that some sites require

  This should reduce the 'Error fetching Open Graph data' failures,
  especially for the 26 bot configs that have empty ogUserAgent.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant