forked from hyunchel/melon-chart-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
52 lines (47 loc) · 1.61 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
declare module "@sirubot/melon-chart-api" {
// Hard coded options default value, use typeof import('../defaults.js")["key"] (but default.js not exporting type)
type MelonChartOptions = {
startDateKey?: string | "startDay"
endDateKey?: string | "endDay"
rankMonthKey?: string | "rankMonth"
isFirstDateKey?: string | "isFirstDate"
isLastDateKey?: string | "isLastDate"
movedKey?: string | "moved"
indexKey?: string | "idx"
url?: string | "http://www.melon.com/chart/day/index.htm?"
cutLine?: number | 5
xpath?: {
songTitles?: string | ".wrap_song_info .rank01 span a"
artistNames?: string | ".wrap_song_info .rank02 span"
albumNames?: string | ".wrap_song_info .rank03 a"
albumCovers?: string | ".image_typeAll img"
albumIds?: string | '.image_typeAll',
dataSongNo?: string | "tbody tr"
}
messageFn?: () => void
date?: Date
}
type MelonChartTrackInfo = {
rank: number;
title: string;
artist: string;
album: string;
albumCover: string;
songId: string;
}
type MelonChartDates = {
start: string,
end: string,
}
type MelonChart = {
data: MelonChartTrackInfo[]
dates: MelonChartDates
}
type MelonChartMethods = {
realtime(): Promise<MelonChart>
daily(): Promise<MelonChart>
weekly(): Promise<MelonChart>
monthly(): Promise<MelonChart>
}
function Melon(date: string, options: MelonChartOptions): MelonChartMethods
}