diff --git a/docs/en/other.md b/docs/en/other.md index d4bb7380613b6e..19761b54c63b13 100644 --- a/docs/en/other.md +++ b/docs/en/other.md @@ -6,6 +6,8 @@ pageClass: routes ## 591 Rental house +### Rental house + ::: tip Tip diff --git a/docs/other.md b/docs/other.md index f212936ddf88d7..b6727667c16702 100644 --- a/docs/other.md +++ b/docs/other.md @@ -20,6 +20,8 @@ pageClass: routes ## 591 租屋網 +### 租屋 + ::: tip 提示 diff --git a/docs/university.md b/docs/university.md index c19ac41357f08b..431fa6127a4b78 100644 --- a/docs/university.md +++ b/docs/university.md @@ -1274,13 +1274,13 @@ category 列表: ## 哈尔滨工业大学(深圳) -### 哈尔滨工业大学(深圳) - 新闻中心 +### 新闻中心 - + -| 校区要闻 | 媒体报道 | 通知公告 | 综合新闻 | 校园动态 | 讲座论坛 | 热点专题 | -| ------ | ----- | ----- | ----- | ----- | ----- | ----- | -| id-116 | id-80 | id-74 | id-75 | id-77 | id-78 | id-79 | +| 校区要闻 | 媒体报道 | 综合新闻 | 校园动态 | 讲座论坛 | 热点专题 | 招标信息 | 重要关注 | +| ------ | ----- | ----- | ----- | ----- | ----- | ----- | ------ | +| id-116 | id-80 | id-75 | id-77 | id-78 | id-79 | id-81 | id-124 | diff --git a/lib/router.js b/lib/router.js index 0641a8b143c41d..36c893fc5bed60 100644 --- a/lib/router.js +++ b/lib/router.js @@ -531,7 +531,7 @@ router.get('/hhu/libNewsc', lazyloadRouteHandler('./routes/universities/hhu/libN // router.get('/hit/today/:category', lazyloadRouteHandler('./routes/universities/hit/today')); // 哈尔滨工业大学(深圳) -router.get('/hitsz/article/:category?', lazyloadRouteHandler('./routes/universities/hitsz/article')); +// router.get('/hitsz/article/:category?', lazyloadRouteHandler('./routes/universities/hitsz/article')); // 哈尔滨工业大学(威海) // router.get('/hitwh/today', lazyloadRouteHandler('./routes/universities/hitwh/today')); diff --git a/lib/routes/universities/hitsz/article.js b/lib/v2/hitsz/article.js similarity index 54% rename from lib/routes/universities/hitsz/article.js rename to lib/v2/hitsz/article.js index 5f7e30750e63a2..dd770d30bccb5f 100644 --- a/lib/routes/universities/hitsz/article.js +++ b/lib/v2/hitsz/article.js @@ -1,34 +1,32 @@ const got = require('@/utils/got'); const cheerio = require('cheerio'); +const { parseDate } = require('@/utils/parse-date'); +const timezone = require('@/utils/timezone'); module.exports = async (ctx) => { - const host = 'http://www.hitsz.edu.cn'; - const category = ctx.params.category || 'id-74'; + const host = 'https://www.hitsz.edu.cn'; + const category = ctx.params.category ?? 'id-77'; + const link = `${host}/article/${category}.html`; - const response = await got.get(`${host}/article/${category}.html`); + const response = await got(link); const $ = cheerio.load(response.data); const category_name = $('div.title_page').text().trim(); const lists = $('.mainside_news ul li') - .map((_, el) => ({ + .toArray() + .map((el) => ({ title: $('a', el).text().trim(), link: `${host}${$('a', el).attr('href')}`, - pubDate: new Date($('span[class=date]', el).text()).toUTCString(), - })) - .get(); + pubDate: timezone(parseDate($('span[class=date]', el).text()), 8), + })); const items = await Promise.all( lists.map((item) => ctx.cache.tryGet(item.link, async () => { const response = await got.get(item.link); const $ = cheerio.load(response.data); - item.description = - $('div.detail').html() && - $('div.detail') - .html() - .replace(/src="\//g, `src="${new URL('.', host).toString()}"`) - .replace(/href="\//g, `href="${new URL('.', host).toString()}"`) - .trim(); + item.description = $('div.edittext').html().trim(); + item.pubDate = timezone(parseDate($('.item').first().text().replace('发布时间:', '')), 8); return item; }) ) @@ -36,7 +34,7 @@ module.exports = async (ctx) => { ctx.state.data = { title: '哈尔滨工业大学(深圳)-' + category_name, - link: `${host}/article/${category}.html`, + link, description: '哈尔滨工业大学(深圳)-' + category_name, item: items, }; diff --git a/lib/v2/hitsz/maintainer.js b/lib/v2/hitsz/maintainer.js new file mode 100644 index 00000000000000..a6d59e9c44b319 --- /dev/null +++ b/lib/v2/hitsz/maintainer.js @@ -0,0 +1,3 @@ +module.exports = { + '/article/:category?': ['xandery-geek'], +}; diff --git a/lib/v2/hitsz/radar.js b/lib/v2/hitsz/radar.js new file mode 100644 index 00000000000000..f7b82eb4d3f5be --- /dev/null +++ b/lib/v2/hitsz/radar.js @@ -0,0 +1,13 @@ +module.exports = { + 'hitsz.edu.cn': { + _name: '哈尔滨工业大学(深圳)', + '.': [ + { + title: '新闻中心', + docs: 'https://docs.rsshub.app/university.html#ha-er-bin-gong-ye-da-xue-shen-zhen', + source: ['/article/:category?', '/subject/:category?'], + target: (params) => `/hitsz/article/${params.category.replace('.html', '')}`, + }, + ], + }, +}; diff --git a/lib/v2/hitsz/router.js b/lib/v2/hitsz/router.js new file mode 100644 index 00000000000000..f66c30589b3bad --- /dev/null +++ b/lib/v2/hitsz/router.js @@ -0,0 +1,3 @@ +module.exports = (router) => { + router.get('/article/:category?', require('./article')); +}; diff --git a/package.json b/package.json index e15d0cd3baa283..8b1fc275190243 100644 --- a/package.json +++ b/package.json @@ -91,7 +91,7 @@ "dependencies": { "@koa/router": "12.0.0", "@postlight/parser": "2.2.3", - "@sentry/node": "7.37.1", + "@sentry/node": "7.37.2", "aes-js": "3.1.2", "art-template": "4.13.2", "bbcodejs": "0.0.4", @@ -112,7 +112,7 @@ "https-proxy-agent": "5.0.1", "iconv-lite": "0.6.3", "instagram-private-api": "1.45.3", - "ioredis": "5.3.0", + "ioredis": "5.3.1", "ip-regex": "4.3.0", "is-localhost-ip": "2.0.0", "jsdom": "21.1.0", @@ -135,7 +135,7 @@ "puppeteer-extra": "3.3.4", "puppeteer-extra-plugin-stealth": "2.11.1", "query-string": "7.1.3", - "rand-user-agent": "1.0.104", + "rand-user-agent": "1.0.105", "re2": "1.18.0", "require-all": "3.0.0", "rss-parser": "3.12.0", diff --git a/yarn.lock b/yarn.lock index a361783e4baa17..28c9dc3d306371 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1557,39 +1557,39 @@ domhandler "^5.0.3" selderee "^0.10.0" -"@sentry/core@7.37.1": - version "7.37.1" - resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.37.1.tgz#6d8d151b3d6ae0d6f81c7f4da92cd2e7cb5bf1fa" - integrity sha512-eS5hoFDjAOl7POZg6K77J0oiypiqR1782oVSB49UkjK+D8tCZzZ5PxPMv0b/O0310p7x4oZ3WGRJaWEN3vY4KQ== +"@sentry/core@7.37.2": + version "7.37.2" + resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.37.2.tgz#959b2bf953f442b07f8377d90f4f7735cf260ae4" + integrity sha512-LjofMDSTyVeBErl9N7TTqlyEVuW1g6U4iuJtdZ75JohnvVxzWdpZfWfddwQ6h7nGWfe9dNg0fGs1wxKtMhY+MA== dependencies: - "@sentry/types" "7.37.1" - "@sentry/utils" "7.37.1" + "@sentry/types" "7.37.2" + "@sentry/utils" "7.37.2" tslib "^1.9.3" -"@sentry/node@7.37.1": - version "7.37.1" - resolved "https://registry.yarnpkg.com/@sentry/node/-/node-7.37.1.tgz#c234e8711090b7532358bb1d6ab3fcca75356e98" - integrity sha512-nGerngIo5JwinJgl7m0SaL/xI+YRBlhb53gbkuLSAAcnoitBFzbp7LjywsqYFTWuWDIyk7O2t124GNxtolBAgA== +"@sentry/node@7.37.2": + version "7.37.2" + resolved "https://registry.yarnpkg.com/@sentry/node/-/node-7.37.2.tgz#7ce3b09c93112afca0eef0fd65ec87ea1cd1b7d2" + integrity sha512-aeJQ4oU3vF9zks8S/fvoLPVVhofmTjyMhZZIpSQWtfFqWxrXQsrqNlNUZZdXoqAUPNjA4QAzzOoXHhpUsa3Nxw== dependencies: - "@sentry/core" "7.37.1" - "@sentry/types" "7.37.1" - "@sentry/utils" "7.37.1" + "@sentry/core" "7.37.2" + "@sentry/types" "7.37.2" + "@sentry/utils" "7.37.2" cookie "^0.4.1" https-proxy-agent "^5.0.0" lru_map "^0.3.3" tslib "^1.9.3" -"@sentry/types@7.37.1": - version "7.37.1" - resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.37.1.tgz#269da7da39c1a5243bf5f9a35370291b5cc205bb" - integrity sha512-c2HWyWSgVA0V4+DSW2qVb0yjftrb1X/q2CzCom+ayjGHO72qyWC+9Tc+7ZfotU1mapRjqUWBgkXkbGmao8N8Ug== +"@sentry/types@7.37.2": + version "7.37.2" + resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.37.2.tgz#99fd76230d7c1d3c6901ed4c0bea35be7d6fe26d" + integrity sha512-SxKQOCX94ZaQM4C2ysNjHdJsjYapu/NYZCz1cnPyCdDvYfhwiVge1uq6ZHiQ/ARfxAAOmc3R4Mh3VvEz7WUOdw== -"@sentry/utils@7.37.1": - version "7.37.1" - resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.37.1.tgz#7695d6e30d6178723f3fa446a9553893bca85e96" - integrity sha512-/4mJOyDsfysx+5TXyJgSI+Ihw2/0EVJbrHjCyXPDXW5ADwbtU8VdBZ0unOmF0hk4QfftqwM9cyEu3BN4iBJsEA== +"@sentry/utils@7.37.2": + version "7.37.2" + resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.37.2.tgz#14dea644454e3df247fb113fc834f509c1f0e48c" + integrity sha512-5irN1nN/mtdOoWwsJiwBK0gPgNMkciUubEMbCaaXqJaGyGz8+yfDvXj7L+xGYiU57z+7+QkkSKxKEZ/IcBpjVQ== dependencies: - "@sentry/types" "7.37.1" + "@sentry/types" "7.37.2" tslib "^1.9.3" "@sinclair/typebox@^0.25.16": @@ -7613,10 +7613,10 @@ interpret@^1.0.0: resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.4.0.tgz#665ab8bc4da27a774a40584e812e3e0fa45b1a1e" integrity sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA== -ioredis@5.3.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/ioredis/-/ioredis-5.3.0.tgz#b5469f0fd374648ef074840c00c1d8eed42fca3f" - integrity sha512-Id9jKHhsILuIZpHc61QkagfVdUj2Rag5GzG1TGEvRNeM7dtTOjICgjC+tvqYxi//PuX2wjQ+Xjva2ONBuf92Pw== +ioredis@5.3.1: + version "5.3.1" + resolved "https://registry.yarnpkg.com/ioredis/-/ioredis-5.3.1.tgz#55d394a51258cee3af9e96c21c863b1a97bf951f" + integrity sha512-C+IBcMysM6v52pTLItYMeV4Hz7uriGtoJdz7SSBDX6u+zwSYGirLdQh3L7t/OItWITcw3gTFMjJReYUwS4zihg== dependencies: "@ioredis/commands" "^1.1.1" cluster-key-slot "^1.1.0" @@ -11667,10 +11667,10 @@ ramda@^0.26.1: resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.26.1.tgz#8d41351eb8111c55353617fc3bbffad8e4d35d06" integrity sha512-hLWjpy7EnsDBb0p+Z3B7rPi3GDeRG5ZtiI33kJhTt+ORCd38AbAIjB/9zRIUoeTbE/AVX5ZkU7m6bznsvrf8eQ== -rand-user-agent@1.0.104: - version "1.0.104" - resolved "https://registry.yarnpkg.com/rand-user-agent/-/rand-user-agent-1.0.104.tgz#c2fbae69f458637a0e93c127239366aacdc5e3e2" - integrity sha512-iYQIzNbTFZxz4/ygG0dBpWt1PyZhqOIMfXIFQ4e8B6Uml1BZ/za1v6GRv1wGcnTHwiCGTx+NvxgFe25qSNBAWQ== +rand-user-agent@1.0.105: + version "1.0.105" + resolved "https://registry.yarnpkg.com/rand-user-agent/-/rand-user-agent-1.0.105.tgz#d4e171ebd6e8967c04b4db10fd701a6341a99b6c" + integrity sha512-fNIvgkrJ7bTU2P/fGVTOMFPxFLePK+erbwHu86PR889eXx+KJZolMylTAQEvYHCLP8tDN2T7W1foCV7ZRv2PxQ== randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5, randombytes@^2.1.0: version "2.1.0"