feat: v3 migration - 11/n
This commit is contained in:
parent
2092fcec37
commit
df4433789b
|
|
@ -26,4 +26,9 @@ const convertDateToISO8601 = (date?: string | Date | number | null) => {
|
|||
return date.toISOString();
|
||||
};
|
||||
|
||||
export { toTitleCase, collapseWhitespace, convertDateToISO8601 };
|
||||
const getSubPath = (ctx) => {
|
||||
const subPath = ctx.req.path.replace(/\/[^/]*/, '') || '/';
|
||||
return subPath;
|
||||
};
|
||||
|
||||
export { toTitleCase, collapseWhitespace, convertDateToISO8601, getSubPath };
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
|
@ -6,7 +7,7 @@ import * as path from 'node:path';
|
|||
|
||||
module.exports = async (ctx) => {
|
||||
const rootUrl = 'https://www.141jav.com';
|
||||
const currentUrl = `${rootUrl}${ctx.path}`;
|
||||
const currentUrl = `${rootUrl}${getSubPath(ctx)}`;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
|
|
@ -15,7 +16,7 @@ module.exports = async (ctx) => {
|
|||
|
||||
const $ = load(response.data);
|
||||
|
||||
if (ctx.path === '/') {
|
||||
if (getSubPath(ctx) === '/') {
|
||||
ctx.redirect(`/141jav${$('.overview').first().attr('href')}`);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get(/([\w-/]+)?/, './index');
|
||||
router.get('*', './index');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
|
@ -6,7 +7,7 @@ import * as path from 'node:path';
|
|||
|
||||
module.exports = async (ctx) => {
|
||||
const rootUrl = 'https://www.141ppv.com';
|
||||
const currentUrl = `${rootUrl}${ctx.path}`;
|
||||
const currentUrl = `${rootUrl}${getSubPath(ctx)}`;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
|
|
@ -15,7 +16,7 @@ module.exports = async (ctx) => {
|
|||
|
||||
const $ = load(response.data);
|
||||
|
||||
if (ctx.path === '/') {
|
||||
if (getSubPath(ctx) === '/') {
|
||||
ctx.redirect(`/141ppv${$('.overview').first().attr('href')}`);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get(/([\w-/]+)?/, './index');
|
||||
router.get('*', './index');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
|
|
@ -15,7 +16,9 @@ const shortcuts = {
|
|||
};
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const path = ctx.path.replace(/^\/news(?!flashes)/, '/information').replace(/\/search\/article/, '/search/articles');
|
||||
const path = getSubPath(ctx)
|
||||
.replace(/^\/news(?!flashes)/, '/information')
|
||||
.replace(/\/search\/article/, '/search/articles');
|
||||
|
||||
const currentUrl = `${rootUrl}${Object.hasOwn(shortcuts, path) ? shortcuts[path] : path}`;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
module.exports = (router) => {
|
||||
router.get('/hot-list/:category?', './hot-list');
|
||||
router.get(/([\w-/]+)?/, './index');
|
||||
router.get('*', './index');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
|
|
@ -8,7 +9,7 @@ import * as path from 'node:path';
|
|||
|
||||
module.exports = async (ctx) => {
|
||||
const rootUrl = 'https://www.78dm.net';
|
||||
const currentUrl = `${rootUrl}${ctx.path === '/' ? '/news' : /\/\d+$/.test(ctx.path) ? `${ctx.path}.html` : ctx.path}`;
|
||||
const currentUrl = `${rootUrl}${getSubPath(ctx) === '/' ? '/news' : /\/\d+$/.test(getSubPath(ctx)) ? `${getSubPath(ctx)}.html` : getSubPath(ctx)}`;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get(/([\w/-]+)?/, './index');
|
||||
router.get('*', './index');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
|
|
@ -5,7 +6,7 @@ import timezone from '@/utils/timezone';
|
|||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const thePath = ctx.path.replace(/^\/81rc/, '');
|
||||
const thePath = getSubPath(ctx).replace(/^\/81rc/, '');
|
||||
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 30;
|
||||
|
||||
const rootUrl = 'https://81rc.81.cn';
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get(/81rc(\/[\w-/]+)?/, './81rc');
|
||||
router.get('/81rc/*', './81rc');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const path = ctx.path === '/' ? '/realtime' : ctx.path;
|
||||
const path = getSubPath(ctx) === '/' ? '/realtime' : getSubPath(ctx);
|
||||
|
||||
const rootUrl = 'https://www.8world.com';
|
||||
const currentUrl = `${rootUrl}${path}`;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get(/([\w-/]+)?/, './index');
|
||||
router.get('*', './index');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
|
|
@ -21,7 +22,7 @@ const languages = {
|
|||
};
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const params = ctx.path === '/' ? ['arabic'] : ctx.path.replace(/^\//, '').split('/');
|
||||
const params = getSubPath(ctx) === '/' ? ['arabic'] : getSubPath(ctx).replace(/^\//, '').split('/');
|
||||
|
||||
if (!Object.hasOwn(languages, params[0])) {
|
||||
params.unshift('arabic');
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get(/([\w/-]+)?/, './index');
|
||||
router.get('*', './index');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
|
@ -15,7 +16,7 @@ module.exports = async (ctx) => {
|
|||
let currentUrl = rootUrl;
|
||||
let apiUrl = new URL(`${apiSlug}/posts?_embed=true&per_page=${limit}`, rootUrl).href;
|
||||
|
||||
const filterMatches = ctx.path.match(/^\/([^/]*)\/([^/]*)\/(.*)$/);
|
||||
const filterMatches = getSubPath(ctx).match(/^\/([^/]*)\/([^/]*)\/(.*)$/);
|
||||
|
||||
if (filterMatches) {
|
||||
const filterRegion = filterMatches[1];
|
||||
|
|
|
|||
|
|
@ -11,5 +11,5 @@ module.exports = function (router) {
|
|||
const redirectTo = `/aqara/${region}/category/${types[type]}`;
|
||||
ctx.redirect(redirectTo);
|
||||
});
|
||||
router.get(/([\w-/]+)?/, './post');
|
||||
router.get('*', './post');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import timezone from '@/utils/timezone';
|
||||
|
|
@ -5,7 +6,7 @@ import { parseDate } from '@/utils/parse-date';
|
|||
|
||||
module.exports = async (ctx) => {
|
||||
const rootUrl = 'https://bad.news';
|
||||
const currentUrl = `${rootUrl}${ctx.path === '/' ? '' : ctx.path}`;
|
||||
const currentUrl = `${rootUrl}${getSubPath(ctx) === '/' ? '' : getSubPath(ctx)}`;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get(/([\w-/]+)?/, './index');
|
||||
router.get('*', './index');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const isLatest = ctx.path === '/moe';
|
||||
const isLatest = getSubPath(ctx) === '/moe';
|
||||
const rootUrl = 'https://bangumi.moe';
|
||||
|
||||
let response;
|
||||
|
|
@ -20,7 +21,7 @@ module.exports = async (ctx) => {
|
|||
const tagUrl = `${rootUrl}/api/tag/search`;
|
||||
const torrentUrl = `${rootUrl}/api/torrent/search`;
|
||||
|
||||
const params = ctx.path.split('/').slice(2);
|
||||
const params = getSubPath(ctx).split('/').slice(2);
|
||||
|
||||
tag_id = await Promise.all(
|
||||
params.map((param) =>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
module.exports = function (router) {
|
||||
// bangumi.moe
|
||||
router.get(/moe([\w-/]+)?/, './moe/index');
|
||||
router.get('/moe/*', './moe/index');
|
||||
// bangumi.online
|
||||
router.get('/online', './online/online');
|
||||
// bangumi.tv
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
|
|
@ -5,7 +6,7 @@ import timezone from '@/utils/timezone';
|
|||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const colPath = ctx.path.replace(/^\//, '') || '32942';
|
||||
const colPath = getSubPath(ctx).replace(/^\//, '') || '32942';
|
||||
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 50;
|
||||
|
||||
const rootUrl = 'https://www.bast.net.cn';
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get(/([\w-/]+)?/, './index');
|
||||
router.get('*', './index');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
|
|
@ -24,8 +25,8 @@ const allowHost = new Set([
|
|||
]);
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const rootUrl = ctx.path.split('/').slice(1, 4).join('/');
|
||||
const currentUrl = ctx.path.slice(1);
|
||||
const rootUrl = getSubPath(ctx).split('/').slice(1, 4).join('/');
|
||||
const currentUrl = getSubPath(ctx).slice(1);
|
||||
if (!config.feature.allow_user_supply_unsafe_domain && !allowHost.has(new URL(rootUrl).hostname)) {
|
||||
throw new Error(`This RSS is disabled unless 'ALLOW_USER_SUPPLY_UNSAFE_DOMAIN' is set to 'true'.`);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get(/([\w/-]+)?/, './index');
|
||||
router.get('*', './index');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
|
@ -11,10 +12,10 @@ module.exports = async (ctx) => {
|
|||
|
||||
let filterName;
|
||||
|
||||
const currentUrl = new URL(ctx.path.replace(/^\/cbaigui/, ''), rootUrl).href;
|
||||
const currentUrl = new URL(getSubPath(ctx).replace(/^\/cbaigui/, ''), rootUrl).href;
|
||||
let apiUrl = new URL(`${apiSlug}/posts?_embed=true&per_page=${limit}`, rootUrl).href;
|
||||
|
||||
const filterMatches = ctx.path.match(/^\/post-(tag|category)\/(.*)$/);
|
||||
const filterMatches = getSubPath(ctx).match(/^\/post-(tag|category)\/(.*)$/);
|
||||
|
||||
if (filterMatches) {
|
||||
filterName = decodeURI(filterMatches[2].split('/').pop());
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get(/([\w-/]+)?/, './');
|
||||
router.get('*', './');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import timezone from '@/utils/timezone';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const link = `https://www.cnblogs.com${ctx.path}`;
|
||||
const link = `https://www.cnblogs.com${getSubPath(ctx)}`;
|
||||
const response = await got(link);
|
||||
const data = response.data;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
module.exports = function (router) {
|
||||
router.get('/yjxw/:category?', './yjxw');
|
||||
router.get(/\/yjxx([\w-/]+)?/, './yjxx');
|
||||
router.get('/yjxx/*', './yjxx');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import got from '@/utils/got';
|
||||
import timezone from '@/utils/timezone';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
|
@ -5,7 +6,7 @@ import { parseDate } from '@/utils/parse-date';
|
|||
module.exports = async (ctx) => {
|
||||
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 200;
|
||||
|
||||
const options = decodeURI(ctx.path)
|
||||
const options = decodeURI(getSubPath(ctx))
|
||||
.replace(/\/yjxx/, '')
|
||||
.split('/');
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
|
|
@ -5,7 +6,7 @@ import timezone from '@/utils/timezone';
|
|||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const params = ctx.path;
|
||||
const params = getSubPath(ctx);
|
||||
|
||||
const rootUrl = 'https://www.dgjyw.com';
|
||||
const currentUrl = `${rootUrl}${params === '/' ? '/tz' : params}.htm`;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get(/([\w/-]+)?/, './index');
|
||||
router.get('*', './index');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,5 +2,5 @@ module.exports = function (router) {
|
|||
router.get('/campaign/:type/:free?', './campaign');
|
||||
router.get('/ci-en/:id/article', './ci-en/article');
|
||||
router.get('/new/:type', './new');
|
||||
router.get(/([\w-=/]+)?/, './');
|
||||
router.get('*', './');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import timezone from '@/utils/timezone';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
import * as path from 'node:path';
|
||||
const dayjs = require('dayjs');
|
||||
|
||||
const rootUrl = 'https://www.dlsite.com';
|
||||
|
|
@ -45,11 +45,11 @@ const getDetails = async (works) => {
|
|||
const ProcessItems = async (ctx) => {
|
||||
art.defaults.imports.formatDate = formatDate;
|
||||
|
||||
ctx.path = ctx.path === '/' ? '/home/new' : ctx.path;
|
||||
const path = getSubPath(ctx) === '/' ? '/home/new' : getSubPath(ctx);
|
||||
|
||||
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 100;
|
||||
|
||||
const currentUrl = `${rootUrl}${addFilters(ctx.path, defaultFilters)}`;
|
||||
const currentUrl = `${rootUrl}${addFilters(path, defaultFilters)}`;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
module.exports = function (router) {
|
||||
router.get(/(\w+)\/([\w/]+)?/, './index');
|
||||
router.get('/*/*', './index');
|
||||
router.get('/:0?', './index');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
|
@ -22,7 +23,7 @@ module.exports = async (ctx) => {
|
|||
const rootUrl = 'https://gycpt.bphc.com.cn';
|
||||
const defaultPath = 'announcement';
|
||||
|
||||
const pathname = ctx.path.replaceAll(/(^\/beijing\/bphc|\/$)/g, '');
|
||||
const pathname = getSubPath(ctx).replaceAll(/(^\/beijing\/bphc|\/$)/g, '');
|
||||
const key = pathname === '' ? defaultPath : pathname.endsWith('/') ? pathname.slice(0, -1) : pathname;
|
||||
const obj = mapping[key];
|
||||
const currentUrl = `${rootUrl}${obj.list}`;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
const { rootUrl, parseNewsList, parseArticle } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const defaultPath = '/yaowenn/';
|
||||
|
||||
let pathname = ctx.path.replaceAll(/(^\/ccdi|\/$)/g, '');
|
||||
let pathname = getSubPath(ctx).replaceAll(/(^\/ccdi|\/$)/g, '');
|
||||
pathname = pathname === '' ? defaultPath : pathname.endsWith('/') ? pathname : pathname + '/';
|
||||
const currentUrl = `${rootUrl}${pathname}`;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import timezone from '@/utils/timezone';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
import * as path from 'node:path';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
ctx.path = ctx.path.replaceAll(/(^\/cmse|\/$)/g, '');
|
||||
const path = getSubPath(ctx).replaceAll(/(^\/cmse|\/$)/g, '');
|
||||
|
||||
const rootUrl = 'http://www.cmse.gov.cn';
|
||||
const currentUrl = `${rootUrl}${ctx.path === '' ? '/xwzx/zhxw/' : `${ctx.path}/`}`;
|
||||
const currentUrl = `${rootUrl}${path === '' ? '/xwzx/zhxw/' : `${path}/`}`;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
|
|
@ -5,10 +6,10 @@ import timezone from '@/utils/timezone';
|
|||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
ctx.path = ctx.path.replaceAll(/^\/cnnic/g, '');
|
||||
const path = getSubPath(ctx).replaceAll(/^\/cnnic/g, '');
|
||||
|
||||
const rootUrl = 'http://www.cnnic.net.cn';
|
||||
const currentUrl = `${rootUrl}${ctx.path === '/' ? '/gywm/xwzx/rdxw/20172017_7086/' : `${ctx.path}/`}`;
|
||||
const currentUrl = `${rootUrl}${path === '/' ? '/gywm/xwzx/rdxw/20172017_7086/' : `${path}/`}`;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import cache from '@/utils/cache';
|
||||
// 来人拯救一下啊( >﹏<。)
|
||||
// 待做功能:
|
||||
|
|
@ -44,7 +45,9 @@ import { art } from '@/utils/render';
|
|||
import { finishArticleItem } from '@/utils/wechat-mp';
|
||||
|
||||
const gdgov = async (info, ctx) => {
|
||||
const path = ctx.path.split('/').filter((item) => item !== '');
|
||||
const path = getSubPath(ctx)
|
||||
.split('/')
|
||||
.filter((item) => item !== '');
|
||||
const [site, branch] = path;
|
||||
|
||||
// 网站
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
const { gdgov } = require('../general/general');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const path = ctx.path.split('/').filter((item) => item !== '');
|
||||
const path = getSubPath(ctx)
|
||||
.split('/')
|
||||
.filter((item) => item !== '');
|
||||
let pathstartat = 0;
|
||||
let defaultPath = '';
|
||||
let list_element = '';
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
|
|
@ -6,7 +7,7 @@ import timezone from '@/utils/timezone';
|
|||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const params = ctx.path === '/nopss' ? '/GB/219469' : ctx.path.replace(/^\/nopss/, '');
|
||||
const params = getSubPath(ctx) === '/nopss' ? '/GB/219469' : getSubPath(ctx).replace(/^\/nopss/, '');
|
||||
|
||||
const rootUrl = 'http://www.nopss.gov.cn';
|
||||
const currentUrl = `${rootUrl}${params}`;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
|
|
@ -6,7 +7,7 @@ import { parseDate } from '@/utils/parse-date';
|
|||
const shortcuts = require('./shortcuts');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
let thePath = ctx.path.replace(/^\/nsfc/, '');
|
||||
let thePath = getSubPath(ctx).replace(/^\/nsfc/, '');
|
||||
|
||||
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 30;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
module.exports = function (router) {
|
||||
// ministry
|
||||
router.get(/cac(\/[\w/-]+)?/, './cac/index');
|
||||
router.get('/cac/*', './cac/index');
|
||||
router.get('/caac/cjwt/:category?', './caac/cjwt');
|
||||
router.get(/ccdi(\/[\w/-]+)?/, './ccdi');
|
||||
router.get('/ccdi/*', './ccdi');
|
||||
router.get('/chinamine-safety/zfxxgk/:category*', './chinamine-safety/zfxxgk');
|
||||
router.get('/chinamine-safety/xw/:category*', './chinamine-safety/xw');
|
||||
router.get('/chinatax/latest', './chinatax/latest');
|
||||
router.get('/cmse/fxrw', './cmse/fxrw');
|
||||
router.get(/cmse(\/[\w/-]+)?/, './cmse');
|
||||
router.get(/cnnic(\/[\w/-]+)?/, './cnnic');
|
||||
router.get('/cmse/*', './cmse');
|
||||
router.get('/cnnic/*', './cnnic');
|
||||
router.get('/csrc/auditstatus/:apply_id', './csrc/auditstatus');
|
||||
router.get('/csrc/news/:suffix*', './csrc/news');
|
||||
router.get('/customs/list/:gchannel?', './customs/list');
|
||||
|
|
@ -40,12 +40,12 @@ module.exports = function (router) {
|
|||
router.get('/nea/sjzz/ghs', './nea/ghs');
|
||||
router.get('/news/:uid', './news');
|
||||
router.get('/nifdc/:path*', './nifdc');
|
||||
router.get(/\/nmpa\/(\w[\w/]+)?/, './nmpa/generic');
|
||||
router.get(/nopss(\/[\w/-]+)?/, './nopss');
|
||||
router.get('/nmpa/*', './nmpa/generic');
|
||||
router.get('/nopss/*', './nopss');
|
||||
router.get('/npc/:caty', './npc/index');
|
||||
router.get('/nrta/news/:category?', './nrta/news');
|
||||
router.get('/nrta/dsj/:category?', './nrta/dsj');
|
||||
router.get(/nsfc(\/[\w-/]+)?/, './nsfc');
|
||||
router.get('/nsfc/*', './nsfc');
|
||||
router.get('/pbc/goutongjiaoliu', './pbc/goutongjiaoliu');
|
||||
router.get('/pbc/gzlw', './pbc/gzlw');
|
||||
router.get('/pbc/tradeAnnouncement', './pbc/trade-announcement');
|
||||
|
|
@ -54,40 +54,40 @@ module.exports = function (router) {
|
|||
router.get('/safe/complaint/:site?', './safe/complaint');
|
||||
router.get('/samr/xgzlyhd/:category?/:department?', './samr/xgzlyhd');
|
||||
router.get('/sasac/:path+', './sasac/generic');
|
||||
router.get(/stats(\/[\w/-]+)?/, './stats');
|
||||
router.get('/stats/*', './stats');
|
||||
router.get('/zhengce/govall/:advance?', './zhengce/govall');
|
||||
router.get('/zhengce/wenjian/:pcodeJiguan?', './zhengce/wenjian');
|
||||
router.get('/zhengce/zhengceku/:department', './zhengce/zhengceku');
|
||||
router.get('/zhengce/zuixin', './zhengce');
|
||||
router.get('/zhengce/:category*', './zhengce');
|
||||
// province
|
||||
router.get(/anhui\/kjt\/([\w/-]+)?/, './anhui/kjt');
|
||||
router.get('/anhui/kjt/*', './anhui/kjt');
|
||||
router.get('/beijing/bjedu/gh/:urlPath?', './beijing/bjedu/gh');
|
||||
router.get(/beijing\/bphc(\/[\w/-]+)?/, './beijing/bphc');
|
||||
router.get('/beijing/bphc/*', './beijing/bphc');
|
||||
router.get('/beijing/jw/tzgg', './beijing/jw/tzgg');
|
||||
router.get('/beijing/kw/:channel', './beijing/kw/index');
|
||||
router.get('/chongqing/gzw/:category*', './chongqing/gzw');
|
||||
router.get('/chongqing/rsks', './chongqing/rsks');
|
||||
router.get('/chongqing/sydwgkzp', './chongqing/sydwgkzp');
|
||||
router.get(/dianbai(\/[\w/-]+)?/, './dianbai/dianbai');
|
||||
router.get(/gaozhou(\/[\w/-]+)?/, './gaozhou/gaozhou');
|
||||
router.get('/dianbai/*', './dianbai/dianbai');
|
||||
router.get('/gaozhou/*', './gaozhou/gaozhou');
|
||||
router.get('/guangdong/tqyb/sncsyjxh', './guangdong/tqyb/sncsyjxh');
|
||||
router.get('/guangdong/tqyb/tfxtq', './guangdong/tqyb/tfxtq');
|
||||
router.get('/gz/:channel/:category', './gz/index');
|
||||
router.get('/hebei/czt/xwdt/:category?', './hebei/czt');
|
||||
router.get(/huazhou(\/[\w/-]+)?/, './huazhou/huazhou');
|
||||
router.get('/huazhou/*', './huazhou/huazhou');
|
||||
router.get('/huizhou/zwgk/:category?', './huizhou/zwgk/index');
|
||||
router.get('/hunan/changsha/major-email', './hunan/changsha/major-email');
|
||||
router.get(/maoming(\/[\w/-]+)?/, './maoming/maoming');
|
||||
router.get('/maoming/*', './maoming/maoming');
|
||||
router.get('/maonan/:category', './maonan/maonan');
|
||||
router.get(/mgs(\/[\w/-]+)?/, './mgs/mgs');
|
||||
router.get(/mmht(\/[\w/-]+)?/, './mmht/mmht');
|
||||
router.get(/sdb(\/[\w/-]+)?/, './sdb/sdb');
|
||||
router.get('/mgs/*', './mgs/mgs');
|
||||
router.get('/mmht/*', './mmht/mmht');
|
||||
router.get('/sdb/*', './sdb/sdb');
|
||||
router.get('/shaanxi/kjt/:id?', './shaanxi/kjt');
|
||||
router.get('/shanghai/rsj/ksxm', './shanghai/rsj/ksxm');
|
||||
router.get('/shanghai/wsjkw/yqtb', './shanghai/wsjkw/yqtb');
|
||||
router.get('/shanghai/wgj/:page?', './shanghai/wgj/wgj');
|
||||
router.get(/shanghai\/yjj\/([\w/-]+)?/, './shanghai/yjj');
|
||||
router.get('/shanghai/yjj/*', './shanghai/yjj');
|
||||
router.get('/shenzhen/hrss/szksy/:caty/:page?', './shenzhen/hrss/szksy/index');
|
||||
router.get('/shenzhen/xxgk/zfxxgj/:caty', './shenzhen/xxgk/zfxxgj');
|
||||
router.get('/shenzhen/zjj/xxgk/:caty', './shenzhen/zjj/index');
|
||||
|
|
@ -99,7 +99,7 @@ module.exports = function (router) {
|
|||
router.get('/suzhou/news/:uid', './suzhou/news');
|
||||
router.get('/taiyuan/rsj/:caty/:page?', './taiyuan/rsj');
|
||||
router.get('/wuhan/sy/whyw', './wuhan/whyw');
|
||||
router.get(/xinyi(\/[\w/-]+)?/, './xinyi/xinyi');
|
||||
router.get('/xinyi/*', './xinyi/xinyi');
|
||||
router.get('/xuzhou/hrss/:category?', './xuzhou/hrss');
|
||||
router.get('/zhejiang/gwy/:category?/:column?', './zhejiang/gwy');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
|
|
@ -5,7 +6,7 @@ import timezone from '@/utils/timezone';
|
|||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const params = ctx.path === '/shanghai/yjj' ? '/shanghai/yjj/zx-ylqx' : ctx.path;
|
||||
const params = getSubPath(ctx) === '/shanghai/yjj' ? '/shanghai/yjj/zx-ylqx' : getSubPath(ctx);
|
||||
|
||||
const rootUrl = 'https://yjj.sh.gov.cn';
|
||||
const currentUrl = `${rootUrl}${params.replace(/^\/shanghai\/yjj/, '')}/index.html`;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
|
|
@ -12,7 +13,7 @@ module.exports = async (ctx) => {
|
|||
const defaultPath = '/sj/zxfb/';
|
||||
|
||||
const rootUrl = 'http://www.stats.gov.cn';
|
||||
const currentUrl = `${rootUrl}${ctx.path === '/stats' ? defaultPath : ctx.path.replace(/^\/stats(.*)/, '$1/')}`;
|
||||
const currentUrl = `${rootUrl}${getSubPath(ctx) === '/stats' ? defaultPath : getSubPath(ctx).replace(/^\/stats(.*)/, '$1/')}`;
|
||||
|
||||
let response = await got({
|
||||
method: 'get',
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
|
|
@ -10,7 +11,7 @@ module.exports = async (ctx) => {
|
|||
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 20;
|
||||
|
||||
const rootUrl = 'https://news.ifeng.com';
|
||||
const currentUrl = `${rootUrl}${ctx.path.replace(/^\/news/, '')}`;
|
||||
const currentUrl = `${rootUrl}${getSubPath(ctx).replace(/^\/news/, '')}`;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
module.exports = (router) => {
|
||||
router.get('/feng/:id/:type', './feng');
|
||||
router.get(/news([\w-/]+)?/, './news');
|
||||
router.get('/news/*', './news');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
|
|
@ -6,7 +7,7 @@ import * as path from 'node:path';
|
|||
|
||||
module.exports = async (ctx) => {
|
||||
const rootUrl = 'https://itch.io';
|
||||
const currentUrl = `${rootUrl}${ctx.path}`;
|
||||
const currentUrl = `${rootUrl}${getSubPath(ctx)}`;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
module.exports = function (router) {
|
||||
router.get('/devlog/:user/:id', './devlog');
|
||||
router.get('/posts/:topic/:id', './posts');
|
||||
router.get(/([\w/-]+)?/, './index');
|
||||
router.get('*', './index');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
|
|
@ -14,7 +15,7 @@ const toSize = (raw) => {
|
|||
const allowDomain = new Set(['javbus.com', 'javbus.org', 'javsee.icu', 'javsee.one']);
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const isWestern = /^\/western/.test(ctx.path);
|
||||
const isWestern = /^\/western/.test(getSubPath(ctx));
|
||||
const domain = ctx.req.query('domain') ?? 'javbus.com';
|
||||
const westernDomain = ctx.req.query('western_domain') ?? 'javbus.org';
|
||||
|
||||
|
|
@ -25,7 +26,9 @@ module.exports = async (ctx) => {
|
|||
throw new Error(`This RSS is disabled unless 'ALLOW_USER_SUPPLY_UNSAFE_DOMAIN' is set to 'true'.`);
|
||||
}
|
||||
|
||||
const currentUrl = `${isWestern ? westernUrl : rootUrl}${ctx.path.replace(/^\/western/, '').replace(/\/home/, '')}`;
|
||||
const currentUrl = `${isWestern ? westernUrl : rootUrl}${getSubPath(ctx)
|
||||
.replace(/^\/western/, '')
|
||||
.replace(/\/home/, '')}`;
|
||||
|
||||
const headers = {
|
||||
'accept-language': 'zh-CN',
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
module.exports = (router) => {
|
||||
router.get(/([\w/-]+)?/, './index');
|
||||
router.get('*', './index');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
|
|
@ -5,7 +6,7 @@ import timezone from '@/utils/timezone';
|
|||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
let thePath = ctx.path.replace(/^\//, '');
|
||||
let thePath = getSubPath(ctx).replace(/^\//, '');
|
||||
|
||||
if (/^f\d+-\d+/.test(thePath)) {
|
||||
thePath = `fid=${thePath.match(/^f(\d+)-\d+/)[1]}`;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get(/([\w-/]+)?/, './');
|
||||
router.get('*', './');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
|
|
@ -6,7 +7,7 @@ import { art } from '@/utils/render';
|
|||
import * as path from 'node:path';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const params = ctx.path;
|
||||
const params = getSubPath(ctx);
|
||||
const isWork = params.indexOf('/work') === 0;
|
||||
|
||||
const rootUrl = 'https://www.logonews.cn';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
module.exports = function (router) {
|
||||
router.get('/work/tags/:tag', './index');
|
||||
router.get('/tag/:tag', './index');
|
||||
router.get(/([\w/-]+)?/, './index');
|
||||
router.get('*', './index');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
|
|
@ -17,7 +18,7 @@ module.exports = async (ctx) => {
|
|||
const data = await cache.tryGet(url, () => getData(url), config.cache.routeExpire, false);
|
||||
const items = await Promise.all(
|
||||
data
|
||||
.filter((article) => ctx.path === '/papers' || article.newthisweek)
|
||||
.filter((article) => getSubPath(ctx) === '/papers' || article.newthisweek)
|
||||
.map((article) => {
|
||||
const link = `${baseUrl}${article.url}`;
|
||||
return cache.tryGet(link, async () => {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
module.exports = function (router) {
|
||||
router.get(/\/sohac([\w-/]+)?/, './sohac');
|
||||
router.get(/\/yjsy([\w-/]+)?/, './yjsy');
|
||||
router.get('/sohac/*', './sohac');
|
||||
router.get('/yjsy/*', './yjsy');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
|
|
@ -6,7 +7,7 @@ import { parseDate } from '@/utils/parse-date';
|
|||
module.exports = async (ctx) => {
|
||||
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 10;
|
||||
|
||||
const path = ctx.path === '/sohac' ? '/index/tzgg' : ctx.path.replace(/^\/sohac/, '');
|
||||
const path = getSubPath(ctx) === '/sohac' ? '/index/tzgg' : getSubPath(ctx).replace(/^\/sohac/, '');
|
||||
|
||||
const rootUrl = 'https://sohac.nenu.edu.cn';
|
||||
const currentUrl = `${rootUrl}${path}.htm`;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
|
|
@ -6,7 +7,7 @@ import { parseDate } from '@/utils/parse-date';
|
|||
module.exports = async (ctx) => {
|
||||
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 10;
|
||||
|
||||
const path = ctx.path === '/yjsy' ? '/tzgg' : ctx.path.replace(/^\/yjsy/, '');
|
||||
const path = getSubPath(ctx) === '/yjsy' ? '/tzgg' : getSubPath(ctx).replace(/^\/yjsy/, '');
|
||||
|
||||
const rootUrl = 'https://yjsy.nenu.edu.cn';
|
||||
const currentUrl = `${rootUrl}${path}.htm`;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
|
|
@ -7,7 +8,7 @@ import parser from '@/utils/rss-parser';
|
|||
|
||||
module.exports = async (ctx) => {
|
||||
let language = '';
|
||||
let path = ctx.path;
|
||||
let path = getSubPath(ctx);
|
||||
|
||||
if (/^\/cn\/(cn|zh)/.test(path)) {
|
||||
language = path.match(/^\/cn\/(cn|zh)/)[1];
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
module.exports = (router) => {
|
||||
router.get('/', './index');
|
||||
router.get('/asia', './asia/index');
|
||||
router.get(/\/cn([\w-/]+)?/, './cn/index');
|
||||
router.get('/cn/*', './cn/index');
|
||||
router.get('/index', './index');
|
||||
router.get('/:category/:article_type?', './news');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get(/package[\w/-]+/, './package');
|
||||
router.get('package/*', './package');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,5 +6,5 @@ module.exports = function (router) {
|
|||
router.get('/scs/:category?', './scs');
|
||||
router.get('/sese/:category?', './sese');
|
||||
router.get('/xgc', './xgc');
|
||||
router.get(/yjs\/([\w/-]+)?/, './yjs');
|
||||
router.get('/yjs/*', './yjs');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
|
|
@ -5,7 +6,7 @@ import timezone from '@/utils/timezone';
|
|||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const path = ctx.path === '/yjs/' ? 'index/tzgg' : ctx.path.replace(/^\/yjs\//, '');
|
||||
const path = getSubPath(ctx) === '/yjs/' ? 'index/tzgg' : getSubPath(ctx).replace(/^\/yjs\//, '');
|
||||
|
||||
const rootUrl = 'https://yjs.nuist.edu.cn';
|
||||
const currentUrl = `${rootUrl}/${path}.htm`;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
|
|
@ -8,7 +9,7 @@ import * as path from 'node:path';
|
|||
|
||||
module.exports = async (ctx) => {
|
||||
const rootUrl = 'https://news.pts.org.tw';
|
||||
const currentUrl = `${rootUrl}${ctx.path === '/' ? '/dailynews' : ctx.path}`;
|
||||
const currentUrl = `${rootUrl}${getSubPath(ctx) === '/' ? '/dailynews' : getSubPath(ctx)}`;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
|
|
|
|||
|
|
@ -2,6 +2,5 @@ module.exports = function (router) {
|
|||
router.get('/curations', './curations');
|
||||
router.get('/live/:id', './live');
|
||||
router.get('/projects', './projects');
|
||||
router.get(/([\w-/]+)?/, './index');
|
||||
router.get('', './index');
|
||||
router.get('*', './index');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
|
|
@ -8,7 +9,7 @@ import * as path from 'node:path';
|
|||
|
||||
module.exports = async (ctx) => {
|
||||
const rootUrl = 'https://www.sinchew.com.my';
|
||||
const currentUrl = `${rootUrl}${ctx.path === '/' ? '' : ctx.path}`;
|
||||
const currentUrl = `${rootUrl}${getSubPath(ctx) === '/' ? '' : getSubPath(ctx)}`;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get(/([\w/-]+)?/, './index');
|
||||
router.get('', './index');
|
||||
router.get('*', './index');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
|
|
@ -7,7 +8,7 @@ import * as path from 'node:path';
|
|||
|
||||
module.exports = async (ctx) => {
|
||||
const rootUrl = 'https://www.thenewslens.com';
|
||||
const currentUrl = `${rootUrl}${ctx.path === '/' ? '/latest-article' : ctx.path}`;
|
||||
const currentUrl = `${rootUrl}${getSubPath(ctx) === '/' ? '/latest-article' : getSubPath(ctx)}`;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get(/([\w-/]+)?/, './index');
|
||||
router.get('*', './index');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const params = ctx.path === '/' ? '' : ctx.path;
|
||||
const params = getSubPath(ctx) === '/' ? '' : getSubPath(ctx);
|
||||
|
||||
const rootUrl = 'https://web3caff.com';
|
||||
const currentUrl = `${rootUrl}${params}`;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get(/([\w-/]+)?/, './index');
|
||||
router.get('*', './index');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
|
|
@ -8,7 +9,7 @@ module.exports = async (ctx) => {
|
|||
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 10;
|
||||
|
||||
const rootUrl = 'https://dongke.yangtzeu.edu.cn';
|
||||
const currentUrl = new URL(`${ctx.path.replace(/^\/dongke/, '') || '/yqzl/xyxw'}.htm`, rootUrl).href;
|
||||
const currentUrl = new URL(`${getSubPath(ctx).replace(/^\/dongke/, '') || '/yqzl/xyxw'}.htm`, rootUrl).href;
|
||||
|
||||
const { data: response } = await got(currentUrl);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get(/dongke([\w-/]+)?/, './dongke');
|
||||
router.get('/dongke/*', './dongke');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
|
@ -6,7 +7,7 @@ import * as path from 'node:path';
|
|||
|
||||
module.exports = async (ctx) => {
|
||||
const rootUrl = 'http://www.zyshow.net';
|
||||
const currentUrl = `${rootUrl}${ctx.path.replace(/\/$/, '')}/`;
|
||||
const currentUrl = `${rootUrl}${getSubPath(ctx).replace(/\/$/, '')}/`;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get(/([\w/-]+)?/, './index');
|
||||
router.get('*', './index');
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue