Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MR414N-ID
GitHub Repository: MR414N-ID/botku2
Path: blob/master/node_modules/@bochilteam/scraper/lib/cjs/news/merdeka.js
1126 views
1
"use strict";
2
var __importDefault = (this && this.__importDefault) || function (mod) {
3
return (mod && mod.__esModule) ? mod : { "default": mod };
4
};
5
Object.defineProperty(exports, "__esModule", { value: true });
6
const got_1 = __importDefault(require("got"));
7
const cheerio_1 = __importDefault(require("cheerio"));
8
async function merdeka() {
9
const html = await (0, got_1.default)('https://www.merdeka.com/berita-hari-ini/').text();
10
const $ = cheerio_1.default.load(html);
11
const results = [];
12
$('div.main_photo_center > div.mdk-tag-contg').each((_, el) => {
13
const $el = $(el);
14
const title = $el.find('div.mdk-tag-contln-l > a[title]').attr('title');
15
const link = $el.find('div.mdk-tag-contln-l > a[title]').attr('href');
16
const image = $el.find('div.mdk-tag-contln-l > a[title] > img').attr('src');
17
const label = $el.find('div.mdk-tag-contln-date > span').text();
18
const date = $el.find('div.mdk-tag-contln-date').text();
19
if (title) {
20
results.push({
21
title,
22
link: 'https://www.merdeka.com' + link,
23
image,
24
label,
25
date: date.replace(label, '').replace('Sekitar', '').trim()
26
});
27
}
28
});
29
return results;
30
}
31
exports.default = merdeka;
32
//# sourceMappingURL=merdeka.js.map
33