MelonChart.js
2.92 KB
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
const axios = require("axios");
const cheerio = require("cheerio");
const url_ballad = "https://www.melon.com/genre/song_list.htm?gnrCode=GN0100#params%5BgnrCode%5D=GN0100¶ms%5BdtlGnrCode%5D=¶ms%5BorderBy%5D=POP¶ms%5BsteadyYn%5D=N&po=pageObj&startIndex=1"
const url_hiphop_kr = "https://www.melon.com/genre/song_list.htm?gnrCode=GN0300#params%5BgnrCode%5D=GN0300¶ms%5BdtlGnrCode%5D=¶ms%5BorderBy%5D=POP¶ms%5BsteadyYn%5D=N&po=pageObj&startIndex=1"
const url_hiphop_us = "https://www.melon.com/genre/song_list.htm?gnrCode=GN1200#params%5BgnrCode%5D=GN1200¶ms%5BdtlGnrCode%5D=GN1201¶ms%5BorderBy%5D=POP¶ms%5BsteadyYn%5D=N&po=pageObj&startIndex=1"
const url_dance = "https://www.melon.com/genre/song_list.htm?gnrCode=GN0200#params%5BgnrCode%5D=GN0200¶ms%5BdtlGnrCode%5D=¶ms%5BorderBy%5D=POP¶ms%5BsteadyYn%5D=N&po=pageObj&startIndex=1"
const url_rock_kr = "https://www.melon.com/genre/song_list.htm?gnrCode=GN0600#params%5BgnrCode%5D=GN0600¶ms%5BdtlGnrCode%5D=¶ms%5BorderBy%5D=POP¶ms%5BsteadyYn%5D=N&po=pageObj&startIndex=1"
const url_rock_us = "https://www.melon.com/genre/song_list.htm?gnrCode=GN1000#params%5BgnrCode%5D=GN1000¶ms%5BdtlGnrCode%5D=GN1001¶ms%5BorderBy%5D=POP¶ms%5BsteadyYn%5D=N&po=pageObj&startIndex=1"
const url_pop = "https://www.melon.com/genre/song_list.htm?gnrCode=GN0900#params%5BgnrCode%5D=GN0900¶ms%5BdtlGnrCode%5D=GN0901¶ms%5BorderBy%5D=POP¶ms%5BsteadyYn%5D=N&po=pageObj&startIndex=1"
const url_RNB_kr = "https://www.melon.com/genre/song_list.htm?gnrCode=GN0400#params%5BgnrCode%5D=GN0400¶ms%5BdtlGnrCode%5D=¶ms%5BorderBy%5D=POP¶ms%5BsteadyYn%5D=N&po=pageObj&startIndex=1"
const url_RNB_us = "https://www.melon.com/genre/song_list.htm?gnrCode=GN1300#params%5BgnrCode%5D=GN1300¶ms%5BdtlGnrCode%5D=GN1301¶ms%5BorderBy%5D=POP¶ms%5BsteadyYn%5D=N&po=pageObj&startIndex=1"
const url_indie = "https://www.melon.com/genre/song_list.htm?gnrCode=GN0500#params%5BgnrCode%5D=GN0500¶ms%5BdtlGnrCode%5D=GN0501¶ms%5BorderBy%5D=POP¶ms%5BsteadyYn%5D=N&po=pageObj&startIndex=1"
const url_newage = "https://www.melon.com/genre/song_list.htm?gnrCode=GN1800#params%5BgnrCode%5D=GN1800¶ms%5BdtlGnrCode%5D=GN1801¶ms%5BorderBy%5D=POP¶ms%5BsteadyYn%5D=N&po=pageObj&startIndex=1"
const url_classic = ""
const url_jazz = "https://www.melon.com/genre/jazz_list.htm?gnrCode=GN1700#params%5BgnrCode%5D=GN1700¶ms%5BdtlGnrCode%5D=GN1701¶ms%5BorderBy%5D=POP¶ms%5BsteadyYn%5D=&po=pageObj&startIndex=1"
const getHTML = async() => {
try{
return await axios.get(url_hiphop_kr)
}catch(err) {
console.log(err);
}
}
const parsing = async() => {
const html = await getHTML();
const $ = cheerio.load(html.data);
const $TitleList = $("div.ellipsis.rank01");
let Titles = [];
$TitleList.each((inx, node) => {
const title = $(node).find("a").text();
console.log(title);
});
}
parsing();