* Add new route: Spanish newspaper publico.es * Add new route: Spanish newspaper publico.es (II) * Add new route: Spanish newspaper publico.es (III) * Add new route: Spanish newspaper publico.es (fix) * Add new route: Spanish newspaper publico.es (fixes II)
49 lines
1.0 KiB
TypeScript
49 lines
1.0 KiB
TypeScript
import { Route } from '@/types';
|
|
import got from '@/utils/got';
|
|
import { load } from 'cheerio';
|
|
|
|
import getItems from './items-processor';
|
|
|
|
export const route: Route = {
|
|
path: '/public',
|
|
categories: ['traditional-media'],
|
|
example: '/publico/public',
|
|
features: {
|
|
requireConfig: false,
|
|
requirePuppeteer: true,
|
|
antiCrawler: false,
|
|
supportBT: false,
|
|
supportPodcast: false,
|
|
supportScihub: false,
|
|
},
|
|
radar: [
|
|
{
|
|
source: ['publico.es/public'],
|
|
target: '/public',
|
|
},
|
|
],
|
|
name: 'Public',
|
|
maintainers: ['adrianrico97'],
|
|
handler,
|
|
};
|
|
|
|
async function handler() {
|
|
const rootUrl = 'https://www.publico.es';
|
|
const currentUrl = `${rootUrl}/public`;
|
|
|
|
const response = await got({
|
|
method: 'get',
|
|
url: currentUrl,
|
|
});
|
|
|
|
const $ = load(response.data);
|
|
|
|
const items = getItems($);
|
|
|
|
return {
|
|
title: 'public | Público',
|
|
link: currentUrl,
|
|
item: items,
|
|
};
|
|
}
|