linke-sdufe 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/adapter.js +28 -1
- package/src/parsers.js +19 -5
package/package.json
CHANGED
package/src/adapter.js
CHANGED
|
@@ -109,6 +109,33 @@ export const PORTAL_PAGES = {
|
|
|
109
109
|
xqbc: { name: '校车班线', url: 'https://www.sdufe.edu.cn/xyfw/xqbc.htm' },
|
|
110
110
|
xydh: { name: '校园电话', url: 'https://www.sdufe.edu.cn/xyfw/xydh.htm' },
|
|
111
111
|
zxxl: { name: '校历', url: 'https://www.sdufe.edu.cn/xyfw/zxxl.htm' },
|
|
112
|
+
// T47 学院简介/领导页(16 站 24 key,照单注册清单 docs/plan/crawl/t47-page-key-registry.md
|
|
113
|
+
// ——地图 v9+批次 8 全量遍历双向验证;命名 {学院缩写}-xyjj=学院简介 / -ldr=学院领导)。
|
|
114
|
+
// 领导页为表格版式(姓名/职务/分工三列)无标准博达容器,走 parsePortalPage body 兜底。
|
|
115
|
+
'gkgc-xyjj': { name: '管理科学与工程学院简介', url: 'https://gkgc.sdufe.edu.cn/xygk/xyjj.htm' },
|
|
116
|
+
'gkgc-ldr': { name: '管理科学与工程学院领导', url: 'https://gkgc.sdufe.edu.cn/xygk/xyld.htm' },
|
|
117
|
+
'cs-xyjj': { name: '计算机与人工智能学院简介', url: 'https://cs.sdufe.edu.cn/xygk/xyjj.htm' },
|
|
118
|
+
'cs-ldr': { name: '计算机与人工智能学院领导', url: 'https://cs.sdufe.edu.cn/xygk/xyld.htm' },
|
|
119
|
+
'spft-xyjj': { name: '财政税务学院简介', url: 'https://spft.sdufe.edu.cn/xygk/xyjj.htm' },
|
|
120
|
+
'spft-ldr': { name: '财政税务学院领导', url: 'https://spft.sdufe.edu.cn/xygk/xyld.htm' },
|
|
121
|
+
'sie-xyjj': { name: '国际教育学院简介', url: 'https://sie.sdufe.edu.cn/xygk/xyjj.htm' },
|
|
122
|
+
'sie-ldr': { name: '国际教育学院领导', url: 'https://sie.sdufe.edu.cn/xygk/xyld.htm' },
|
|
123
|
+
'ys-xyjj': { name: '燕山学院简介', url: 'https://ys.sdufe.edu.cn/xygk/xyjj.htm' },
|
|
124
|
+
'ys-ldr': { name: '燕山学院领导', url: 'https://ys.sdufe.edu.cn/xygk/xyld.htm' },
|
|
125
|
+
'insurance-xyjj': { name: '保险学院简介', url: 'https://insurance.sdufe.edu.cn/xygk/xyjj.htm' },
|
|
126
|
+
'insurance-ldr': { name: '保险学院领导', url: 'https://insurance.sdufe.edu.cn/xygk/xrld.htm' },
|
|
127
|
+
'jinrong-xyjj': { name: '金融学院简介', url: 'https://jinrong.sdufe.edu.cn/xygk.htm' },
|
|
128
|
+
'jinrong-ldr': { name: '金融学院领导', url: 'https://jinrong.sdufe.edu.cn/xygk/xrld.htm' },
|
|
129
|
+
'marx-xyjj': { name: '马克思主义学院简介', url: 'https://marx.sdufe.edu.cn/index/xygk/xyjj.htm' },
|
|
130
|
+
'marx-ldr': { name: '马克思主义学院领导', url: 'https://marx.sdufe.edu.cn/index/xygk/xrld.htm' },
|
|
131
|
+
'sam-ldr': { name: '统计与数学学院领导', url: 'https://sam.sdufe.edu.cn/xygk/xrld.htm' },
|
|
132
|
+
'bcf-ldr': { name: '区块链金融实验室领导', url: 'https://bcf.sdufe.edu.cn/sysgk1/xrld.htm' },
|
|
133
|
+
'mpa-ldr': { name: 'MPA中心领导', url: 'https://mpa.sdufe.edu.cn/zxgk/xrld.htm' },
|
|
134
|
+
'law-xyjj': { name: '法学院简介', url: 'https://law.sdufe.edu.cn/xygk1/xyjj.htm' },
|
|
135
|
+
'gsglxy-xyjj': { name: '工商管理学院简介', url: 'https://gsglxy.sdufe.edu.cn/xygk1/xyjj.htm' },
|
|
136
|
+
'sce-xyjj': { name: '继续教育学院简介', url: 'https://sce.sdufe.edu.cn/xygk1/xyjj.htm' },
|
|
137
|
+
'site-xyjj': { name: '国际经贸学院简介', url: 'https://site.sdufe.edu.cn/xygk1/xyjj.htm' },
|
|
138
|
+
'mba-xyjj': { name: 'MBA学院简介', url: 'https://mba.sdufe.edu.cn/xygk/xyjj.htm' },
|
|
112
139
|
}
|
|
113
140
|
|
|
114
141
|
/** 课程属性中文名 → zzdKcSX 表单码(强智 kbxx_kc_ifr 口径) */
|
|
@@ -517,7 +544,7 @@ export function createSdufeAdapter(env) {
|
|
|
517
544
|
if (!page) {
|
|
518
545
|
throw new LinkeError('BAD_PAGE', `未知具名页面:${pageKey}(可选:${Object.keys(PORTAL_PAGES).join('/')})`, {
|
|
519
546
|
exitCode: EXIT.GENERAL,
|
|
520
|
-
hint: 'xxjj=学校简介 / xrld=现任领导 / zuzjg=组织机构 / xqbc=校车班线 / xydh=校园电话 / zxxl
|
|
547
|
+
hint: '学校级:xxjj=学校简介 / xrld=现任领导 / zuzjg=组织机构 / xqbc=校车班线 / xydh=校园电话 / zxxl=校历;学院级(T47):{学院缩写}-xyjj=学院简介 / {学院缩写}-ldr=学院领导(如 gkgc-ldr=管科学院领导)',
|
|
521
548
|
})
|
|
522
549
|
}
|
|
523
550
|
let response
|
package/src/parsers.js
CHANGED
|
@@ -995,7 +995,8 @@ export function parsePortalNoticeDetail(html, pageUrl = '') {
|
|
|
995
995
|
}
|
|
996
996
|
|
|
997
997
|
/** 校园官网明面具名页面解析(T46 续四):容器链兜底——v_news_content →
|
|
998
|
-
* #vsb_content
|
|
998
|
+
* #vsb_content(含序号后缀族,取最外层;T47 学院站实勘)→ .wp_articlecontent /
|
|
999
|
+
* .c_content → body 主文本(学校概况类页面非标准博达
|
|
999
1000
|
* 文章容器,逐页实勘判例:xxjj 学校简介/xrld 现任领导/xydh 校园电话等)。
|
|
1000
1001
|
* 同时提取页面内 info 文章链接清单(如现任领导页→每位领导详情页),
|
|
1001
1002
|
* 供「列表→详情」动线延续。找不到任何容器时回退 body 去头尾。 */
|
|
@@ -1004,12 +1005,25 @@ export function parsePortalPage(html, pageUrl = '') {
|
|
|
1004
1005
|
let inner = null
|
|
1005
1006
|
// 1. 标准博达容器优先(复用详情提取:v_news_content 含空壳跳过逻辑)
|
|
1006
1007
|
inner = extractVNewsContent(html)
|
|
1007
|
-
// 2. vsb_content / c_content 容器(单次 div
|
|
1008
|
+
// 2. vsb_content / wp_articlecontent / c_content 容器(单次 div 平衡)。
|
|
1009
|
+
// T47:学院站 vsb_content 常带序号后缀(vsb_content_4、vsb_content_2…),
|
|
1010
|
+
// 且内层 u 系 div 的 id 也以 vsb_content 开头——取 id 最短者=最外层容器
|
|
1011
|
+
// (law/sce/site/gsglxy/mba 实勘),不再只认精确 id="vsb_content"。
|
|
1008
1012
|
if (!inner) {
|
|
1009
|
-
|
|
1013
|
+
const candidates = []
|
|
1014
|
+
const vsbRe = /id="(vsb_content[^"]*)"/gi
|
|
1015
|
+
let vm
|
|
1016
|
+
let vsbBest = null
|
|
1017
|
+
while ((vm = vsbRe.exec(html))) {
|
|
1018
|
+
if (!vsbBest || vm[1].length < vsbBest[1].length) vsbBest = vm
|
|
1019
|
+
}
|
|
1020
|
+
if (vsbBest) candidates.push(vsbBest.index)
|
|
1021
|
+
for (const marker of [/class="[^"]*wp_articlecontent[^"]*"/i, /class="[^"]*c_content[^"]*"/i]) {
|
|
1010
1022
|
const om = html.match(marker)
|
|
1011
|
-
if (
|
|
1012
|
-
|
|
1023
|
+
if (om) candidates.push(om.index)
|
|
1024
|
+
}
|
|
1025
|
+
for (const idx of candidates) {
|
|
1026
|
+
const openTag = html.lastIndexOf('<div', idx)
|
|
1013
1027
|
if (openTag === -1) continue
|
|
1014
1028
|
const openEnd = html.indexOf('>', openTag)
|
|
1015
1029
|
if (openEnd === -1) continue
|