Skip to content

Commit

Permalink
Merge pull request #1325 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 Mar 21, 2024
2 parents dcf391d + 3351e51 commit f00fa7b
Show file tree
Hide file tree
Showing 11 changed files with 250 additions and 211 deletions.
8 changes: 0 additions & 8 deletions lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ router.get('/disqus/posts/:forum', lazyloadRouteHandler('./routes/disqus/posts')
// 极客时间
router.get('/geektime/column/:cid', lazyloadRouteHandler('./routes/geektime/column'));

// 南方周末
router.get('/infzm/:id', lazyloadRouteHandler('./routes/infzm/news'));

// Dribbble
// router.get('/dribbble/popular/:timeframe?', lazyloadRouteHandler('./routes/dribbble/popular'));
// router.get('/dribbble/user/:name', lazyloadRouteHandler('./routes/dribbble/user'));
Expand Down Expand Up @@ -992,11 +989,6 @@ router.get('/ddrk/index', lazyloadRouteHandler('./routes/ddrk/list'));
router.get('/avgle/videos/:order?/:time?/:top?', lazyloadRouteHandler('./routes/avgle/videos.js'));
router.get('/avgle/search/:keyword/:order?/:time?/:top?', lazyloadRouteHandler('./routes/avgle/videos.js'));

// 公主链接公告
// router.get('/pcr/news', lazyloadRouteHandler('./routes/pcr/news'));
router.get('/pcr/news-tw', lazyloadRouteHandler('./routes/pcr/news-tw'));
router.get('/pcr/news-cn', lazyloadRouteHandler('./routes/pcr/news-cn'));

// project-zero issues
router.get('/project-zero-issues', lazyloadRouteHandler('./routes/project-zero-issues/index'));

Expand Down
62 changes: 0 additions & 62 deletions lib/routes-deprecated/infzm/news.js

This file was deleted.

28 changes: 0 additions & 28 deletions lib/routes-deprecated/pcr/news-cn.js

This file was deleted.

67 changes: 0 additions & 67 deletions lib/routes-deprecated/pcr/news-tw.js

This file was deleted.

69 changes: 69 additions & 0 deletions lib/routes/2023game/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { Data, DataItem, Route } from '@/types';
import got from '@/utils/got';
import { parseDate } from '@/utils/parse-date';
import { load } from 'cheerio';
import { Context } from 'hono';

export const route: Route = {
path: '/:category?/:tab?',
categories: ['game'],
example: '/2023game/sgame/topicList',
parameters: {
category: '分类,见下表',
tab: '标签, 所有:all;最新:topicList;热门:jhcpb',
},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
name: '游戏星辰',
maintainers: ['xzzpig'],
handler,
url: 'www.2023game.com/',
description: `分类
| PS4游戏 | switch游戏 | 3DS游戏 | PSV游戏 | Xbox360 | PS3游戏 | 世嘉MD/SS | PSP游戏 | PC周边 | 怀旧掌机 | 怀旧主机 | PS4教程 | PS4金手指 | switch金手指 | switch教程 | switch补丁 | switch主题 | switch存档 |
| -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
| ps4 | sgame | 3ds | psv | jiaocheng | ps3yx | zhuji.md | zhangji.psp | pcgame | zhangji | zhuji | ps4.psjc | ps41.ps4pkg | nsaita.cundang | nsaita.pojie | nsaita.buding | nsaita.zhutie | nsaita.zhuti |`,
};

async function handler(ctx?: Context): Promise<Data> {
const category = (ctx!.req.param('category') ?? 'sgame').replaceAll('.', '/');
const tab = ctx?.req.param('tab') ?? 'all';

const currentUrl = `https://www.2023game.com/${category}/`;

const response = await got(currentUrl);
const $ = load(response.data as any);

let selector = `.news`;
if (tab !== 'all') {
selector = `#${tab} > ${selector}`;
}

const items: DataItem[] = $(selector)
.toArray()
.map((item) => {
const $item = $(item);
const href = $item.find('a').attr('href');
return {
title: $item.text().trim(),
guid: `2023game:${href}`,
link: href!,
pubDate: parseDate($item.find('.time_box').text().trim()),
description: $item.html() ?? '',
};
});

return {
title: $('title').text(),
link: currentUrl,
allowEmpty: true,
image: 'https://www.2023game.com/resources/img/logo.png',
item: items,
};
}
6 changes: 6 additions & 0 deletions lib/routes/2023game/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: '游戏星辰',
url: 'www.2023game.com',
};
66 changes: 66 additions & 0 deletions lib/routes/douban/book/latest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { Route } from '@/types';
import got from '@/utils/got';

const linkUrl = 'https://book.douban.com/latest';
const baseUrl = 'https://m.douban.com/rexxar/api/v2/subject_collection';
const params = 'items?start=0&count=10&mode=collection&for_mobile=1';

export const route: Route = {
path: '/book/latest/:type?',
categories: ['social-media'],
example: '/douban/book/latest/fiction',
parameters: { type: '专题分类,可选,默认为 `all`' },
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
name: '新书速递',
maintainers: ['fengkx', 'lyqluis'],
description: `
| 文学 | 小说 | 历史文化 | 社会纪实 | 科学新知 | 艺术设计 | 商业经管 | 绘本漫画 |
| ------------ | ------- | -------- | --------- | -------- | -------- | -------- | -------- |
| prose_poetry | fiction | history | biography | science | art | business | comics |`,
handler,
};

const SUBCATS = {
all: '全部',
prose_poetry: '文学',
fiction: '小说',
history: '历史文化',
biography: '社会纪实',
science: '科学新知',
art: '艺术设计',
business: '商业经管',
comics: '绘本漫画',
};

async function handler(ctx) {
const type = ctx.req.param('type') ?? 'all';
const subUrl = `new_book_${type}`;
const url = `${baseUrl}/${subUrl}/${params}`;

const res = await got.get(url);
const items = res.data.items;

return {
title: `豆瓣新书速递${type === 'all' ? '' : '-' + SUBCATS[type]}`,
link: `${linkUrl}${type === 'all' ? '' : '?subcat=' + SUBCATS[type]}`,
item: items.map(({ title, url, card_subtitle, cards, pic, rating, null_rating_reason }) => {
const rate = rating.value ? `${rating.value}分` : null_rating_reason;
const img = `<img src="${pic.normal}">`;
const info = card_subtitle;
const description = `${img}<br>${title}<br><br>${info}<br><br>${cards[0]?.content ?? ''}<br><br>${rate}`;

return {
title,
description,
link: url,
};
}),
};
}
38 changes: 0 additions & 38 deletions lib/routes/douban/other/latest-book.ts

This file was deleted.

Loading

0 comments on commit f00fa7b

Please sign in to comment.