@@ -5,21 +5,13 @@ import { load } from 'cheerio';
5
5
import { parseDate } from '@/utils/parse-date' ;
6
6
7
7
const url = 'http://en.shisu.edu.cn' ;
8
- const url_backup = 'https://en.shisu.edu.cn' ;
8
+ const urlBackup = 'https://en.shisu.edu.cn' ;
9
9
10
10
export const route : Route = {
11
11
path : '/en/:section' ,
12
12
categories : [ 'university' ] ,
13
13
example : '/shisu/en/news' ,
14
14
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
- } ,
23
15
radar : [
24
16
{
25
17
source : [ 'en.shisu.edu.cn/resources/:section/' ] ,
@@ -30,7 +22,7 @@ export const route: Route = {
30
22
maintainers : [ 'Duuckjing' ] ,
31
23
handler,
32
24
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.` ,
34
26
} ;
35
27
36
28
async function process ( baseUrl : string , section : any ) {
@@ -56,14 +48,15 @@ async function process(baseUrl: string, section: any) {
56
48
const $ = load ( r ) ;
57
49
j . description = $ ( '.details-con' )
58
50
. html ( ) !
59
- . replaceAll ( / < o : p > [ \S \s ] * ?< \/ o : p > / g, '' ) ;
51
+ . replaceAll ( / < o : p > [ \S \s ] * ?< \/ o : p > / g, '' )
52
+ . replaceAll ( / ( < p [ ^ > ] * > & n b s p ; < \/ p > \s * ) + / gm, '<p> </p>' ) ;
60
53
return j ;
61
54
} )
62
55
)
63
56
) ;
64
57
return {
65
- title : ' FEATURED STORIES',
66
- link : `${ url } /resources/features /` ,
58
+ title : String ( section ) === 'features' ? ' FEATURED STORIES' : 'SISU TODAY ',
59
+ link : `${ url } /resources/${ section } /` ,
67
60
item : items ,
68
61
} ;
69
62
}
@@ -75,8 +68,8 @@ async function handler(ctx) {
75
68
await ofetch ( url ) ;
76
69
res = process ( url , section ) ;
77
70
} catch {
78
- await ofetch ( url_backup ) ;
79
- res = process ( url_backup , section ) ;
71
+ await ofetch ( urlBackup ) ;
72
+ res = process ( urlBackup , section ) ;
80
73
}
81
74
return res ;
82
75
}
0 commit comments