News Search Skill
Search for recent news on any topic.
Using Google News RSS
curl -s "https://news.google.com/rss/search?q={query}&hl=en-US&gl=US&ceid=US:en" | python3 -c "
import sys, re
rss = sys.stdin.read()
titles = re.findall(r'<title>(.*?)</title>', rss)[1:] # skip channel title
links = re.findall(r'<link>(.*?)</link>', rss)[1:]
dates = re.findall(r'<pubDate>(.*?)</pubDate>', rss)
for i, (title, link, date) in enumerate(zip(titles[:10], links[:10], dates[:10])):
print(f'{i+1}. {title}')
print(f' {date}')
print(f' {link}')
print()
"
Using Hacker News
curl -s "https://hacker-news.firebaseio.com/v0/topstories.json" | python3 -c "
import json, sys, urllib.request
ids = json.load(sys.stdin)[:10]
for id in ids:
item = json.loads(urllib.request.urlopen(f'https://hacker-news.firebaseio.com/v0/item/{id}.json').read())
print(f'- {item.get("title","")} ({item.get("score",0)} pts)')
if item.get('url'): print(f' {item["url"]}')
"
Notes
- Google News RSS is free, no API key needed
- URL-encode search queries
- Present results as a concise list