Skip to content

Commit

Permalink
Merge pull request #119 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 27, 2024
2 parents 46ce4ef + a980792 commit 4c3e3e7
Show file tree
Hide file tree
Showing 10 changed files with 100 additions and 59 deletions.
2 changes: 1 addition & 1 deletion lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,7 @@ router.get('/avgle/videos/:order?/:time?/:top?', lazyloadRouteHandler('./routes/
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', lazyloadRouteHandler('./routes/pcr/news'));
router.get('/pcr/news-tw', lazyloadRouteHandler('./routes/pcr/news-tw'));
router.get('/pcr/news-cn', lazyloadRouteHandler('./routes/pcr/news-cn'));

Expand Down
31 changes: 0 additions & 31 deletions lib/routes/pcr/news.js

This file was deleted.

5 changes: 2 additions & 3 deletions lib/v2/2048/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ module.exports = async (ctx) => {
},
});
const $ = cheerio.load(response);
return $('ul li a')
.toArray()
.find((item) => $(item).text() === '最新線路1').attribs.href;
const targetLink = $('table.group-table tr').eq(1).find('td a').eq(0).attr('href');
return targetLink;
});

const currentUrl = `${entranceDomain}/2048/thread.php?fid-${id}.html`;
Expand Down
3 changes: 3 additions & 0 deletions lib/v2/priconne-redive/maintainer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
'/news': ['SayaSS'],
};
54 changes: 54 additions & 0 deletions lib/v2/priconne-redive/news.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');

module.exports = async (ctx) => {
const parseContent = (htmlString) => {
const $ = cheerio.load(htmlString);

$('.contents-body h3').remove();
const time = $('.meta-info .time').text().trim();
$('.meta-info').remove();
const content = $('.contents-body');

return {
description: content.html(),
pubDate: new Date(time),
};
};

const response = await got({
method: 'get',
url: 'https://priconne-redive.jp/news/',
});
const data = response.data;
const $ = cheerio.load(data);
const list = $('.article_box');

const out = await Promise.all(
list.map((index, item) => {
item = $(item);
const link = item.find('a').first().attr('href');
return ctx.cache.tryGet(link, async () => {
const rssitem = {
title: item.find('h4').text(),
link,
};

const response = await got(link);
const result = parseContent(response.data);

rssitem.description = result.description;
rssitem.pubDate = result.pubDate;

return rssitem;
});
})
);

ctx.state.data = {
title: '公主链接日服-新闻',
link: 'https://priconne-redive.jp/news/',
language: 'ja',
item: out,
};
};
13 changes: 13 additions & 0 deletions lib/v2/priconne-redive/radar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
'priconne-redive.jp': {
_name: 'プリンセスコネクト!Re:Dive',
'.': [
{
title: 'News',
docs: 'https://docs.rsshub.app/routes/game#princess-connect-re-dive-%E3%83%97%E3%83%AA%E3%83%B3%E3%82%BB%E3%82%B9%E3%82%B3%E3%83%8D%E3%82%AF%E3%83%88%EF%BC%81re-dive',
source: ['/news'],
target: '/priconne-redive/news',
},
],
},
};
3 changes: 3 additions & 0 deletions lib/v2/priconne-redive/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = (router) => {
router.get('/news', require('./news'));
};
2 changes: 1 addition & 1 deletion website/docs/.format/rsshub-heading-id.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { pinyin } from 'pinyin-pro';
import { visitParents } from 'unist-util-visit-parents';

const slugify = (/** @type {string} */ s) => {
s = s?.replace(/[#&'()+,./:[\]_|’“”、「」・().:|]/g, '-');
s = s?.replace(/[!"#&'()+,./:[\]_|’“”、「」・().:|]/g, '-');
return encodeURIComponent(
pinyin(s, {
nonZh: 'consecutive',
Expand Down
2 changes: 1 addition & 1 deletion website/docs/routes/anime.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@

## lovelive-anime {#lovelive-anime}

### Love Live! Official Website Latest NEWS {#lovelive-anime-love-live!-official-website-latest-news}
### Love Live! Official Website Latest NEWS {#lovelive-anime-love-live-official-website-latest-news}

<Route author="axojhf" example="/lovelive-anime/news" path="/lovelive-anime/news/:option?" paramsDesc={['Crawl full text when `option` is `detail`.']} radar="1" />

Expand Down
44 changes: 22 additions & 22 deletions website/docs/routes/game.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -431,9 +431,9 @@

<Route author="hoilc" example="/nintendo/system-update" path="/nintendo/system-update" />

## osu! {#osu!}
## osu! {#osu}

### Beatmap Packs {#osu!-beatmap-packs}
### Beatmap Packs {#osu-beatmap-packs}

<Route author="JimenezLi" example="/osu/packs" path="/osu/packs/:type?" paramsDesc={['pack type, default to `standard`, can choose from `featured`, `tournament`, `loved`, `chart`, `theme` and `artist`']} radar="1" />

Expand All @@ -447,13 +447,27 @@

<Route author="justjustCC" example="/ps/monthly-games" path="/ps/monthly-games" />

## psnine {#psnine}
## PRINCESS CONNECT! Re Dive プリンセスコネクト!Re Dive {#princess-connect-re-dive-%E3%83%97%E3%83%AA%E3%83%B3%E3%82%BB%E3%82%B9%E3%82%B3%E3%83%8D%E3%82%AF%E3%83%88%EF%BC%81re-dive}

### 首页 - 白金攻略 / 游戏开箱 {#psnine-shou-ye-bai-jin-gong-lve-you-xi-kai-xiang}
### 日服公告 {#princess-connect-re-dive-%E3%83%97%E3%83%AA%E3%83%B3%E3%82%BB%E3%82%B9%E3%82%B3%E3%83%8D%E3%82%AF%E3%83%88%EF%BC%81re-dive-ri-fu-gong-gao}

<Route author="SayaSS" example="/priconne-redive/news" path="/priconne-redive/news" radar="1" />

### 台服公告 {#princess-connect-re-dive-%E3%83%97%E3%83%AA%E3%83%B3%E3%82%BB%E3%82%B9%E3%82%B3%E3%83%8D%E3%82%AF%E3%83%88%EF%BC%81re-dive-tai-fu-gong-gao}

<Route author="hoilc" example="/pcr/news-tw" path="/pcr/news-tw" />

### 国服公告 {#princess-connect-re-dive-%E3%83%97%E3%83%AA%E3%83%B3%E3%82%BB%E3%82%B9%E3%82%B3%E3%83%8D%E3%82%AF%E3%83%88%EF%BC%81re-dive-guo-fu-gong-gao}

<Route author="KotoriK" example="/pcr/news-cn" path="/pcr/news-cn" />

## PSN 中文站 {#psn-zhong-wen-zhan}

### 首页 - 白金攻略 / 游戏开箱 {#psn-zhong-wen-zhan-shou-ye-bai-jin-gong-lve-you-xi-kai-xiang}

<Route author="LightStrawberry" example="/psnine/index" path="/psnine/index" />

### 节点 {#psnine-jie-dian}
### 节点 {#psn-zhong-wen-zhan-jie-dian}

<Route author="nczitzk" example="/psnine/node/news" path="/psnine/node/:id?/:order?" paramsDesc={['节点 id,见下表,默认为 news', '排序,可选 `date` 即最新,默认为 `obdate` 即综合排序']}>
| 站务 | 活动 | 旅记 | 折扣 | 会免 |
Expand All @@ -473,15 +487,15 @@
| famitsu | ign | ucg |
</Route>

### 数折 - 折扣信息推送 {#psnine-shu-zhe-zhe-kou-xin-xi-tui-song}
### 数折 - 折扣信息推送 {#psn-zhong-wen-zhan-shu-zhe-zhe-kou-xin-xi-tui-song}

<Route author="LightStrawberry" example="/psnine/shuzhe" path="/psnine/shuzhe" />

### 闲游 - 二手盘信息 {#psnine-xian-you-er-shou-pan-xin-xi}
### 闲游 - 二手盘信息 {#psn-zhong-wen-zhan-xian-you-er-shou-pan-xin-xi}

<Route author="LightStrawberry" example="/psnine/trade" path="/psnine/trade" />

### 游戏 - 新游戏奖杯信息 {#psnine-you-xi-xin-you-xi-jiang-bei-xin-xi}
### 游戏 - 新游戏奖杯信息 {#psn-zhong-wen-zhan-you-xi-xin-you-xi-jiang-bei-xin-xi}

<Route author="LightStrawberry" example="/psnine/game" path="/psnine/game" />

Expand Down Expand Up @@ -640,20 +654,6 @@ Due to the regional restrictions, an RSSHub deployment in China Mainland may not

<Route author="wushijishan" example="/diershoubing/news" path="/diershoubing/news" />

## 公主链接 {#gong-zhu-lian-jie}

### 日服公告 {#gong-zhu-lian-jie-ri-fu-gong-gao}

<Route author="SayaSS" example="/pcr/news" path="/pcr/news" />

### 台服公告 {#gong-zhu-lian-jie-tai-fu-gong-gao}

<Route author="hoilc" example="/pcr/news-tw" path="/pcr/news-tw" />

### 国服公告 {#gong-zhu-lian-jie-guo-fu-gong-gao}

<Route author="KotoriK" example="/pcr/news-cn" path="/pcr/news-cn" />

## 怪物猎人世界 {#guai-wu-lie-ren-shi-jie}

### 更新情报 {#guai-wu-lie-ren-shi-jie-geng-xin-qing-bao}
Expand Down

0 comments on commit 4c3e3e7

Please sign in to comment.