Path: blob/master/node_modules/@bochilteam/scraper/lib/esm/news/kompas.js
1126 views
import got from 'got';1import cheerio from 'cheerio';2export default async function kompas() {3const html = await got('https://www.kompas.com/').text();4const $ = cheerio.load(html);5const result = [];6$('div.latest.ga--latest').each((_, el) => {7$(el).find('div.article__list').each((_, el) => {8const $el = $(el);9const title = $el.find('h3 > a.article__link').text();10const link = $el.find('h3 > a.article__link').attr('href');11const $image = $el.find('.article__asset > a > img');12const image = ($image.attr('src') || $image.attr('data-src'));13const label = $el.find('.article__list__info > .article__subtitle').text();14const date = $el.find('.article__list__info > .article__date').text();15if (title && link) {16result.push({17title,18link,19image,20label,21date22});23}24});25});26return result;27}28//# sourceMappingURL=kompas.js.map2930