@kmd/googlenews
Version:
40 lines (39 loc) • 1.45 kB
TypeScript
export declare namespace GoogleNews {
type Search = "TOPIC" | "GEO" | "QUERY";
type TopicWordList = "WORLD" | "SCIENCE" | "BUSINESS" | "NATION" | "TECHNOLOGY" | "SPORT" | "HEALTH";
type LanguageWord = "JAPANESE" | "US_ENGLISH" | "UK_ENGLISH" | "CHINESE" | "SPANISH" | "DEUTCHE" | "ARABIC";
type ArticleItem = {
title: string;
pubDate: string;
description: string;
source_name: string;
source_url: string;
link: string;
dateItem: {
year: number;
day: number;
hour: number;
date: number;
month: number;
};
};
type QueryURLArgs = {
word?: string;
after_period?: string;
before_period?: string;
site_domain?: string;
};
type GeoURLArgs = {
geo: string;
};
type TopicURLArgs = {
topic: TopicWordList;
};
type TopicArgs<T> = {
language: LanguageWord;
option: T;
};
}
export declare const searchTopic: (args: GoogleNews.TopicArgs<GoogleNews.TopicURLArgs>, fetch: any) => Promise<GoogleNews.ArticleItem[]>;
export declare const searchQuery: (args: GoogleNews.TopicArgs<GoogleNews.QueryURLArgs>, fetch: any) => Promise<GoogleNews.ArticleItem[]>;
export declare const searchGeo: (args: GoogleNews.TopicArgs<GoogleNews.GeoURLArgs>, fetch: any) => Promise<GoogleNews.ArticleItem[]>;