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/antaranews.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 antaranews() {
9
const html = await (0, got_1.default)('https://www.antaranews.com/').text();
10
const $ = cheerio_1.default.load(html);
11
const results = [];
12
$('div.terkini > article.simple-post').each((_, el) => {
13
const $el = $(el);
14
const title = $el.find('.latest-news > a').text();
15
const link = $el.find('.latest-news > a').attr('href');
16
const $image = $el.find('picture');
17
const image = $image.find('img').attr('src') ||
18
$image.find('img').attr('data-src') ||
19
$image.find('source').attr('srcset') ||
20
$image.find('source').attr('data-srcset');
21
const label = $el.find('.simple-share').text();
22
const date = $el.find('.simple-share > span').text();
23
if (title && image) {
24
results.push({
25
title,
26
link,
27
image,
28
label: label.replace(date, '').replace('/', '').trim(),
29
date: date.trim()
30
});
31
}
32
});
33
return results;
34
}
35
exports.default = antaranews;
36
//# sourceMappingURL=antaranews.js.map
37