Skip to content

Add MediaStack and NewsData.io connectors for custom news sources#133

Open
Coooder-Crypto wants to merge 1 commit intoPolymarket:mainfrom
Coooder-Crypto:main
Open

Add MediaStack and NewsData.io connectors for custom news sources#133
Coooder-Crypto wants to merge 1 commit intoPolymarket:mainfrom
Coooder-Crypto:main

Conversation

@Coooder-Crypto
Copy link

@Coooder-Crypto Coooder-Crypto commented Jan 5, 2026

Summary

  • Add MediaStack connector to fetch and normalize news articles
  • Add NewsData.io connector with consistent Article mapping
  • Expose both connectors via CLI commands
  • Add env vars to .env.example for new API keys

Issue


Note

Introduces additional news sources with consistent Article normalization and CLI access.

  • Adds MediaStackNews and NewsDataNews connectors to fetch articles, support optional date filters, and map provider responses to Article fields
  • Exposes new CLI commands: get_mediastack_news and get_newsdata_news to query these sources
  • Updates .env.example with MEDIASTACK_API_KEY and NEWSDATA_API_KEY

Written by Cursor Bugbot for commit 5914617. This will update automatically on new commits. Configure here.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome to Polymarket Agents. Thank you for creating your first PR. Cheers!

class MediaStackNews:
def __init__(self) -> None:
self.api_key = os.getenv("MEDIASTACK_API_KEY")
self.base_url = "http://api.mediastack.com/v1/news"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API key transmitted over unencrypted HTTP connection

The MediaStack connector uses http:// instead of https:// for the API endpoint. This causes the access_key API credential to be transmitted in plaintext over the network, where it can be intercepted by attackers. MediaStack supports HTTPS on all plans (including free), and the other connectors in the codebase (news.py and newsdata.py) all use HTTPS. The base_url needs to use https://api.mediastack.com/v1/news.

Fix in Cursor Fix in Web

if date_start and date_end:
params["date"] = f"{date_start:%Y-%m-%d},{date_end:%Y-%m-%d}"
elif date_start:
params["date"] = f"{date_start:%Y-%m-%d}"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Date end parameter silently ignored without date start

The date_end parameter is silently ignored when date_start is not provided. The conditional logic only checks for date_start and date_end or date_start alone, with no branch handling date_end by itself. This contrasts with the NewsData.io connector, which correctly handles both date parameters independently. Callers expecting date filtering with only an end date will receive unfiltered results without any warning.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a new data source

1 participant