Skip to content

Commit

Permalink
Merge pull request #2076 from DIYgod/master
Browse files Browse the repository at this point in the history
[pull] master from diygod:master
  • Loading branch information
pull[bot] authored Feb 6, 2025
2 parents 091c524 + dbf02a8 commit ea211ed
Show file tree
Hide file tree
Showing 14 changed files with 583 additions and 6 deletions.
13 changes: 9 additions & 4 deletions lib/routes/6park/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,21 @@ import timezone from '@/utils/timezone';
import { parseDate } from '@/utils/parse-date';

export const route: Route = {
path: '/:id?/:type?/:keyword?',
path: '/index/:id?/:type?/:keyword?',
name: '首页',
maintainers: ['nczitzk', 'cscnk52'],
handler,
example: '/6park/index',
parameters: { id: '分站,见下表,默认为史海钩沉', type: '类型,可选值为 gold、type,默认为空', keyword: '关键词,可选,默认为空' },
radar: [
{
source: ['club.6parkbbs.com/:id/index.php', 'club.6parkbbs.com/'],
target: '/:id?',
},
],
name: 'Unknown',
maintainers: [],
handler,
description: `| 婚姻家庭 | 魅力时尚 | 女性频道 | 生活百态 | 美食厨房 | 非常影音 | 车迷沙龙 | 游戏天地 | 卡通漫画 | 体坛纵横 | 运动健身 | 电脑前线 | 数码家电 | 旅游风向 | 摄影部落 | 奇珍异宝 | 笑口常开 | 娱乐八卦 | 吃喝玩乐 | 文化长廊 | 军事纵横 | 百家论坛 | 科技频道 | 爱子情怀 | 健康人生 | 博论天下 | 史海钩沉 | 网际谈兵 | 经济观察 | 谈股论金 | 杂论闲侃 | 唯美乐园 | 学习园地 | 命理玄机 | 宠物情缘 | 网络歌坛 | 音乐殿堂 | 情感世界 |
|----------|----------|----------|----------|----------|----------|----------|----------|----------|----------|----------|----------|----------|----------|----------|----------|----------|----------|----------|----------|----------|----------|----------|----------|----------|----------|----------|----------|----------|----------|----------|----------|----------|----------|----------|----------|----------|----------|
| life9 | life1 | chan10 | life2 | life6 | fr | enter7 | enter3 | enter6 | enter5 | sport | know1 | chan6 | life7 | chan8 | page | enter1 | enter8 | netstar | life10 | nz | other | chan2 | chan5 | life5 | bolun | chan1 | military | finance | chan4 | pk | gz1 | gz2 | gz3 | life8 | chan7 | enter4 | life3 |`,
};

async function handler(ctx) {
Expand Down
13 changes: 11 additions & 2 deletions lib/routes/6park/news.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,17 @@ export const route: Route = {
target: '/:id?',
},
],
name: 'Unknown',
maintainers: [],
name: '新闻栏目',
maintainers: ['nczitzk', 'cscnk52'],
parameters: {
site: '分站,可选newspark、local,默认为 newspark',
id: '栏目 id,可选,默认为空',
keyword: '关键词,可选,默认为空',
},
description: `::: tip 提示
若订阅 [时政](https://www.6parknews.com/newspark/index.php?type=1),其网址为 <https://www.6parknews.com/newspark/index.php?type=1>,其中 \`newspark\` 为分站,\`1\` 为栏目 id。
若订阅 [美国](https://local.6parknews.com/index.php?type_id=1),其网址为 <https://local.6parknews.com/index.php?type_id=1>,其中 \`local\` 为分站,\`1\` 为栏目 id。
:::`,
handler,
};

Expand Down
55 changes: 55 additions & 0 deletions lib/routes/publico/ciencias.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { Route } from '@/types';
import got from '@/utils/got';
import { load } from 'cheerio';

import getItems from './items-processor';

export const route: Route = {
path: '/ciencias/:subsection?',
parameters: {
subsection: {
description: "Filter by subsection. Check the subsections available on the newspaper's website.",
},
},
categories: ['traditional-media'],
example: '/publico/ciencias',
features: {
requireConfig: false,
requirePuppeteer: true,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
radar: [
{
source: ['publico.es/ciencias'],
target: '/ciencias',
},
],
name: 'Ciencias',
maintainers: ['adrianrico97'],
handler,
};

async function handler(ctx) {
const { subsection } = ctx.req.param();

const rootUrl = 'https://www.publico.es';
const currentUrl = subsection ? `${rootUrl}/ciencias/${subsection}` : `${rootUrl}/ciencias`;

const response = await got({
method: 'get',
url: currentUrl,
});

const $ = load(response.data);
const title = $('.article-section h1').text();
const items = getItems($);

return {
title: `${title} | Público`,
link: currentUrl,
item: items,
};
}
55 changes: 55 additions & 0 deletions lib/routes/publico/culturas.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { Route } from '@/types';
import got from '@/utils/got';
import { load } from 'cheerio';

import getItems from './items-processor';

export const route: Route = {
path: '/culturas/:subsection?',
parameters: {
subsection: {
description: "Filter by subsection. Check the subsections available on the newspaper's website.",
},
},
categories: ['traditional-media'],
example: '/publico/culturas',
features: {
requireConfig: false,
requirePuppeteer: true,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
radar: [
{
source: ['publico.es/culturas'],
target: '/culturas',
},
],
name: 'Culturas',
maintainers: ['adrianrico97'],
handler,
};

async function handler(ctx) {
const { subsection } = ctx.req.param();

const rootUrl = 'https://www.publico.es';
const currentUrl = subsection ? `${rootUrl}/culturas/${subsection}` : `${rootUrl}/culturas`;

const response = await got({
method: 'get',
url: currentUrl,
});

const $ = load(response.data);
const title = $('.article-section h1').text();
const items = getItems($);

return {
title: `${title} | Público`,
link: currentUrl,
item: items,
};
}
55 changes: 55 additions & 0 deletions lib/routes/publico/economia.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { Route } from '@/types';
import got from '@/utils/got';
import { load } from 'cheerio';

import getItems from './items-processor';

export const route: Route = {
path: '/economia/:subsection?',
parameters: {
subsection: {
description: "Filter by subsection. Check the subsections available on the newspaper's website.",
},
},
categories: ['traditional-media'],
example: '/publico/economia',
features: {
requireConfig: false,
requirePuppeteer: true,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
radar: [
{
source: ['publico.es/economia'],
target: '/economia',
},
],
name: 'Economia',
maintainers: ['adrianrico97'],
handler,
};

async function handler(ctx) {
const { subsection } = ctx.req.param();

const rootUrl = 'https://www.publico.es';
const currentUrl = subsection ? `${rootUrl}/economia/${subsection}` : `${rootUrl}/economia`;

const response = await got({
method: 'get',
url: currentUrl,
});

const $ = load(response.data);
const title = $('.article-section h1').text();
const items = getItems($);

return {
title: `${title} | Público`,
link: currentUrl,
item: items,
};
}
55 changes: 55 additions & 0 deletions lib/routes/publico/internacional.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { Route } from '@/types';
import got from '@/utils/got';
import { load } from 'cheerio';

import getItems from './items-processor';

export const route: Route = {
path: '/internacional/:subsection?',
parameters: {
subsection: {
description: "Filter by subsection. Check the subsections available on the newspaper's website.",
},
},
categories: ['traditional-media'],
example: '/publico/internacional',
features: {
requireConfig: false,
requirePuppeteer: true,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
radar: [
{
source: ['publico.es/internacional'],
target: '/internacional',
},
],
name: 'Internacional',
maintainers: ['adrianrico97'],
handler,
};

async function handler(ctx) {
const { subsection } = ctx.req.param();

const rootUrl = 'https://www.publico.es';
const currentUrl = subsection ? `${rootUrl}/internacional/${subsection}` : `${rootUrl}/internacional`;

const response = await got({
method: 'get',
url: currentUrl,
});

const $ = load(response.data);
const title = $('.article-section h1').text();
const items = getItems($);

return {
title: `${title} | Público`,
link: currentUrl,
item: items,
};
}
20 changes: 20 additions & 0 deletions lib/routes/publico/items-processor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
export default function getItems(data) {
const items = data('.category-list li')
.toArray()
.map((item) => {
item = data(item);
const title = item.find('h2').text();
const link = item.find('a').attr('href');
const author = item.find('p').text();
const image = item.find('picture img').attr('src');

return {
title,
link,
description: `<img src="${image}" alt="${title}">`,
author,
};
});

return items;
}
55 changes: 55 additions & 0 deletions lib/routes/publico/mujer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { Route } from '@/types';
import got from '@/utils/got';
import { load } from 'cheerio';

import getItems from './items-processor';

export const route: Route = {
path: '/mujer/:subsection?',
parameters: {
subsection: {
description: "Filter by subsection. Check the subsections available on the newspaper's website.",
},
},
categories: ['traditional-media'],
example: '/publico/mujer',
features: {
requireConfig: false,
requirePuppeteer: true,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
radar: [
{
source: ['publico.es/mujer'],
target: '/mujer',
},
],
name: 'Mujer',
maintainers: ['adrianrico97'],
handler,
};

async function handler(ctx) {
const { subsection } = ctx.req.param();

const rootUrl = 'https://www.publico.es';
const currentUrl = subsection ? `${rootUrl}/mujer/${subsection}` : `${rootUrl}/mujer`;

const response = await got({
method: 'get',
url: currentUrl,
});

const $ = load(response.data);
const title = $('.article-section h1').text();
const items = getItems($);

return {
title: `${title} | Público`,
link: currentUrl,
item: items,
};
}
6 changes: 6 additions & 0 deletions lib/routes/publico/namespace.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import type { Namespace } from '@/types';

export const namespace: Namespace = {
name: 'Público',
url: 'publico.es',
};
Loading

0 comments on commit ea211ed

Please sign in to comment.