Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MR414N-ID
GitHub Repository: MR414N-ID/botku2
Path: blob/master/node_modules/@bochilteam/scraper/lib/esm/news/suaracom.js
1126 views
1
import got from 'got';
2
import cheerio from 'cheerio';
3
export default async function suaracom() {
4
const html = await got('https://www.suara.com/news').text();
5
const $ = cheerio.load(html);
6
const results = [];
7
$('div.widget-content > ul.list-unstyled > li.item-outer').each((_, el) => {
8
const $el = $(el);
9
const title = $el.find('h4.post-title > a.ellipsis2').text();
10
const link = $el.find('h4.post-title > a.ellipsis2').attr('href');
11
const description = $el.find('div.item-content > p.ellipsis2').text();
12
const image = $el.find('div.post-thumb > a > img').attr('src');
13
const date = $el.find('.suara-date-box > span').map((i, el) => $(el).text()).get().join(' ');
14
if (title && link) {
15
results.push({
16
title,
17
link,
18
image,
19
description,
20
date
21
});
22
}
23
});
24
return results;
25
}
26
//# sourceMappingURL=suaracom.js.map
27