Path: blob/master/node_modules/@bochilteam/scraper/lib/esm/news/merdeka.js
1126 views
import got from 'got';1import cheerio from 'cheerio';2export default async function merdeka() {3const html = await got('https://www.merdeka.com/berita-hari-ini/').text();4const $ = cheerio.load(html);5const results = [];6$('div.main_photo_center > div.mdk-tag-contg').each((_, el) => {7const $el = $(el);8const title = $el.find('div.mdk-tag-contln-l > a[title]').attr('title');9const link = $el.find('div.mdk-tag-contln-l > a[title]').attr('href');10const image = $el.find('div.mdk-tag-contln-l > a[title] > img').attr('src');11const label = $el.find('div.mdk-tag-contln-date > span').text();12const date = $el.find('div.mdk-tag-contln-date').text();13if (title) {14results.push({15title,16link: 'https://www.merdeka.com' + link,17image,18label,19date: date.replace(label, '').replace('Sekitar', '').trim()20});21}22});23return results;24}25//# sourceMappingURL=merdeka.js.map2627