initial commit
This commit is contained in:
38
services/naverService.ts
Normal file
38
services/naverService.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
|
||||
import { ApiSettings, NewsItem } from '../types';
|
||||
|
||||
export class NaverService {
|
||||
private settings: ApiSettings;
|
||||
|
||||
constructor(settings: ApiSettings) {
|
||||
this.settings = settings;
|
||||
}
|
||||
|
||||
async fetchNews(query: string = "주식"): Promise<NewsItem[]> {
|
||||
if (!this.settings.useNaverNews || !this.settings.naverClientId) {
|
||||
console.log("Naver News: Service disabled or configuration missing.");
|
||||
return [];
|
||||
}
|
||||
|
||||
console.log(`Naver News: Fetching for "${query}"...`);
|
||||
|
||||
// 실제 API 연동 시 백엔드 프록시 호출 권장
|
||||
// const response = await fetch(`/api/naver-news?query=${encodeURIComponent(query)}`);
|
||||
// return await response.json();
|
||||
|
||||
return [
|
||||
{
|
||||
title: `[속보] ${query} 관련 글로벌 거시 경제 영향 분석 보고서`,
|
||||
description: "현재 시장 상황에서 해당 섹터의 성장이 두드러지고 있으며 기관 투자자들의 매수세가 이어지고 있습니다.",
|
||||
link: "https://news.naver.com",
|
||||
pubDate: new Date().toISOString()
|
||||
},
|
||||
{
|
||||
title: `${query} 실시간 수급 현황 및 외인 매수세 유입`,
|
||||
description: "외국인 투자자들이 3거래일 연속 순매수를 기록하며 주가 상승을 견인하고 있습니다.",
|
||||
link: "https://news.naver.com",
|
||||
pubDate: new Date().toISOString()
|
||||
}
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user