Skip to content

Commit 0070434

Browse files
committed
modified en.ts and news.ts
1 parent a4f76f5 commit 0070434

File tree

2 files changed

+11
-18
lines changed

2 files changed

+11
-18
lines changed

lib/routes/shisu/en.ts

+8-15
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,13 @@ import { load } from 'cheerio';
55
import { parseDate } from '@/utils/parse-date';
66

77
const url = 'http://en.shisu.edu.cn';
8-
const url_backup = 'https://en.shisu.edu.cn';
8+
const urlBackup = 'https://en.shisu.edu.cn';
99

1010
export const route: Route = {
1111
path: '/en/:section',
1212
categories: ['university'],
1313
example: '/shisu/en/news',
1414
parameters: { section: 'The name of resources' },
15-
features: {
16-
requireConfig: false,
17-
requirePuppeteer: false,
18-
antiCrawler: false,
19-
supportBT: false,
20-
supportPodcast: false,
21-
supportScihub: false,
22-
},
2315
radar: [
2416
{
2517
source: ['en.shisu.edu.cn/resources/:section/'],
@@ -30,7 +22,7 @@ export const route: Route = {
3022
maintainers: ['Duuckjing'],
3123
handler,
3224
description: `- features: Read a series of in-depth stories about SISU faculty, students, alumni and beyond campus.
33-
- news: SISU TODAY English site.`,
25+
- news: SISU TODAY English site.`,
3426
};
3527

3628
async function process(baseUrl: string, section: any) {
@@ -56,14 +48,15 @@ async function process(baseUrl: string, section: any) {
5648
const $ = load(r);
5749
j.description = $('.details-con')
5850
.html()!
59-
.replaceAll(/<o:p>[\S\s]*?<\/o:p>/g, '');
51+
.replaceAll(/<o:p>[\S\s]*?<\/o:p>/g, '')
52+
.replaceAll(/(<p[^>]*>&nbsp;<\/p>\s*)+/gm, '<p>&nbsp;</p>');
6053
return j;
6154
})
6255
)
6356
);
6457
return {
65-
title: 'FEATURED STORIES',
66-
link: `${url}/resources/features/`,
58+
title: String(section) === 'features' ? 'FEATURED STORIES' : 'SISU TODAY',
59+
link: `${url}/resources/${section}/`,
6760
item: items,
6861
};
6962
}
@@ -75,8 +68,8 @@ async function handler(ctx) {
7568
await ofetch(url);
7669
res = process(url, section);
7770
} catch {
78-
await ofetch(url_backup);
79-
res = process(url_backup, section);
71+
await ofetch(urlBackup);
72+
res = process(urlBackup, section);
8073
}
8174
return res;
8275
}

lib/routes/shisu/news.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ export const route: Route = {
3030
maintainers: ['Duuckjing'],
3131
handler,
3232
description: `| 首页 | 特稿 | 学术 | 教学 | 国际 | 校园 | 人物 | 视讯 | 公告 |
33-
| ---- | ------- | --------- | ---------- | ------------- | ------ | ------ | ---------- | ------ |
34-
| news | gazette | research- | academics- | international | campus | people | multimedia | notice |`,
33+
| ---- | ------- | --------- | ---------- | ------------- | ------ | ------ | ---------- | ------ |
34+
| news | gazette | research- | academics- | international | campus | people | multimedia | notice |`,
3535
};
3636

3737
async function handler(ctx) {
@@ -84,7 +84,7 @@ async function handler(ctx) {
8484
);
8585

8686
return {
87-
title: `上外新闻|SISU TODAY -${section.charAt(0).toUpperCase() + section.slice(1)}`,
87+
title: `上外新闻|SISU TODAY - ${section.charAt(0).toUpperCase() + section.slice(1)}`,
8888
image: 'https://upload.wikimedia.org/wikipedia/zh/thumb/0/06/Shanghai_International_Studies_University_logo.svg/300px-Shanghai_International_Studies_University_logo.svg.png',
8989
link: `${url}/${section}/index.html`,
9090
item: items,

0 commit comments

Comments
 (0)