본문으로 건너뛰기
Skillpedia
API 및 서버 (백엔드)7.8k · #13061

news-api-integration

하는 일

이 스킬은 AI 에이전트가 헤드라인과 검색 결과를 얻기 위해 뉴스 API를 호출하는 방법을 설명합니다. 최신 기사를 보여 주는 뉴스 피드나 도구를 만드는 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓앱이나 대시보드에 헤드라인 피드를 보여 주고 싶을 때.
  • ✓주제나 키워드로 뉴스를 검색해야 할 때.
  • ✓기술이나 경제처럼 분류별로 뉴스를 걸러 보고 싶을 때.

스킬 링크

https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/news-api-integration/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/news-api-integration/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“제 대시보드에 뉴스 API를 사용해 기술 헤드라인 피드를 추가하고, 주제를 검색할 수 있게 해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 키와 함께 분류 또는 검색어로 뉴스 API를 호출한 뒤 반환된 기사를 읽습니다. 스킬은 GNews를 무료 요금제에서 쓰기 좋은 추천 옵션으로 설명하고, NewsAPI를 다른 선택지로 소개합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

News API Integration

Multiple news APIs available. GNews is recommended for free tier usability.

Recommended: GNews

  • Docs: https://gnews.io/docs/v4
  • Base URL: https://gnews.io/api/v4
  • Auth: Query param token=API_KEY
  • Free tier: 100 requests/day, 10 articles per request
  • CORS: Yes

Top Headlines

GET /top-headlines?category=general&lang=en&max=10&token=API_KEY

Categories: general, world, nation, business, technology, entertainment, sports, science, health

Search

GET /search?q=artificial+intelligence&lang=en&max=10&token=API_KEY

Response Shape

{
  "totalArticles": 1234,
  "articles": [
    {
      "title": "Article Title",
      "description": "Short description...",
      "content": "Full article content (truncated)...",
      "url": "https://example.com/article",
      "image": "https://example.com/image.jpg",
      "publishedAt": "2024-01-15T12:00:00Z",
      "source": {
        "name": "CNN",
        "url": "https://cnn.com"
      }
    }
  ]
}

Alternative: NewsAPI.org

  • Docs: https://newsapi.org/docs
  • Free tier: 100 requests/day, for development only
  • Note: Free plan does NOT support production use (requires paid plan for CORS from browser)
GET /v2/top-headlines?country=us&apiKey=API_KEY
GET /v2/everything?q=bitcoin&apiKey=API_KEY

Other Alternatives (from public-apis)

API Free Tier Best For
GNews 100 req/day General news, good free tier
Currents API 600 req/day Real-time news, good rate
NewsData.io 200 req/day News + crypto news
The Guardian Unlimited (rate limited) UK/international news
New York Times 500 req/day US news, archives
Mediastack 500 req/month Multi-source aggregation
TheNews API 100 req/day Simple aggregation
MarketAux 100 req/day Financial news with sentiment
HackerNews No limit Tech/startup news (no key needed)

Frontend Service Implementation

// src/services/news.ts
import { createCircuitBreaker } from '@/utils/circuit-breaker';

export interface NewsArticle {
  title: string;
  description: string;
  url: string;
  source: string;
  publishedAt: string;
  image?: string;
}

const newsBreaker = createCircuitBreaker<NewsArticle[]>({
  name: 'News',
  cacheTtlMs: 5 * 60_000, // 5 minutes
});

export async function fetchNews(category = 'general'): Promise<NewsArticle[]> {
  return newsBreaker.execute(async () => {
    const resp = await fetch(`/api/news?category=${category}`);
    if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
    const data = await resp.json();
    return data.articles || [];
  }, []);
}

export async function searchNews(query: string): Promise<NewsArticle[]> {
  const resp = await fetch(`/api/news?q=${encodeURIComponent(query)}`);
  if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
  const data = await resp.json();
  return data.articles || [];
}

HackerNews (No API Key Needed)

For tech news, HackerNews API is free and unlimited:

// Fetch top 30 stories
const topIds = await fetch('https://hacker-news.firebaseio.com/v0/topstories.json').then(r => r.json());
const stories = await Promise.all(
  topIds.slice(0, 30).map((id: number) =>
    fetch(`https://hacker-news.firebaseio.com/v0/item/${id}.json`).then(r => r.json())
  )
);
// Each story: { title, url, score, by, time, descendants }

Panel Rendering Pattern

private render(articles: NewsArticle[]): void {
  const rows = articles.map(a => `
    <div class="news-item">
      <a href="${a.url}" target="_blank" rel="noopener" class="news-title">${escapeHtml(a.title)}</a>
      <div class="news-meta">
        <span class="news-source">${escapeHtml(a.source)}</span>
        <span class="news-time">${formatTime(new Date(a.publishedAt))}</span>
      </div>
    </div>
  `).join('');
  this.setContent(`<div class="news-list">${rows}</div>`);
}

Always escape user-controlled strings with escapeHtml() to prevent XSS.

자주 묻는 질문

어떤 뉴스 API가 추천되나요?

스킬은 무료 요금제에서 쓰기 편하다는 이유로 GNews를 추천하며, 브라우저 CORS를 지원한다고 설명합니다.

NewsAPI는 운영 환경에서 무료인가요?

아니요, 스킬은 NewsAPI의 무료 요금제가 개발용이라 브라우저에서 운영 환경 사용을 지원하지 않는다고 설명합니다.

어떤 분류가 있나요?

일반, 비즈니스, 기술, 스포츠, 과학, 건강 같은 분류를 나열합니다.

상세 정보

작성자의 원본 설명

Integrate with news APIs (GNews, NewsAPI, etc.) for aggregated news feeds. Covers headline fetching, search, and category filtering.

repo: HKUDS/AgentPilot

인기도

GitHub 스타
7.8k
순위
#13061
라이선스
MIT
업데이트
2026. 11. 1.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬