diff --git a/lib/routes/society/current.ts b/lib/routes/shu/society.ts similarity index 71% rename from lib/routes/society/current.ts rename to lib/routes/shu/society.ts index 0c3ec0ed23ad5c..6da04f7760ad8d 100644 --- a/lib/routes/society/current.ts +++ b/lib/routes/shu/society.ts @@ -1,11 +1,12 @@ import { Route } from '@/types'; import got from '@/utils/got'; import { load } from 'cheerio'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { - path: '/current', + path: '/journals/society/current', categories: ['journal'], - example: '/current', + example: '/journals/society/current', features: { requireConfig: false, requirePuppeteer: false, @@ -14,16 +15,22 @@ export const route: Route = { supportPodcast: false, supportScihub: false, }, - name: '《社会》期刊当期目录', + name: '《社会》杂志当期目录', maintainers: ['CNYoki'], handler, }; async function handler() { - const url = `https://www.society.shu.edu.cn/CN/1004-8804/current.shtml`; + const url = 'https://www.society.shu.edu.cn/CN/1004-8804/current.shtml'; const response = await got(url); const $ = load(response.body); + // 提取刊出日期 + const pubDateText = $('.dqtab .njq') + .text() + .match(/刊出日期:(\d{4}-\d{2}-\d{2})/); + const pubDate = pubDateText ? parseDate(pubDateText[1]) : null; + const items = $('.wenzhanglanmu') .nextAll('.noselectrow') .toArray() @@ -32,7 +39,6 @@ async function handler() { const titles = $item.find('.biaoti').text().trim(); const links = $item.find('.biaoti').attr('href'); const authors = $item.find('.zuozhe').text().trim(); - const date = $item.find('.kmnjq').text().trim(); const abstract = $item.find('div[id^="Abstract"]').text().trim(); if (titles && links) { @@ -41,7 +47,7 @@ async function handler() { link: links, description: abstract, author: authors, - date, + pubDate, }; } return null; @@ -49,7 +55,7 @@ async function handler() { .filter((item) => item !== null); return { - title: `《社会》期刊当期目录`, + title: '《社会》当期目录', link: url, item: items, }; diff --git a/lib/routes/society/namespace.ts b/lib/routes/society/namespace.ts deleted file mode 100644 index 5bb67020e8ada4..00000000000000 --- a/lib/routes/society/namespace.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { Namespace } from '@/types'; - -export const namespace: Namespace = { - name: '《社会》期刊', - url: 'www.society.shu.edu.cn', - description: '《社会》期刊当期目录', - lang: 'zh-CN', - zh: { - name: '《社会》期刊', - }, -};