-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathipltask1.mjs
29 lines (23 loc) · 846 Bytes
/
ipltask1.mjs
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
import cheerio from 'cheerio';
import axios from 'axios';
import chalk from 'chalk';
console.log("just to check ");
axios.get('https://www.espncricinfo.com/series/ipl-2020-21-1210595/chennai-super-kings-vs-kings-xi-punjab-53rd-match-1216506/ball-by-ball-commentary')
.then(response => {
handleHtml(response.data);
})
.catch(error => {
console.log("error: ", error);
});
function handleHtml(html) {
let $ = cheerio.load(html);
let elemsArr = $(".d-flex.match-comment-padder.align-items-center .match-comment-long-text");
// for (let i = 0; i < contentArr.length; i++) {
// let data = setTool(contentArr[i]);
// console.log("data: ", data.text());
// }
let text = $(elemsArr[0]).text();
let htmldata = $(elemsArr[0]).html();
console.log("text data :" , text);
console.log("html data :" , htmldata);
}