diff --git a/lib/api/category/one.ts b/lib/api/category/one.ts index 06cadeb650..a10c535da3 100644 --- a/lib/api/category/one.ts +++ b/lib/api/category/one.ts @@ -1,5 +1,7 @@ +import type { RouteHandler} from '@hono/zod-openapi'; +import { createRoute, z } from '@hono/zod-openapi'; + import { namespaces } from '@/registry'; -import { z, createRoute, RouteHandler } from '@hono/zod-openapi'; const categoryList: Record = {}; @@ -78,4 +80,4 @@ const handler: RouteHandler = (ctx) => { return ctx.json(result); }; -export { route, handler }; +export { handler, route }; diff --git a/lib/api/follow/config.ts b/lib/api/follow/config.ts index bb44f94ffb..dc002e1fec 100644 --- a/lib/api/follow/config.ts +++ b/lib/api/follow/config.ts @@ -1,6 +1,8 @@ +import type { RouteHandler } from '@hono/zod-openapi'; +import { createRoute } from '@hono/zod-openapi'; + import { config } from '@/config'; -import { createRoute, RouteHandler } from '@hono/zod-openapi'; -import { gitHash, gitDate } from '@/utils/git-hash'; +import { gitDate, gitHash } from '@/utils/git-hash'; const route = createRoute({ method: 'get', @@ -24,4 +26,4 @@ const handler: RouteHandler = (ctx) => gitDate: gitDate?.getTime(), }); -export { route, handler }; +export { handler, route }; diff --git a/lib/api/index.ts b/lib/api/index.ts index 6286a455b9..a3f54b9713 100644 --- a/lib/api/index.ts +++ b/lib/api/index.ts @@ -1,13 +1,14 @@ // import { route as rulesRoute, handler as rulesHandler } from '@/api/radar/rules'; -import { route as namespaceAllRoute, handler as namespaceAllHandler } from '@/api/namespace/all'; -import { route as namespaceOneRoute, handler as namespaceOneHandler } from '@/api/namespace/one'; -import { route as radarRulesAllRoute, handler as radarRulesAllHandler } from '@/api/radar/rules/all'; -import { route as radarRulesOneRoute, handler as radarRulesOneHandler } from '@/api/radar/rules/one'; -import { route as categoryOneRoute, handler as categoryOneHandler } from '@/api/category/one'; -import { route as followConfigRoute, handler as followConfigHandler } from '@/api/follow/config'; import { OpenAPIHono } from '@hono/zod-openapi'; import { Scalar } from '@scalar/hono-api-reference'; +import { handler as categoryOneHandler, route as categoryOneRoute } from '@/api/category/one'; +import { handler as followConfigHandler, route as followConfigRoute } from '@/api/follow/config'; +import { handler as namespaceAllHandler, route as namespaceAllRoute } from '@/api/namespace/all'; +import { handler as namespaceOneHandler, route as namespaceOneRoute } from '@/api/namespace/one'; +import { handler as radarRulesAllHandler, route as radarRulesAllRoute } from '@/api/radar/rules/all'; +import { handler as radarRulesOneHandler, route as radarRulesOneRoute } from '@/api/radar/rules/one'; + const app = new OpenAPIHono(); app.openapi(namespaceAllRoute, namespaceAllHandler); diff --git a/lib/api/namespace/all.ts b/lib/api/namespace/all.ts index 768d2a0c9b..9c08d27753 100644 --- a/lib/api/namespace/all.ts +++ b/lib/api/namespace/all.ts @@ -1,5 +1,7 @@ +import type { RouteHandler } from '@hono/zod-openapi'; +import { createRoute } from '@hono/zod-openapi'; + import { namespaces } from '@/registry'; -import { createRoute, RouteHandler } from '@hono/zod-openapi'; const route = createRoute({ method: 'get', @@ -14,4 +16,4 @@ const route = createRoute({ const handler: RouteHandler = (ctx) => ctx.json(namespaces); -export { route, handler }; +export { handler, route }; diff --git a/lib/api/namespace/one.ts b/lib/api/namespace/one.ts index cd09375ce8..289cb78f2f 100644 --- a/lib/api/namespace/one.ts +++ b/lib/api/namespace/one.ts @@ -1,5 +1,7 @@ +import type { RouteHandler} from '@hono/zod-openapi'; +import { createRoute, z } from '@hono/zod-openapi'; + import { namespaces } from '@/registry'; -import { z, createRoute, RouteHandler } from '@hono/zod-openapi'; const ParamsSchema = z.object({ namespace: z.string().openapi({ @@ -30,4 +32,4 @@ const handler: RouteHandler = (ctx) => { return ctx.json(namespaces[namespace]); }; -export { route, handler }; +export { handler, route }; diff --git a/lib/api/radar/rules/all.ts b/lib/api/radar/rules/all.ts index 7266a82910..ada23fbc12 100644 --- a/lib/api/radar/rules/all.ts +++ b/lib/api/radar/rules/all.ts @@ -1,7 +1,9 @@ -import { namespaces } from '@/registry'; +import type { RouteHandler } from '@hono/zod-openapi'; +import { createRoute } from '@hono/zod-openapi'; import { parse } from 'tldts'; -import { RadarDomain } from '@/types'; -import { createRoute, RouteHandler } from '@hono/zod-openapi'; + +import { namespaces } from '@/registry'; +import type { RadarDomain } from '@/types'; const radar: { [domain: string]: RadarDomain; @@ -53,4 +55,4 @@ const route = createRoute({ const handler: RouteHandler = (ctx) => ctx.json(radar); -export { route, handler }; +export { handler, route }; diff --git a/lib/api/radar/rules/one.ts b/lib/api/radar/rules/one.ts index 6cf859875b..fe11a79e7d 100644 --- a/lib/api/radar/rules/one.ts +++ b/lib/api/radar/rules/one.ts @@ -1,7 +1,9 @@ -import { namespaces } from '@/registry'; +import type { RouteHandler} from '@hono/zod-openapi'; +import { createRoute, z } from '@hono/zod-openapi'; import { parse } from 'tldts'; -import { RadarDomain } from '@/types'; -import { z, createRoute, RouteHandler } from '@hono/zod-openapi'; + +import { namespaces } from '@/registry'; +import type { RadarDomain } from '@/types'; const radar: { [domain: string]: RadarDomain; @@ -69,4 +71,4 @@ const handler: RouteHandler = (ctx) => { return ctx.json(radar[domain]); }; -export { route, handler }; +export { handler, route }; diff --git a/lib/app-bootstrap.tsx b/lib/app-bootstrap.tsx index f8b9215e33..c1bd50bc18 100644 --- a/lib/app-bootstrap.tsx +++ b/lib/app-bootstrap.tsx @@ -1,24 +1,22 @@ import { Hono } from 'hono'; - import { compress } from 'hono/compress'; -import mLogger from '@/middleware/logger'; -import cache from '@/middleware/cache'; -import template from '@/middleware/template'; -import sentry from '@/middleware/sentry'; -import accessControl from '@/middleware/access-control'; -import debug from '@/middleware/debug'; -import header from '@/middleware/header'; -import antiHotlink from '@/middleware/anti-hotlink'; -import parameter from '@/middleware/parameter'; -import trace from '@/middleware/trace'; import { jsxRenderer } from 'hono/jsx-renderer'; import { trimTrailingSlash } from 'hono/trailing-slash'; -import logger from '@/utils/logger'; - -import { notFoundHandler, errorHandler } from '@/errors'; -import registry from '@/registry'; import api from '@/api'; +import { errorHandler, notFoundHandler } from '@/errors'; +import accessControl from '@/middleware/access-control'; +import antiHotlink from '@/middleware/anti-hotlink'; +import cache from '@/middleware/cache'; +import debug from '@/middleware/debug'; +import header from '@/middleware/header'; +import mLogger from '@/middleware/logger'; +import parameter from '@/middleware/parameter'; +import sentry from '@/middleware/sentry'; +import template from '@/middleware/template'; +import trace from '@/middleware/trace'; +import registry from '@/registry'; +import logger from '@/utils/logger'; process.on('uncaughtException', (e) => { logger.error('uncaughtException: ' + e); diff --git a/lib/app.test.ts b/lib/app.test.ts index 5e69fc8720..185cc6f620 100644 --- a/lib/app.test.ts +++ b/lib/app.test.ts @@ -1,7 +1,7 @@ +import undici from 'undici'; import { describe, expect, it, vi } from 'vitest'; import app from '@/app'; -import undici from 'undici'; const { config } = await import('@/config'); diff --git a/lib/config.test.ts b/lib/config.test.ts index edf38055a6..b25585fc56 100644 --- a/lib/config.test.ts +++ b/lib/config.test.ts @@ -1,4 +1,4 @@ -import { describe, expect, it, afterEach, vi } from 'vitest'; +import { afterEach, describe, expect, it, vi } from 'vitest'; afterEach(() => { vi.resetModules(); diff --git a/lib/config.ts b/lib/config.ts index 5ae40d86cb..261d3646f9 100644 --- a/lib/config.ts +++ b/lib/config.ts @@ -1,4 +1,5 @@ import 'dotenv/config'; + import { ofetch } from 'ofetch'; type ConfigEnvKeys = diff --git a/lib/errors/index.test.ts b/lib/errors/index.test.ts index 511f45f659..30b8469715 100644 --- a/lib/errors/index.test.ts +++ b/lib/errors/index.test.ts @@ -1,8 +1,9 @@ -import { describe, expect, it, afterAll } from 'vitest'; -import supertest from 'supertest'; -import server from '@/index'; import { load } from 'cheerio'; +import supertest from 'supertest'; +import { afterAll, describe, expect, it } from 'vitest'; + import { config } from '@/config'; +import server from '@/index'; const request = supertest(server); diff --git a/lib/errors/index.tsx b/lib/errors/index.tsx index 8264c1cb88..a63cb20612 100644 --- a/lib/errors/index.tsx +++ b/lib/errors/index.tsx @@ -1,15 +1,15 @@ -import { type NotFoundHandler, type ErrorHandler } from 'hono'; -import { routePath } from 'hono/route'; -import { getDebugInfo, setDebugInfo } from '@/utils/debug-info'; -import { config } from '@/config'; import * as Sentry from '@sentry/node'; +import { type ErrorHandler, type NotFoundHandler } from 'hono'; +import { routePath } from 'hono/route'; + +import { config } from '@/config'; +import { getDebugInfo, setDebugInfo } from '@/utils/debug-info'; import logger from '@/utils/logger'; +import { requestMetric } from '@/utils/otel'; import Error from '@/views/error'; import NotFoundError from './types/not-found'; -import { requestMetric } from '@/utils/otel'; - export const errorHandler: ErrorHandler = (error, ctx) => { const requestPath = ctx.req.path; const matchedRoute = routePath(ctx); diff --git a/lib/index.ts b/lib/index.ts index fbd179c009..f70d71b343 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -1,12 +1,14 @@ -import { serve } from '@hono/node-server'; -import logger from '@/utils/logger'; -import { getLocalhostAddress } from '@/utils/common-utils'; -import { config } from '@/config'; -import app from '@/app'; -import os from 'node:os'; import cluster from 'node:cluster'; +import os from 'node:os'; import process from 'node:process'; +import { serve } from '@hono/node-server'; + +import app from '@/app'; +import { config } from '@/config'; +import { getLocalhostAddress } from '@/utils/common-utils'; +import logger from '@/utils/logger'; + const port = config.connect.port; const hostIPList = getLocalhostAddress(); diff --git a/lib/middleware/access-control.test.ts b/lib/middleware/access-control.test.ts index 83dd5be0f5..40674096e6 100644 --- a/lib/middleware/access-control.test.ts +++ b/lib/middleware/access-control.test.ts @@ -1,4 +1,5 @@ -import { describe, expect, it, vi, afterEach } from 'vitest'; +import { afterEach, describe, expect, it, vi } from 'vitest'; + import md5 from '@/utils/md5'; process.env.NODE_NAME = 'mock'; diff --git a/lib/middleware/access-control.ts b/lib/middleware/access-control.ts index 41123b1f84..01cbbd5f7b 100644 --- a/lib/middleware/access-control.ts +++ b/lib/middleware/access-control.ts @@ -1,7 +1,8 @@ import type { MiddlewareHandler } from 'hono'; + import { config } from '@/config'; -import md5 from '@/utils/md5'; import RejectError from '@/errors/types/reject'; +import md5 from '@/utils/md5'; const reject = (requestPath) => { throw new RejectError(`Authentication failed. Access denied.\n${requestPath}`); diff --git a/lib/middleware/anti-hotlink.test.ts b/lib/middleware/anti-hotlink.test.ts index 70c30f1343..d718fad4cd 100644 --- a/lib/middleware/anti-hotlink.test.ts +++ b/lib/middleware/anti-hotlink.test.ts @@ -1,5 +1,5 @@ -import { describe, expect, it, vi, afterEach, afterAll } from 'vitest'; import Parser from 'rss-parser'; +import { afterAll, afterEach, describe, expect, it, vi } from 'vitest'; const parser = new Parser(); diff --git a/lib/middleware/anti-hotlink.ts b/lib/middleware/anti-hotlink.ts index 6b04cda304..a706330e30 100644 --- a/lib/middleware/anti-hotlink.ts +++ b/lib/middleware/anti-hotlink.ts @@ -1,8 +1,9 @@ -import { config } from '@/config'; -import { load, type CheerioAPI } from 'cheerio'; -import logger from '@/utils/logger'; +import { type CheerioAPI, load } from 'cheerio'; import { type MiddlewareHandler } from 'hono'; -import { Data } from '@/types'; + +import { config } from '@/config'; +import type { Data } from '@/types'; +import logger from '@/utils/logger'; const templateRegex = /\${([^{}]+)}/g; const allowedUrlProperties = new Set(['hash', 'host', 'hostname', 'href', 'origin', 'password', 'pathname', 'port', 'protocol', 'search', 'searchParams', 'username']); diff --git a/lib/middleware/cache.test.ts b/lib/middleware/cache.test.ts index 703da060cd..fb9e2b420c 100644 --- a/lib/middleware/cache.test.ts +++ b/lib/middleware/cache.test.ts @@ -1,5 +1,6 @@ -import { describe, expect, it, vi, afterEach } from 'vitest'; import Parser from 'rss-parser'; +import { afterEach, describe, expect, it, vi } from 'vitest'; + import wait from '@/utils/wait'; process.env.CACHE_EXPIRE = '1'; diff --git a/lib/middleware/cache.ts b/lib/middleware/cache.ts index 35876a9691..3deaa14da7 100644 --- a/lib/middleware/cache.ts +++ b/lib/middleware/cache.ts @@ -1,10 +1,10 @@ -import xxhash from 'xxhash-wasm'; import type { MiddlewareHandler } from 'hono'; +import xxhash from 'xxhash-wasm'; import { config } from '@/config'; import RequestInProgressError from '@/errors/types/request-in-progress'; +import type { Data } from '@/types'; import cacheModule from '@/utils/cache/index'; -import { Data } from '@/types'; const bypassList = new Set(['/', '/robots.txt', '/logo.png', '/favicon.ico']); // only give cache string, as the `!` condition tricky diff --git a/lib/middleware/debug.test.ts b/lib/middleware/debug.test.ts index 7bcf980e8c..8c79826038 100644 --- a/lib/middleware/debug.test.ts +++ b/lib/middleware/debug.test.ts @@ -1,6 +1,7 @@ -import { describe, expect, it } from 'vitest'; -import app from '@/app'; import { load } from 'cheerio'; +import { describe, expect, it } from 'vitest'; + +import app from '@/app'; process.env.NODE_NAME = 'mock'; diff --git a/lib/middleware/debug.ts b/lib/middleware/debug.ts index 58edeb52ae..9d779728a8 100644 --- a/lib/middleware/debug.ts +++ b/lib/middleware/debug.ts @@ -1,5 +1,6 @@ -import { MiddlewareHandler } from 'hono'; +import type { MiddlewareHandler } from 'hono'; import { routePath } from 'hono/route'; + import { getDebugInfo, setDebugInfo } from '@/utils/debug-info'; const middleware: MiddlewareHandler = async (ctx, next) => { diff --git a/lib/middleware/filter-engine.test.ts b/lib/middleware/filter-engine.test.ts index 1a9d6e60b6..e68e60c1e9 100644 --- a/lib/middleware/filter-engine.test.ts +++ b/lib/middleware/filter-engine.test.ts @@ -1,4 +1,4 @@ -import { describe, expect, it, afterAll, vi, afterEach } from 'vitest'; +import { afterAll, afterEach, describe, expect, it, vi } from 'vitest'; afterAll(() => { delete process.env.FILTER_REGEX_ENGINE; diff --git a/lib/middleware/header.test.ts b/lib/middleware/header.test.ts index 103d61b5ca..90ab4f6b89 100644 --- a/lib/middleware/header.test.ts +++ b/lib/middleware/header.test.ts @@ -1,4 +1,4 @@ -import { describe, expect, it, afterAll } from 'vitest'; +import { afterAll, describe, expect, it } from 'vitest'; process.env.NODE_NAME = 'mock'; process.env.ALLOW_ORIGIN = 'rsshub.mock'; diff --git a/lib/middleware/header.ts b/lib/middleware/header.ts index 0e4d50f84b..72cbfdf266 100644 --- a/lib/middleware/header.ts +++ b/lib/middleware/header.ts @@ -1,8 +1,9 @@ -import { MiddlewareHandler } from 'hono'; -import { routePath } from 'hono/route'; import etagCalculate from 'etag'; +import type { MiddlewareHandler } from 'hono'; +import { routePath } from 'hono/route'; + import { config } from '@/config'; -import { Data } from '@/types'; +import type { Data } from '@/types'; const headers: Record = { 'Access-Control-Allow-Methods': 'GET', diff --git a/lib/middleware/logger.ts b/lib/middleware/logger.ts index 9d2ca59cec..19b038aa3d 100644 --- a/lib/middleware/logger.ts +++ b/lib/middleware/logger.ts @@ -1,7 +1,8 @@ -import { requestMetric } from '@/utils/otel'; -import { MiddlewareHandler } from 'hono'; -import logger from '@/utils/logger'; +import type { MiddlewareHandler } from 'hono'; + import { getPath, time } from '@/utils/helpers'; +import logger from '@/utils/logger'; +import { requestMetric } from '@/utils/otel'; enum LogPrefix { Outgoing = '-->', diff --git a/lib/middleware/parameter.test.ts b/lib/middleware/parameter.test.ts index 57debada33..69f3000e33 100644 --- a/lib/middleware/parameter.test.ts +++ b/lib/middleware/parameter.test.ts @@ -1,5 +1,5 @@ -import { describe, expect, it, vi } from 'vitest'; import Parser from 'rss-parser'; +import { describe, expect, it, vi } from 'vitest'; process.env.OPENAI_API_KEY = 'sk-1234567890'; process.env.OPENAI_API_ENDPOINT = 'https://api.openai.mock/v1'; diff --git a/lib/middleware/parameter.ts b/lib/middleware/parameter.ts index d6750bcde7..864354f01e 100644 --- a/lib/middleware/parameter.ts +++ b/lib/middleware/parameter.ts @@ -1,17 +1,18 @@ -import * as entities from 'entities'; -import { load, type CheerioAPI } from 'cheerio'; -import type { Element } from 'domhandler'; -import { simplecc } from 'simplecc-wasm'; -import ofetch from '@/utils/ofetch'; -import { config } from '@/config'; -import { RE2JS } from 're2js'; -import markdownit from 'markdown-it'; -import { convert } from 'html-to-text'; -import sanitizeHtml from 'sanitize-html'; -import { MiddlewareHandler } from 'hono'; -import cache from '@/utils/cache'; import Parser from '@postlight/parser'; -import { Data, DataItem } from '@/types'; +import { type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import * as entities from 'entities'; +import type { MiddlewareHandler } from 'hono'; +import { convert } from 'html-to-text'; +import markdownit from 'markdown-it'; +import { RE2JS } from 're2js'; +import sanitizeHtml from 'sanitize-html'; +import { simplecc } from 'simplecc-wasm'; + +import { config } from '@/config'; +import type { Data, DataItem } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; const md = markdownit({ html: true, diff --git a/lib/middleware/sentry.ts b/lib/middleware/sentry.ts index 04d59e95e1..8c2952bbb9 100644 --- a/lib/middleware/sentry.ts +++ b/lib/middleware/sentry.ts @@ -1,8 +1,9 @@ -import { MiddlewareHandler } from 'hono'; -import logger from '@/utils/logger'; -import { config } from '@/config'; import * as Sentry from '@sentry/node'; +import type { MiddlewareHandler } from 'hono'; + +import { config } from '@/config'; import { getRouteNameFromPath } from '@/utils/helpers'; +import logger from '@/utils/logger'; if (config.sentry.dsn) { Sentry.init({ diff --git a/lib/middleware/template.test.ts b/lib/middleware/template.test.ts index b3ac3c60df..6956983580 100644 --- a/lib/middleware/template.test.ts +++ b/lib/middleware/template.test.ts @@ -1,6 +1,7 @@ -import { describe, expect, it } from 'vitest'; -import app from '@/app'; import Parser from 'rss-parser'; +import { describe, expect, it } from 'vitest'; + +import app from '@/app'; const parser = new Parser(); diff --git a/lib/middleware/template.tsx b/lib/middleware/template.tsx index a42a815fdd..d9f5ed9865 100644 --- a/lib/middleware/template.tsx +++ b/lib/middleware/template.tsx @@ -1,10 +1,10 @@ -import { rss3, json, RSS, Atom } from '@/utils/render'; -import { config } from '@/config'; -import { collapseWhitespace, convertDateToISO8601 } from '@/utils/common-utils'; import type { MiddlewareHandler } from 'hono'; -import { Data } from '@/types'; +import { config } from '@/config'; +import type { Data } from '@/types'; import cacheModule from '@/utils/cache/index'; +import { collapseWhitespace, convertDateToISO8601 } from '@/utils/common-utils'; +import { Atom, json, RSS, rss3 } from '@/utils/render'; const middleware: MiddlewareHandler = async (ctx, next) => { // Set RSS (minute) according to the availability of cache diff --git a/lib/middleware/trace.ts b/lib/middleware/trace.ts index 78fa81e449..b02ffdc4db 100644 --- a/lib/middleware/trace.ts +++ b/lib/middleware/trace.ts @@ -1,6 +1,7 @@ -import { MiddlewareHandler } from 'hono'; -import { getPath } from '@/utils/helpers'; +import type { MiddlewareHandler } from 'hono'; + import { config } from '@/config'; +import { getPath } from '@/utils/helpers'; import { tracer } from '@/utils/otel'; const middleware: MiddlewareHandler = async (ctx, next) => { diff --git a/lib/pkg.test.ts b/lib/pkg.test.ts index c459007541..dedbdb80d0 100644 --- a/lib/pkg.test.ts +++ b/lib/pkg.test.ts @@ -1,4 +1,5 @@ import { describe, expect, it } from 'vitest'; + import { init, request } from './pkg'; describe('pkg', () => { diff --git a/lib/pkg.ts b/lib/pkg.ts index 875f71bf8d..068a339a69 100644 --- a/lib/pkg.ts +++ b/lib/pkg.ts @@ -1,7 +1,9 @@ -import { type ConfigEnv, setConfig } from '@/config'; -import { Handler, Hono } from 'hono'; +import type { Handler, Hono } from 'hono'; + import type { RoutePath } from '@/../assets/build/route-paths'; -import type { Data, Route, Namespace } from './types'; +import { type ConfigEnv, setConfig } from '@/config'; + +import type { Data, Namespace, Route } from './types'; export * from '@/types'; export { default as ofetch } from '@/utils/ofetch'; diff --git a/lib/registry.test.ts b/lib/registry.test.ts index 0892ca7d7b..ec5ce63a38 100644 --- a/lib/registry.test.ts +++ b/lib/registry.test.ts @@ -1,4 +1,5 @@ import { describe, expect, it, vi } from 'vitest'; + import app from '@/app'; import { config } from '@/config'; diff --git a/lib/registry.ts b/lib/registry.ts index 26fd81997d..177cc23964 100644 --- a/lib/registry.ts +++ b/lib/registry.ts @@ -1,15 +1,16 @@ -import type { APIRoute, Namespace, Route } from '@/types'; -import { directoryImport } from 'directory-import'; -import { Hono, type Handler } from 'hono'; -import { routePath } from 'hono/route'; import path from 'node:path'; -import { serveStatic } from '@hono/node-server/serve-static'; -import { config } from '@/config'; -import index from '@/routes/index'; +import { serveStatic } from '@hono/node-server/serve-static'; +import { directoryImport } from 'directory-import'; +import { type Handler, Hono } from 'hono'; +import { routePath } from 'hono/route'; + +import { config } from '@/config'; import healthz from '@/routes/healthz'; -import robotstxt from '@/routes/robots.txt'; +import index from '@/routes/index'; import metrics from '@/routes/metrics'; +import robotstxt from '@/routes/robots.txt'; +import type { APIRoute, Namespace, Route } from '@/types'; import logger from '@/utils/logger'; const __dirname = import.meta.dirname; diff --git a/lib/routes.test.ts b/lib/routes.test.ts index d9cb64df8f..fc32ad7dc3 100644 --- a/lib/routes.test.ts +++ b/lib/routes.test.ts @@ -1,9 +1,11 @@ -import { describe, expect, it } from 'vitest'; -import app from '@/app'; import Parser from 'rss-parser'; -const parser = new Parser(); +import { describe, expect, it } from 'vitest'; + +import app from '@/app'; import { config } from '@/config'; +const parser = new Parser(); + process.env.ALLOW_USER_SUPPLY_UNSAFE_DOMAIN = 'true'; const routes = { diff --git a/lib/routes/005/index.ts b/lib/routes/005/index.ts index f38e0782c5..f9d8148f53 100644 --- a/lib/routes/005/index.ts +++ b/lib/routes/005/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 path from 'node:path'; +import timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { category = 'zx' } = ctx.req.param(); diff --git a/lib/routes/0818tuan/index.ts b/lib/routes/0818tuan/index.ts index d39ee89270..a6df251360 100644 --- a/lib/routes/0818tuan/index.ts +++ b/lib/routes/0818tuan/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/0x80/index.ts b/lib/routes/0x80/index.ts index d6aa248a43..2c5ed27a02 100644 --- a/lib/routes/0x80/index.ts +++ b/lib/routes/0x80/index.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/0xxx/index.ts b/lib/routes/0xxx/index.ts index 0579425321..5e573916ba 100644 --- a/lib/routes/0xxx/index.ts +++ b/lib/routes/0xxx/index.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { filter } = ctx.req.param(); diff --git a/lib/routes/10000link/info.ts b/lib/routes/10000link/info.ts index b77bbf277c..0769c6dfcc 100644 --- a/lib/routes/10000link/info.ts +++ b/lib/routes/10000link/info.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { category = 'newslists', id } = ctx.req.param(); diff --git a/lib/routes/10jqka/realtimenews.ts b/lib/routes/10jqka/realtimenews.ts index 48f821d309..25a3182f73 100644 --- a/lib/routes/10jqka/realtimenews.ts +++ b/lib/routes/10jqka/realtimenews.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const handler = async (ctx) => { diff --git a/lib/routes/121/weather-live.ts b/lib/routes/121/weather-live.ts index f95a77cdfa..893b126e4f 100644 --- a/lib/routes/121/weather-live.ts +++ b/lib/routes/121/weather-live.ts @@ -1,12 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import { art } from '@/utils/render'; -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; +import path from 'node:path'; import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; -import path from 'node:path'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '100', 10); diff --git a/lib/routes/12306/index.ts b/lib/routes/12306/index.ts index c36ea80f28..feba70300b 100644 --- a/lib/routes/12306/index.ts +++ b/lib/routes/12306/index.ts @@ -1,11 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { config } from '@/config'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { config } from '@/config'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const rootUrl = 'https://kyfw.12306.cn'; diff --git a/lib/routes/12306/zxdt.ts b/lib/routes/12306/zxdt.ts index 69b6696bba..eebd0af520 100644 --- a/lib/routes/12306/zxdt.ts +++ b/lib/routes/12306/zxdt.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/12371/zxfb.ts b/lib/routes/12371/zxfb.ts index 756779f6fd..e504922059 100644 --- a/lib/routes/12371/zxfb.ts +++ b/lib/routes/12371/zxfb.ts @@ -1,10 +1,10 @@ -import got from '@/utils/got'; import * as cheerio from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import cache from '@/utils/cache'; - -import { Route } from '@/types'; const handler = async (ctx) => { const { category = 'zxfb' } = ctx.req.param(); diff --git a/lib/routes/141jav/index.ts b/lib/routes/141jav/index.ts index 159cc0a27a..1ccd6a54d3 100644 --- a/lib/routes/141jav/index.ts +++ b/lib/routes/141jav/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import { getSubPath } from '@/utils/common-utils'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:type/:keyword{.*}?', diff --git a/lib/routes/141ppv/index.ts b/lib/routes/141ppv/index.ts index abfc0419d0..032b982ff4 100644 --- a/lib/routes/141ppv/index.ts +++ b/lib/routes/141ppv/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import { getSubPath } from '@/utils/common-utils'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:type/:keyword{.*}?', diff --git a/lib/routes/163/ds.ts b/lib/routes/163/ds.ts index b35e1d9d27..5dde58e46f 100644 --- a/lib/routes/163/ds.ts +++ b/lib/routes/163/ds.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const root_url = 'https://inf.ds.163.com'; diff --git a/lib/routes/163/dy.ts b/lib/routes/163/dy.ts index ff6b2df639..5f2a29f8c7 100644 --- a/lib/routes/163/dy.ts +++ b/lib/routes/163/dy.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { parseDyArticle } from './utils'; export const route: Route = { diff --git a/lib/routes/163/dy2.ts b/lib/routes/163/dy2.ts index b6d985b81e..6c65b28782 100644 --- a/lib/routes/163/dy2.ts +++ b/lib/routes/163/dy2.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { parseDyArticle } from './utils'; export const route: Route = { diff --git a/lib/routes/163/exclusive.ts b/lib/routes/163/exclusive.ts index 77b460133c..c781cedcbd 100644 --- a/lib/routes/163/exclusive.ts +++ b/lib/routes/163/exclusive.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 path from 'node:path'; +import timezone from '@/utils/timezone'; const ids = { '': { diff --git a/lib/routes/163/music/artist-songs.ts b/lib/routes/163/music/artist-songs.ts index 4f410effee..629f2b76ee 100644 --- a/lib/routes/163/music/artist-songs.ts +++ b/lib/routes/163/music/artist-songs.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/music/artist/songs/:id', diff --git a/lib/routes/163/music/artist.ts b/lib/routes/163/music/artist.ts index fd4e9355a8..8beeb6db5a 100644 --- a/lib/routes/163/music/artist.ts +++ b/lib/routes/163/music/artist.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/music/artist/:id', diff --git a/lib/routes/163/music/djradio.ts b/lib/routes/163/music/djradio.ts index 09efda318e..3a02ac3e95 100644 --- a/lib/routes/163/music/djradio.ts +++ b/lib/routes/163/music/djradio.ts @@ -1,11 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import cache from '@/utils/cache'; -import { config } from '@/config'; export const route: Route = { path: '/music/djradio/:id/:info?', diff --git a/lib/routes/163/music/playlist.ts b/lib/routes/163/music/playlist.ts index 198c4afefa..f3f9b4c4a9 100644 --- a/lib/routes/163/music/playlist.ts +++ b/lib/routes/163/music/playlist.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { config } from '@/config'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { config } from '@/config'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + export const route: Route = { path: '/music/playlist/:id', categories: ['multimedia'], diff --git a/lib/routes/163/music/userevents.ts b/lib/routes/163/music/userevents.ts index 8ca7a06e51..39c7bf9493 100644 --- a/lib/routes/163/music/userevents.ts +++ b/lib/routes/163/music/userevents.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; - import path from 'node:path'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; + const renderDescription = (info) => art(path.join(__dirname, '../templates/music/userevents.art'), info); export const route: Route = { diff --git a/lib/routes/163/music/userplaylist.ts b/lib/routes/163/music/userplaylist.ts index ff7ed8ff2d..4d272a18cf 100644 --- a/lib/routes/163/music/userplaylist.ts +++ b/lib/routes/163/music/userplaylist.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/music/user/playlist/:uid', diff --git a/lib/routes/163/music/userplayrecords.ts b/lib/routes/163/music/userplayrecords.ts index f2473d913f..7d9f4f2f4f 100644 --- a/lib/routes/163/music/userplayrecords.ts +++ b/lib/routes/163/music/userplayrecords.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { config } from '@/config'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { config } from '@/config'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + const headers = { cookie: config.ncm.cookies, Referer: 'https://music.163.com/', diff --git a/lib/routes/163/news/rank.ts b/lib/routes/163/news/rank.ts index e6210c9ec1..aee0db375f 100644 --- a/lib/routes/163/news/rank.ts +++ b/lib/routes/163/news/rank.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; -import { parseDate } from '@/utils/parse-date'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; const rootUrl = 'https://news.163.com'; diff --git a/lib/routes/163/news/special.ts b/lib/routes/163/news/special.ts index 0cebb6b248..70b969f8fd 100644 --- a/lib/routes/163/news/special.ts +++ b/lib/routes/163/news/special.ts @@ -1,9 +1,11 @@ +import { load } from 'cheerio'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; + const typeMap = { 1: '轻松一刻', 2: '槽值', diff --git a/lib/routes/163/open/vip.ts b/lib/routes/163/open/vip.ts index 70335db979..3ed041646b 100644 --- a/lib/routes/163/open/vip.ts +++ b/lib/routes/163/open/vip.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/open/vip', diff --git a/lib/routes/163/renjian.ts b/lib/routes/163/renjian.ts index 21437ee838..50d78180c9 100644 --- a/lib/routes/163/renjian.ts +++ b/lib/routes/163/renjian.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/163/today.ts b/lib/routes/163/today.ts index 21c0c93724..5d34784b9e 100644 --- a/lib/routes/163/today.ts +++ b/lib/routes/163/today.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/today/:need_content?', diff --git a/lib/routes/163/utils.ts b/lib/routes/163/utils.ts index 711e37728f..695e6f6205 100644 --- a/lib/routes/163/utils.ts +++ b/lib/routes/163/utils.ts @@ -1,8 +1,10 @@ -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import got from '@/utils/got'; +import { art } from '@/utils/render'; + const parseDyArticle = (item, tryGet) => tryGet(item.link, async () => { const response = await got(item.link, { diff --git a/lib/routes/18comic/album.ts b/lib/routes/18comic/album.ts index 763efc643d..54219ddc64 100644 --- a/lib/routes/18comic/album.ts +++ b/lib/routes/18comic/album.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import { defaultDomain, getApiUrl, getRootUrl, processApiItems } from './utils'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import { art } from '@/utils/render'; + +import { defaultDomain, getApiUrl, getRootUrl, processApiItems } from './utils'; export const route: Route = { path: '/album/:id', diff --git a/lib/routes/18comic/blogs.ts b/lib/routes/18comic/blogs.ts index 0b1ded7421..fff7f43756 100644 --- a/lib/routes/18comic/blogs.ts +++ b/lib/routes/18comic/blogs.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { defaultDomain, getRootUrl } from './utils'; diff --git a/lib/routes/18comic/index.ts b/lib/routes/18comic/index.ts index 4bc547ab10..d33f21dd68 100644 --- a/lib/routes/18comic/index.ts +++ b/lib/routes/18comic/index.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { defaultDomain, getRootUrl, ProcessItems } from './utils'; export const route: Route = { diff --git a/lib/routes/18comic/search.ts b/lib/routes/18comic/search.ts index e7b40eed46..40226f1d4b 100644 --- a/lib/routes/18comic/search.ts +++ b/lib/routes/18comic/search.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import { apiMapCategory, defaultDomain, getApiUrl, getRootUrl, processApiItems } from './utils'; +import path from 'node:path'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import cache from '@/utils/cache'; + +import { apiMapCategory, defaultDomain, getApiUrl, getRootUrl, processApiItems } from './utils'; export const route: Route = { path: '/search/:option?/:category?/:keyword?/:time?/:order?', diff --git a/lib/routes/18comic/utils.ts b/lib/routes/18comic/utils.ts index d152b360b3..3d4d23325a 100644 --- a/lib/routes/18comic/utils.ts +++ b/lib/routes/18comic/utils.ts @@ -1,13 +1,15 @@ -import cache from '@/utils/cache'; -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; +import CryptoJS from 'crypto-js'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import md5 from '@/utils/md5'; -import CryptoJS from 'crypto-js'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; const defaultDomain = 'jmcomic1.me'; // list of address: https://jmcomic2.bet @@ -151,4 +153,4 @@ const ProcessItems = async (ctx, currentUrl, rootUrl) => { }; }; -export { defaultDomain, getRootUrl, ProcessItems, getApiUrl, processApiItems, apiMapCategory }; +export { apiMapCategory, defaultDomain, getApiUrl, getRootUrl, processApiItems, ProcessItems }; diff --git a/lib/routes/199it/index.ts b/lib/routes/199it/index.ts index bf6543bcba..7a88515d19 100644 --- a/lib/routes/199it/index.ts +++ b/lib/routes/199it/index.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { category = 'newly' } = ctx.req.param(); diff --git a/lib/routes/19lou/index.ts b/lib/routes/19lou/index.ts index 5869a5f356..579552d48e 100644 --- a/lib/routes/19lou/index.ts +++ b/lib/routes/19lou/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import iconv from 'iconv-lite'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; 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 iconv from 'iconv-lite'; +import timezone from '@/utils/timezone'; import { isValidHost } from '@/utils/valid-host'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const setCookie = function (cookieName, cookieValue, seconds, path, domain, secure) { let expires = null; diff --git a/lib/routes/1lou/index.ts b/lib/routes/1lou/index.ts index df177c9124..26768f6af4 100644 --- a/lib/routes/1lou/index.ts +++ b/lib/routes/1lou/index.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; const rootUrl = 'https://www.1lou.me'; diff --git a/lib/routes/1point3acres/blog.ts b/lib/routes/1point3acres/blog.ts index 3e1c0f4be0..07f89b768d 100644 --- a/lib/routes/1point3acres/blog.ts +++ b/lib/routes/1point3acres/blog.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/1point3acres/category.ts b/lib/routes/1point3acres/category.ts index e39a5a566d..8e79146844 100644 --- a/lib/routes/1point3acres/category.ts +++ b/lib/routes/1point3acres/category.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { rootUrl, apiRootUrl, types, ProcessThreads } from './utils'; + +import { apiRootUrl, ProcessThreads, rootUrl, types } from './utils'; export const route: Route = { path: '/category/:id?/:type?/:order?', diff --git a/lib/routes/1point3acres/offer.ts b/lib/routes/1point3acres/offer.ts index 2202802ce7..87d1d05d4c 100644 --- a/lib/routes/1point3acres/offer.ts +++ b/lib/routes/1point3acres/offer.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { art } from '@/utils/render'; -import { parseDate } from '@/utils/parse-date'; import path from 'node:path'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + export const route: Route = { path: '/offer/:year?/:major?/:school?', categories: ['bbs'], diff --git a/lib/routes/1point3acres/section.ts b/lib/routes/1point3acres/section.ts index f51f48206d..97109dfc55 100644 --- a/lib/routes/1point3acres/section.ts +++ b/lib/routes/1point3acres/section.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { rootUrl, apiRootUrl, types, ProcessThreads } from './utils'; + +import { apiRootUrl, ProcessThreads, rootUrl, types } from './utils'; const sections = { 257: '留学申请', diff --git a/lib/routes/1point3acres/thread.ts b/lib/routes/1point3acres/thread.ts index 3a15a5c0bc..063d062c78 100644 --- a/lib/routes/1point3acres/thread.ts +++ b/lib/routes/1point3acres/thread.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { rootUrl, apiRootUrl, types, ProcessThreads } from './utils'; + +import { apiRootUrl, ProcessThreads, rootUrl, types } from './utils'; export const route: Route = { path: '/thread/:type?/:order?', diff --git a/lib/routes/1point3acres/user/post.ts b/lib/routes/1point3acres/user/post.ts index d80cc9da4c..5160ab4342 100644 --- a/lib/routes/1point3acres/user/post.ts +++ b/lib/routes/1point3acres/user/post.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/1point3acres/user/thread.ts b/lib/routes/1point3acres/user/thread.ts index ecbaa83b5c..3c1fad3837 100644 --- a/lib/routes/1point3acres/user/thread.ts +++ b/lib/routes/1point3acres/user/thread.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/1point3acres/utils.ts b/lib/routes/1point3acres/utils.ts index c4b7638aac..b1c9c6f988 100644 --- a/lib/routes/1point3acres/utils.ts +++ b/lib/routes/1point3acres/utils.ts @@ -1,10 +1,12 @@ +import path from 'node:path'; + +import bbobHTML from '@bbob/html'; +import presetHTML5 from '@bbob/preset-html5'; +import type { BBobCoreTagNodeTree } from '@bbob/types'; + import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import type { BBobCoreTagNodeTree } from '@bbob/types'; -import bbobHTML from '@bbob/html'; -import presetHTML5 from '@bbob/preset-html5'; const rootUrl = 'https://instant.1point3acres.com'; const apiRootUrl = 'https://api.1point3acres.com'; @@ -137,4 +139,4 @@ const ProcessThreads = async (tryGet, apiUrl, order) => { return items; }; -export { rootUrl, apiRootUrl, types, ProcessThreads }; +export { apiRootUrl, ProcessThreads, rootUrl, types }; diff --git a/lib/routes/1x/index.ts b/lib/routes/1x/index.ts index 03f8d81adc..8e0121b86a 100644 --- a/lib/routes/1x/index.ts +++ b/lib/routes/1x/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + export const handler = async (ctx) => { const { category = 'latest/awarded' } = ctx.req.param(); const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 30; diff --git a/lib/routes/2023game/index.ts b/lib/routes/2023game/index.ts index c54423178a..2c10cfb5b7 100644 --- a/lib/routes/2023game/index.ts +++ b/lib/routes/2023game/index.ts @@ -1,8 +1,9 @@ -import { Data, DataItem, Route } from '@/types'; +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { Data, DataItem, Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; -import { Context } from 'hono'; export const route: Route = { path: '/:category?/:tab?', diff --git a/lib/routes/2048/index.ts b/lib/routes/2048/index.ts index 0355a37def..c13c46df59 100644 --- a/lib/routes/2048/index.ts +++ b/lib/routes/2048/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:id?', diff --git a/lib/routes/21caijing/channel.ts b/lib/routes/21caijing/channel.ts index 901f954497..2c82967b16 100644 --- a/lib/routes/21caijing/channel.ts +++ b/lib/routes/21caijing/channel.ts @@ -1,13 +1,12 @@ import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; -import { type DataItem, type Route, type Data, ViewType } from '@/types'; - +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const processMenu = (data: any[]) => { const result = {}; diff --git a/lib/routes/2cycd/index.ts b/lib/routes/2cycd/index.ts index 39538da529..5a5ad7cf15 100644 --- a/lib/routes/2cycd/index.ts +++ b/lib/routes/2cycd/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import iconv from 'iconv-lite'; // http://www.2cycd.com/forum.php?mod=forumdisplay&fid=43&orderby=dateline diff --git a/lib/routes/30secondsofcode/category.ts b/lib/routes/30secondsofcode/category.ts index 430c480f70..71baa0a425 100644 --- a/lib/routes/30secondsofcode/category.ts +++ b/lib/routes/30secondsofcode/category.ts @@ -1,7 +1,10 @@ -import { Data, Route } from '@/types'; import { load } from 'cheerio'; + +import type { Data, Route } from '@/types'; import ofetch from '@/utils/ofetch'; + import { processList } from './utils'; + export const route: Route = { path: '/category/:category?/:subCategory?', categories: ['programming'], diff --git a/lib/routes/30secondsofcode/new-and-popular.ts b/lib/routes/30secondsofcode/new-and-popular.ts index 27f174bd80..1ab63ca40d 100644 --- a/lib/routes/30secondsofcode/new-and-popular.ts +++ b/lib/routes/30secondsofcode/new-and-popular.ts @@ -1,8 +1,10 @@ -import { Data, Route } from '@/types'; import { load } from 'cheerio'; -import { processList, rootUrl } from './utils'; + +import type { Data, Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import { processList, rootUrl } from './utils'; + export const route: Route = { path: '/latest', categories: ['programming'], diff --git a/lib/routes/30secondsofcode/utils.ts b/lib/routes/30secondsofcode/utils.ts index c3e88d9705..502ed2ba34 100644 --- a/lib/routes/30secondsofcode/utils.ts +++ b/lib/routes/30secondsofcode/utils.ts @@ -1,8 +1,9 @@ -import { DataItem } from '@/types'; import { load } from 'cheerio'; + +import type { DataItem } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import cache from '@/utils/cache'; export const rootUrl = 'https://www.30secondsofcode.org'; diff --git a/lib/routes/36kr/hot-list.ts b/lib/routes/36kr/hot-list.ts index a1dc2c1baa..8aeb7e0553 100644 --- a/lib/routes/36kr/hot-list.ts +++ b/lib/routes/36kr/hot-list.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { rootUrl, ProcessItem } from './utils'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; +import { ProcessItem, rootUrl } from './utils'; const categories = { 24: { diff --git a/lib/routes/36kr/index.ts b/lib/routes/36kr/index.ts index f3cfa9741e..1898c12eff 100644 --- a/lib/routes/36kr/index.ts +++ b/lib/routes/36kr/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { rootUrl, ProcessItem } from './utils'; +import { ProcessItem, rootUrl } from './utils'; const shortcuts = { '/information': '/information/web_news', diff --git a/lib/routes/36kr/utils.ts b/lib/routes/36kr/utils.ts index 857713c0e6..9c5e8d1018 100644 --- a/lib/routes/36kr/utils.ts +++ b/lib/routes/36kr/utils.ts @@ -1,7 +1,8 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; import CryptoJS from 'crypto-js'; +import got from '@/utils/got'; + const rootUrl = 'https://www.36kr.com'; const ProcessItem = (item, tryGet) => @@ -32,4 +33,4 @@ const ProcessItem = (item, tryGet) => return item; }); -export { rootUrl, ProcessItem }; +export { ProcessItem, rootUrl }; diff --git a/lib/routes/3dmgame/game.ts b/lib/routes/3dmgame/game.ts index f6bda17f81..888ce02f46 100644 --- a/lib/routes/3dmgame/game.ts +++ b/lib/routes/3dmgame/game.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + import { parseArticle } from './utils'; export const route: Route = { diff --git a/lib/routes/3dmgame/news-center.ts b/lib/routes/3dmgame/news-center.ts index 5c8da6f504..d106acbd08 100644 --- a/lib/routes/3dmgame/news-center.ts +++ b/lib/routes/3dmgame/news-center.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { parseArticle } from './utils'; export const route: Route = { diff --git a/lib/routes/3dmgame/utils.ts b/lib/routes/3dmgame/utils.ts index 4964382f93..37bda82424 100644 --- a/lib/routes/3dmgame/utils.ts +++ b/lib/routes/3dmgame/utils.ts @@ -1,5 +1,6 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/3kns/index.ts b/lib/routes/3kns/index.ts index 88503b317e..abbe118cf3 100644 --- a/lib/routes/3kns/index.ts +++ b/lib/routes/3kns/index.ts @@ -1,10 +1,12 @@ -import { Data, DataItem, Route } from '@/types'; +import path from 'node:path'; + +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { Data, DataItem, Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import { load } from 'cheerio'; -import { Context } from 'hono'; -import path from 'node:path'; export const route: Route = { path: '/:filters?/:order?', diff --git a/lib/routes/423down/index.ts b/lib/routes/423down/index.ts index e24c8d9c66..0a8f8c7b58 100644 --- a/lib/routes/423down/index.ts +++ b/lib/routes/423down/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const handler = async (ctx) => { const { category = '' } = ctx.req.param(); diff --git a/lib/routes/4gamers/category.ts b/lib/routes/4gamers/category.ts index 91b46000b3..076131dc16 100644 --- a/lib/routes/4gamers/category.ts +++ b/lib/routes/4gamers/category.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { parseList, parseItem, getCategories } from './utils'; + +import { getCategories, parseItem, parseList } from './utils'; export const route: Route = { path: ['/', '/category/:category'], diff --git a/lib/routes/4gamers/tag.ts b/lib/routes/4gamers/tag.ts index 5c5345cdcf..c9dba110e6 100644 --- a/lib/routes/4gamers/tag.ts +++ b/lib/routes/4gamers/tag.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { parseList, parseItem } from './utils'; + +import { parseItem, parseList } from './utils'; export const route: Route = { path: '/tag/:tag', diff --git a/lib/routes/4gamers/topic.ts b/lib/routes/4gamers/topic.ts index 07440a99d1..1e723898cd 100644 --- a/lib/routes/4gamers/topic.ts +++ b/lib/routes/4gamers/topic.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { parseList, parseItem } from './utils'; + +import { parseItem, parseList } from './utils'; export const route: Route = { path: '/topic/:topic', diff --git a/lib/routes/4gamers/utils.ts b/lib/routes/4gamers/utils.ts index 946ab598f5..5e7da9e823 100644 --- a/lib/routes/4gamers/utils.ts +++ b/lib/routes/4gamers/utils.ts @@ -1,8 +1,9 @@ -import got from '@/utils/got'; import path from 'node:path'; -import { art } from '@/utils/render'; -import { parseDate } from '@/utils/parse-date'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; const getCategories = (tryGet) => tryGet('4gamers:categories', async () => { @@ -65,4 +66,4 @@ const renderImages = (images) => images, }); -export { getCategories, parseList, parseItem, renderDescription, renderImages }; +export { getCategories, parseItem, parseList, renderDescription, renderImages }; diff --git a/lib/routes/4khd/article.ts b/lib/routes/4khd/article.ts index 9b9d894e78..75a2a585b0 100644 --- a/lib/routes/4khd/article.ts +++ b/lib/routes/4khd/article.ts @@ -1,6 +1,8 @@ import { load } from 'cheerio'; + import { parseDate } from '@/utils/parse-date'; -import { WPPost } from './types'; + +import type { WPPost } from './types'; const processImages = ($) => { $('a').each((_, elem) => { diff --git a/lib/routes/4khd/category.ts b/lib/routes/4khd/category.ts index 1674bdf3f4..34d93d5d85 100644 --- a/lib/routes/4khd/category.ts +++ b/lib/routes/4khd/category.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + import loadArticle from './article'; -import { WPPost } from './types'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; +import type { WPPost } from './types'; export const route: Route = { path: '/category/:category', diff --git a/lib/routes/4khd/latest.ts b/lib/routes/4khd/latest.ts index 68a5bc468a..62774ef857 100644 --- a/lib/routes/4khd/latest.ts +++ b/lib/routes/4khd/latest.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + import loadArticle from './article'; -import { WPPost } from './types'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; +import type { WPPost } from './types'; export const route: Route = { path: '/', diff --git a/lib/routes/4ksj/forum.ts b/lib/routes/4ksj/forum.ts index b635e0dd23..15f505c982 100644 --- a/lib/routes/4ksj/forum.ts +++ b/lib/routes/4ksj/forum.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import md5 from '@/utils/md5'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import md5 from '@/utils/md5'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:id?', diff --git a/lib/routes/4kup/article.ts b/lib/routes/4kup/article.ts index fbdbbbb52e..d0ff478743 100644 --- a/lib/routes/4kup/article.ts +++ b/lib/routes/4kup/article.ts @@ -1,6 +1,8 @@ import { load } from 'cheerio'; + import { parseDate } from '@/utils/parse-date'; -import { WPPost } from './types'; + +import type { WPPost } from './types'; const processLazyImages = ($) => { $('a.thumb-photo').each((_, elem) => { diff --git a/lib/routes/4kup/category.ts b/lib/routes/4kup/category.ts index e770a52a13..f4e2a64a23 100644 --- a/lib/routes/4kup/category.ts +++ b/lib/routes/4kup/category.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + import loadArticle from './article'; -import { WPPost } from './types'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; +import type { WPPost } from './types'; export const route: Route = { path: '/category/:category', diff --git a/lib/routes/4kup/latest.ts b/lib/routes/4kup/latest.ts index f29c26e84b..327b40bf9c 100644 --- a/lib/routes/4kup/latest.ts +++ b/lib/routes/4kup/latest.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + import loadArticle from './article'; -import { WPPost } from './types'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; +import type { WPPost } from './types'; export const route: Route = { path: '/', diff --git a/lib/routes/4kup/popular.ts b/lib/routes/4kup/popular.ts index f902c92193..b55d89e13d 100644 --- a/lib/routes/4kup/popular.ts +++ b/lib/routes/4kup/popular.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; + import loadArticle from './article'; -import { WPPost } from './types'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; +import type { WPPost } from './types'; export const route: Route = { path: '/popular/:period', diff --git a/lib/routes/4kup/tag.ts b/lib/routes/4kup/tag.ts index 7b828b5b57..023dca2de2 100644 --- a/lib/routes/4kup/tag.ts +++ b/lib/routes/4kup/tag.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + import loadArticle from './article'; -import { WPPost } from './types'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; +import type { WPPost } from './types'; export const route: Route = { path: '/tag/:tag', diff --git a/lib/routes/500px/tribe-set.ts b/lib/routes/500px/tribe-set.ts index 06ef8b69ef..29cf03604f 100644 --- a/lib/routes/500px/tribe-set.ts +++ b/lib/routes/500px/tribe-set.ts @@ -1,8 +1,9 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; import { baseUrl, getTribeDetail, getTribeSets } from './utils'; diff --git a/lib/routes/500px/utils.ts b/lib/routes/500px/utils.ts index 420f97a9f6..e80a9852e4 100644 --- a/lib/routes/500px/utils.ts +++ b/lib/routes/500px/utils.ts @@ -1,7 +1,8 @@ -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + import { config } from '@/config'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; const baseUrl = 'https://500px.com.cn'; @@ -113,4 +114,4 @@ const getTribeSets = (id, limit) => false ); -export { baseUrl, getUserInfoFromUsername, getUserInfoFromId, getUserWorks, getTribeDetail, getTribeSets }; +export { baseUrl, getTribeDetail, getTribeSets, getUserInfoFromId, getUserInfoFromUsername, getUserWorks }; diff --git a/lib/routes/50forum/zhuanjia.ts b/lib/routes/50forum/zhuanjia.ts index 20c04abfe3..beea528181 100644 --- a/lib/routes/50forum/zhuanjia.ts +++ b/lib/routes/50forum/zhuanjia.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/51cto/recommend.ts b/lib/routes/51cto/recommend.ts index 368280b31e..d18858624e 100644 --- a/lib/routes/51cto/recommend.ts +++ b/lib/routes/51cto/recommend.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import got from '@/utils/got'; -import { getToken, sign } from './utils'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; +import got from '@/utils/got'; import logger from '@/utils/logger'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + +import { getToken, sign } from './utils'; export const route: Route = { path: '/index/recommend', diff --git a/lib/routes/51cto/utils.ts b/lib/routes/51cto/utils.ts index 5d61b99cd8..912612053b 100644 --- a/lib/routes/51cto/utils.ts +++ b/lib/routes/51cto/utils.ts @@ -1,6 +1,6 @@ -import ofetch from '@/utils/ofetch'; import cache from '@/utils/cache'; import md5 from '@/utils/md5'; +import ofetch from '@/utils/ofetch'; export const getToken = () => cache.tryGet( diff --git a/lib/routes/51read/article.ts b/lib/routes/51read/article.ts index 6240362fa8..90018f53ea 100644 --- a/lib/routes/51read/article.ts +++ b/lib/routes/51read/article.ts @@ -1,7 +1,8 @@ import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import type { Route, DataItem } from '@/types'; export const route: Route = { path: '/article/:id', diff --git a/lib/routes/52hrtt/index.ts b/lib/routes/52hrtt/index.ts index 10839a243e..69860c718a 100644 --- a/lib/routes/52hrtt/index.ts +++ b/lib/routes/52hrtt/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/:area?/:type?', diff --git a/lib/routes/52hrtt/symposium.ts b/lib/routes/52hrtt/symposium.ts index 1beb6a7520..b01ea7dbad 100644 --- a/lib/routes/52hrtt/symposium.ts +++ b/lib/routes/52hrtt/symposium.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/symposium/:id?/:classId?', diff --git a/lib/routes/56kog/class.ts b/lib/routes/56kog/class.ts index baeacd026d..8d7fe4ecc3 100644 --- a/lib/routes/56kog/class.ts +++ b/lib/routes/56kog/class.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { rootUrl, fetchItems } from './util'; + +import { fetchItems, rootUrl } from './util'; export const route: Route = { path: '/class/:category?', diff --git a/lib/routes/56kog/top.ts b/lib/routes/56kog/top.ts index f4a2b7a927..f9176fd655 100644 --- a/lib/routes/56kog/top.ts +++ b/lib/routes/56kog/top.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { rootUrl, fetchItems } from './util'; + +import { fetchItems, rootUrl } from './util'; export const route: Route = { path: '/top/:category?', diff --git a/lib/routes/56kog/util.ts b/lib/routes/56kog/util.ts index 9eca660581..eea4914fa4 100644 --- a/lib/routes/56kog/util.ts +++ b/lib/routes/56kog/util.ts @@ -1,10 +1,12 @@ -import got from '@/utils/got'; +import path from 'node:path'; + import { load } from 'cheerio'; import iconv from 'iconv-lite'; -import timezone from '@/utils/timezone'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; const rootUrl = 'https://www.56kog.com'; @@ -105,4 +107,4 @@ const fetchItems = async (limit, currentUrl, tryGet) => { }; }; -export { rootUrl, fetchItems }; +export { fetchItems, rootUrl }; diff --git a/lib/routes/591/list.ts b/lib/routes/591/list.ts index 8a84bb6265..fcff9079e6 100644 --- a/lib/routes/591/list.ts +++ b/lib/routes/591/list.ts @@ -1,14 +1,13 @@ -import { Route } from '@/types'; - import path from 'node:path'; -import { CookieJar } from 'tough-cookie'; import { load } from 'cheerio'; +import { CookieJar } from 'tough-cookie'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; import { isValidHost } from '@/utils/valid-host'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const cookieJar = new CookieJar(); diff --git a/lib/routes/5eplay/index.ts b/lib/routes/5eplay/index.ts index 26c76bf4de..14de35b05f 100644 --- a/lib/routes/5eplay/index.ts +++ b/lib/routes/5eplay/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/5music/index.ts b/lib/routes/5music/index.ts index 6cae7b716a..8b25094898 100644 --- a/lib/routes/5music/index.ts +++ b/lib/routes/5music/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/69shu/article.ts b/lib/routes/69shu/article.ts index 4371e35dce..329038e67a 100644 --- a/lib/routes/69shu/article.ts +++ b/lib/routes/69shu/article.ts @@ -1,7 +1,8 @@ import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import type { Route, DataItem } from '@/types'; export const route: Route = { path: '/article/:id', diff --git a/lib/routes/6park/index.ts b/lib/routes/6park/index.ts index f4e2ee2170..42009e9e9a 100644 --- a/lib/routes/6park/index.ts +++ b/lib/routes/6park/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/index/:id?/:type?/:keyword?', diff --git a/lib/routes/6park/news.ts b/lib/routes/6park/news.ts index f63c0f6eb2..2050185e5d 100644 --- a/lib/routes/6park/news.ts +++ b/lib/routes/6park/news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/news/:site?/:id?/:keyword?', diff --git a/lib/routes/6v123/index.ts b/lib/routes/6v123/index.ts index 3ae896f619..51c1991f5d 100644 --- a/lib/routes/6v123/index.ts +++ b/lib/routes/6v123/index.ts @@ -1,14 +1,13 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type Context } from 'hono'; import iconv from 'iconv-lite'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + export const handler = async (ctx: Context): Promise => { const { category = 'dy' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '25', 10); diff --git a/lib/routes/6v123/latest-movies.ts b/lib/routes/6v123/latest-movies.ts index 7603380755..0a1a8a48a0 100644 --- a/lib/routes/6v123/latest-movies.ts +++ b/lib/routes/6v123/latest-movies.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { processItems } from './utils'; const baseURL = 'https://www.hao6v.cc/gvod/zx.html'; diff --git a/lib/routes/6v123/latest-tvseries.ts b/lib/routes/6v123/latest-tvseries.ts index 133f5d6992..e19fd5941a 100644 --- a/lib/routes/6v123/latest-tvseries.ts +++ b/lib/routes/6v123/latest-tvseries.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { processItems } from './utils'; const baseURL = 'https://www.hao6v.tv/gvod/dsj.html'; diff --git a/lib/routes/6v123/utils.ts b/lib/routes/6v123/utils.ts index d1425e8c58..f4e8bab909 100644 --- a/lib/routes/6v123/utils.ts +++ b/lib/routes/6v123/utils.ts @@ -1,9 +1,10 @@ +import { load } from 'cheerio'; +import iconv from 'iconv-lite'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import iconv from 'iconv-lite'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export async function loadDetailPage(link) { const response = await got.get(link, { diff --git a/lib/routes/78dm/index.ts b/lib/routes/78dm/index.ts index f45d6ebc01..d0ea3ca0f5 100644 --- a/lib/routes/78dm/index.ts +++ b/lib/routes/78dm/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 path from 'node:path'; +import timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { category = 'news' } = ctx.req.param(); diff --git a/lib/routes/7mmtv/index.ts b/lib/routes/7mmtv/index.ts index 3473277ff8..c77db04fa7 100644 --- a/lib/routes/7mmtv/index.ts +++ b/lib/routes/7mmtv/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:language?/:category?/:type?', diff --git a/lib/routes/81/81rc/index.ts b/lib/routes/81/81rc/index.ts index e702e9bb0a..ca8b876729 100644 --- a/lib/routes/81/81rc/index.ts +++ b/lib/routes/81/81rc/index.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { category = 'sy/gzdt_210283' } = ctx.req.param(); diff --git a/lib/routes/8264/list.ts b/lib/routes/8264/list.ts index f5782c9c4d..3e498aea0c 100644 --- a/lib/routes/8264/list.ts +++ b/lib/routes/8264/list.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/list/:id?', diff --git a/lib/routes/8kcos/article.ts b/lib/routes/8kcos/article.ts index 0c5491b65f..f6c2bdb116 100644 --- a/lib/routes/8kcos/article.ts +++ b/lib/routes/8kcos/article.ts @@ -1,4 +1,5 @@ import { load } from 'cheerio'; + import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/8kcos/cat.ts b/lib/routes/8kcos/cat.ts index 7790739f24..816c3525e8 100644 --- a/lib/routes/8kcos/cat.ts +++ b/lib/routes/8kcos/cat.ts @@ -1,9 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + import loadArticle from './article'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; + export const route: Route = { path: '/cat/:cat{.+}?', radar: [ diff --git a/lib/routes/8kcos/latest.ts b/lib/routes/8kcos/latest.ts index 8a4326e3cb..8a9860e8d9 100644 --- a/lib/routes/8kcos/latest.ts +++ b/lib/routes/8kcos/latest.ts @@ -1,9 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + import loadArticle from './article'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; + const url = SUB_URL; export const route: Route = { diff --git a/lib/routes/8kcos/tag.ts b/lib/routes/8kcos/tag.ts index 569aad0f44..c86040dfa9 100644 --- a/lib/routes/8kcos/tag.ts +++ b/lib/routes/8kcos/tag.ts @@ -1,9 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + import loadArticle from './article'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; + export const route: Route = { path: '/tag/:tag', categories: ['picture'], diff --git a/lib/routes/8world/index.ts b/lib/routes/8world/index.ts index 6030508009..d64bbbfa1e 100644 --- a/lib/routes/8world/index.ts +++ b/lib/routes/8world/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/91porn/author.ts b/lib/routes/91porn/author.ts index 019a4e863c..3fdfa94387 100644 --- a/lib/routes/91porn/author.ts +++ b/lib/routes/91porn/author.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; + import { domainValidation } from './utils'; export const route: Route = { diff --git a/lib/routes/91porn/index.ts b/lib/routes/91porn/index.ts index 0b0154ac0b..2a026e16af 100644 --- a/lib/routes/91porn/index.ts +++ b/lib/routes/91porn/index.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; + import { domainValidation } from './utils'; export const route: Route = { diff --git a/lib/routes/91porn/utils.ts b/lib/routes/91porn/utils.ts index 36c6a2e615..4f858554a0 100644 --- a/lib/routes/91porn/utils.ts +++ b/lib/routes/91porn/utils.ts @@ -1,5 +1,6 @@ import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; + const allowDomain = new Set(['91porn.com', 'www.91porn.com', '0122.91p30.com', 'www.91zuixindizhi.com', 'w1218.91p46.com']); const domainValidation = (domain) => { diff --git a/lib/routes/95mm/category.ts b/lib/routes/95mm/category.ts index b0338b01ad..fdca8c7c76 100644 --- a/lib/routes/95mm/category.ts +++ b/lib/routes/95mm/category.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; -import { rootUrl, ProcessItems } from './utils'; +import type { Route } from '@/types'; + +import { ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/category/:category', diff --git a/lib/routes/95mm/tab.ts b/lib/routes/95mm/tab.ts index 8d82f7b18b..e1780bc5f5 100644 --- a/lib/routes/95mm/tab.ts +++ b/lib/routes/95mm/tab.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; -import { rootUrl, ProcessItems } from './utils'; +import type { Route } from '@/types'; + +import { ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/tab/:tab?', diff --git a/lib/routes/95mm/tag.ts b/lib/routes/95mm/tag.ts index a3971b92c6..d0736ebd92 100644 --- a/lib/routes/95mm/tag.ts +++ b/lib/routes/95mm/tag.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; -import { rootUrl, ProcessItems } from './utils'; +import type { Route } from '@/types'; + +import { ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/tag/:tag', diff --git a/lib/routes/95mm/utils.ts b/lib/routes/95mm/utils.ts index d07ed4e3a1..33695a68cb 100644 --- a/lib/routes/95mm/utils.ts +++ b/lib/routes/95mm/utils.ts @@ -1,8 +1,10 @@ +import path from 'node:path'; + +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { art } from '@/utils/render'; -import path from 'node:path'; const rootUrl = 'https://www.95mm.vip'; @@ -57,4 +59,4 @@ const ProcessItems = async (ctx, title, currentUrl) => { }; }; -export { rootUrl, ProcessItems }; +export { ProcessItems, rootUrl }; diff --git a/lib/routes/9to5/subsite.ts b/lib/routes/9to5/subsite.ts index 45f0d62906..07b65cc641 100644 --- a/lib/routes/9to5/subsite.ts +++ b/lib/routes/9to5/subsite.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import parser from '@/utils/rss-parser'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/a9vg/index.ts b/lib/routes/a9vg/index.ts index 91b904dde9..dfbc158b94 100644 --- a/lib/routes/a9vg/index.ts +++ b/lib/routes/a9vg/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 path from 'node:path'; +import timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { category = 'news/All' } = ctx.req.param(); diff --git a/lib/routes/aa1/60s.ts b/lib/routes/aa1/60s.ts index 4865c50c22..a06612d248 100644 --- a/lib/routes/aa1/60s.ts +++ b/lib/routes/aa1/60s.ts @@ -1,11 +1,10 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; - import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + export const handler = async (ctx: Context): Promise => { const { category } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '100', 10); diff --git a/lib/routes/aamacau/index.ts b/lib/routes/aamacau/index.ts index e60135de14..0dd98c78af 100644 --- a/lib/routes/aamacau/index.ts +++ b/lib/routes/aamacau/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/abc/index.ts b/lib/routes/abc/index.ts index 4751bcfb4d..51d60073cf 100644 --- a/lib/routes/abc/index.ts +++ b/lib/routes/abc/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:category{.+}?', diff --git a/lib/routes/abmedia/category.ts b/lib/routes/abmedia/category.ts index e765529348..e12f635b6f 100644 --- a/lib/routes/abmedia/category.ts +++ b/lib/routes/abmedia/category.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/abmedia/index.ts b/lib/routes/abmedia/index.ts index 7270144763..7513d30b66 100644 --- a/lib/routes/abmedia/index.ts +++ b/lib/routes/abmedia/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/abskoop/index.ts b/lib/routes/abskoop/index.ts index 0d5268a486..7252758e93 100644 --- a/lib/routes/abskoop/index.ts +++ b/lib/routes/abskoop/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/abskoop/nsfw.ts b/lib/routes/abskoop/nsfw.ts index 602c604b21..4cc07f67c1 100644 --- a/lib/routes/abskoop/nsfw.ts +++ b/lib/routes/abskoop/nsfw.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/academia/topics.ts b/lib/routes/academia/topics.ts index c45c9937c4..c9dd643097 100644 --- a/lib/routes/academia/topics.ts +++ b/lib/routes/academia/topics.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + export const route: Route = { path: '/topic/:interest', example: '/academia/topic/Urban_History', diff --git a/lib/routes/accessbriefing/index.ts b/lib/routes/accessbriefing/index.ts index dcc8c805df..b613f516d9 100644 --- a/lib/routes/accessbriefing/index.ts +++ b/lib/routes/accessbriefing/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const handler = async (ctx) => { const { category = 'latest/news' } = ctx.req.param(); diff --git a/lib/routes/acfun/article.ts b/lib/routes/acfun/article.ts index 98c51a8a6a..847ad6fb36 100644 --- a/lib/routes/acfun/article.ts +++ b/lib/routes/acfun/article.ts @@ -1,9 +1,11 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const baseUrl = 'https://www.acfun.cn'; const categoryMap = { diff --git a/lib/routes/acfun/bangumi.ts b/lib/routes/acfun/bangumi.ts index 628215da48..1cbfb313ba 100644 --- a/lib/routes/acfun/bangumi.ts +++ b/lib/routes/acfun/bangumi.ts @@ -1,4 +1,5 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/acfun/video.ts b/lib/routes/acfun/video.ts index 855dcf5b15..cbf992f31e 100644 --- a/lib/routes/acfun/video.ts +++ b/lib/routes/acfun/video.ts @@ -1,6 +1,8 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/acg17/post.ts b/lib/routes/acg17/post.ts index ff9243de45..c3bd077cd6 100644 --- a/lib/routes/acg17/post.ts +++ b/lib/routes/acg17/post.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/acgvinyl/news.ts b/lib/routes/acgvinyl/news.ts index 528d70f369..3a8f618f08 100644 --- a/lib/routes/acgvinyl/news.ts +++ b/lib/routes/acgvinyl/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/acpaa/index.ts b/lib/routes/acpaa/index.ts index 37e141e49a..60707c5194 100644 --- a/lib/routes/acpaa/index.ts +++ b/lib/routes/acpaa/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/:id?/:name?', diff --git a/lib/routes/acs/journal.ts b/lib/routes/acs/journal.ts index f04f41e490..d04f778de8 100644 --- a/lib/routes/acs/journal.ts +++ b/lib/routes/acs/journal.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; + import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; +import { art } from '@/utils/render'; export const route: Route = { path: '/journal/:id', diff --git a/lib/routes/adquan/case-library.ts b/lib/routes/adquan/case-library.ts index 83cf24e5a7..c0336bc6a6 100644 --- a/lib/routes/adquan/case-library.ts +++ b/lib/routes/adquan/case-library.ts @@ -1,16 +1,16 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; - export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '24', 10); diff --git a/lib/routes/adquan/index.ts b/lib/routes/adquan/index.ts index 443ede0340..d15dfc7410 100644 --- a/lib/routes/adquan/index.ts +++ b/lib/routes/adquan/index.ts @@ -1,16 +1,16 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; - export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/aeaweb/index.ts b/lib/routes/aeaweb/index.ts index a75426e44a..0efe029f4a 100644 --- a/lib/routes/aeaweb/index.ts +++ b/lib/routes/aeaweb/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:id', diff --git a/lib/routes/aeon/category.ts b/lib/routes/aeon/category.ts index 0e298e27f6..bc87a7e54c 100644 --- a/lib/routes/aeon/category.ts +++ b/lib/routes/aeon/category.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; -import { getBuildId, getData } from './utils'; import { parseDate } from '@/utils/parse-date'; +import { getBuildId, getData } from './utils'; + export const route: Route = { path: '/category/:category', categories: ['new-media'], diff --git a/lib/routes/aeon/type.ts b/lib/routes/aeon/type.ts index 9b3a175230..581c25fa8c 100644 --- a/lib/routes/aeon/type.ts +++ b/lib/routes/aeon/type.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; -import { getBuildId, getData } from './utils'; import { parseDate } from '@/utils/parse-date'; +import { getBuildId, getData } from './utils'; + export const route: Route = { path: '/:type', categories: ['new-media'], diff --git a/lib/routes/aeon/utils.ts b/lib/routes/aeon/utils.ts index aed85eb99f..2e1d05fe83 100644 --- a/lib/routes/aeon/utils.ts +++ b/lib/routes/aeon/utils.ts @@ -1,10 +1,12 @@ -import cache from '@/utils/cache'; -import { load } from 'cheerio'; -import ofetch from '@/utils/ofetch'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; + import { config } from '@/config'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; export const getBuildId = () => cache.tryGet( diff --git a/lib/routes/afdian/dynamic.ts b/lib/routes/afdian/dynamic.ts index 539279154e..1b00bf34f2 100644 --- a/lib/routes/afdian/dynamic.ts +++ b/lib/routes/afdian/dynamic.ts @@ -1,5 +1,5 @@ -import got from '@/utils/got'; import type { Route } from '@/types'; +import got from '@/utils/got'; export const route: Route = { path: '/dynamic/:uid?', diff --git a/lib/routes/aflcio/blog.ts b/lib/routes/aflcio/blog.ts index 1896c88df5..66bdb90163 100644 --- a/lib/routes/aflcio/blog.ts +++ b/lib/routes/aflcio/blog.ts @@ -1,13 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '5', 10); diff --git a/lib/routes/afr/latest.ts b/lib/routes/afr/latest.ts index b656755cec..e70f92a596 100644 --- a/lib/routes/afr/latest.ts +++ b/lib/routes/afr/latest.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; import type { Context } from 'hono'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; + import { assetsConnectionByCriteriaQuery } from './query'; import { getItem } from './utils'; diff --git a/lib/routes/afr/navigation.ts b/lib/routes/afr/navigation.ts index cbe7421a29..d39e74c72a 100644 --- a/lib/routes/afr/navigation.ts +++ b/lib/routes/afr/navigation.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; import type { Context } from 'hono'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; + import { pageByNavigationPathQuery } from './query'; import { getItem } from './utils'; diff --git a/lib/routes/afr/utils.ts b/lib/routes/afr/utils.ts index c055ae9e70..f56d36248a 100644 --- a/lib/routes/afr/utils.ts +++ b/lib/routes/afr/utils.ts @@ -1,4 +1,5 @@ import * as cheerio from 'cheerio'; + import ofetch from '@/utils/ofetch'; export const getItem = async (item) => { diff --git a/lib/routes/agefans/detail.ts b/lib/routes/agefans/detail.ts index 8f01abb808..1cd53e2c2b 100644 --- a/lib/routes/agefans/detail.ts +++ b/lib/routes/agefans/detail.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; + import { rootUrl } from './utils'; export const route: Route = { diff --git a/lib/routes/agefans/update.ts b/lib/routes/agefans/update.ts index 8c987e0fd8..c7dbf3dd33 100644 --- a/lib/routes/agefans/update.ts +++ b/lib/routes/agefans/update.ts @@ -1,9 +1,11 @@ -import { DataItem, Route } from '@/types'; +import { load } from 'cheerio'; +import pMap from 'p-map'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import { rootUrl } from './utils'; -import pMap from 'p-map'; export const route: Route = { path: '/update', diff --git a/lib/routes/agirls/topic-list.ts b/lib/routes/agirls/topic-list.ts index ceaecbc35f..b7f1f0fff6 100644 --- a/lib/routes/agirls/topic-list.ts +++ b/lib/routes/agirls/topic-list.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; + import { baseUrl } from './utils'; export const route: Route = { diff --git a/lib/routes/agirls/topic.ts b/lib/routes/agirls/topic.ts index ee288eacb3..5ea7dc8a2b 100644 --- a/lib/routes/agirls/topic.ts +++ b/lib/routes/agirls/topic.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import { baseUrl, parseArticle } from './utils'; export const route: Route = { diff --git a/lib/routes/agirls/utils.ts b/lib/routes/agirls/utils.ts index 916c7d1c14..13059a6978 100644 --- a/lib/routes/agirls/utils.ts +++ b/lib/routes/agirls/utils.ts @@ -1,5 +1,6 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://agirls.aotter.net'; diff --git a/lib/routes/agirls/z-index.ts b/lib/routes/agirls/z-index.ts index 13c497641b..689668196f 100644 --- a/lib/routes/agirls/z-index.ts +++ b/lib/routes/agirls/z-index.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import { baseUrl, parseArticle } from './utils'; export const route: Route = { diff --git a/lib/routes/agora0/index.ts b/lib/routes/agora0/index.ts index dc287a6a3f..ed6f17a676 100644 --- a/lib/routes/agora0/index.ts +++ b/lib/routes/agora0/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/agora0/pen0.ts b/lib/routes/agora0/pen0.ts index 629e340f99..664e4aaeb2 100644 --- a/lib/routes/agora0/pen0.ts +++ b/lib/routes/agora0/pen0.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/agri/index.ts b/lib/routes/agri/index.ts index bd4d4ef9f1..07cf69db90 100644 --- a/lib/routes/agri/index.ts +++ b/lib/routes/agri/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 path from 'node:path'; +import timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { category = 'zx/zxfb/' } = ctx.req.param(); diff --git a/lib/routes/ahjzu/news.ts b/lib/routes/ahjzu/news.ts index 6a82f99b88..f3f6636457 100644 --- a/lib/routes/ahjzu/news.ts +++ b/lib/routes/ahjzu/news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/news', diff --git a/lib/routes/aiaa/journal.ts b/lib/routes/aiaa/journal.ts index 4ab11594a5..f196199a6e 100644 --- a/lib/routes/aiaa/journal.ts +++ b/lib/routes/aiaa/journal.ts @@ -1,7 +1,8 @@ -import { DataItem, Route } from '@/types'; +import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; export const route: Route = { name: 'ASR Articles', diff --git a/lib/routes/aibase/daily.ts b/lib/routes/aibase/daily.ts index dcf12dbb3c..9d83c5b601 100644 --- a/lib/routes/aibase/daily.ts +++ b/lib/routes/aibase/daily.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; -import { rootUrl, buildApiUrl } from './util'; -import cache from '@/utils/cache'; + +import { buildApiUrl, rootUrl } from './util'; export const route: Route = { path: '/daily', diff --git a/lib/routes/aibase/discover.ts b/lib/routes/aibase/discover.ts index d20fd8f6f1..3e592b386f 100644 --- a/lib/routes/aibase/discover.ts +++ b/lib/routes/aibase/discover.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { rootUrl, buildApiUrl, processItems } from './util'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + +import { buildApiUrl, processItems, rootUrl } from './util'; export const handler = async (ctx) => { const { id } = ctx.req.param(); diff --git a/lib/routes/aibase/news.ts b/lib/routes/aibase/news.ts index cdc173d01f..83cd1ebf0b 100644 --- a/lib/routes/aibase/news.ts +++ b/lib/routes/aibase/news.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; -import { rootUrl, buildApiUrl } from './util'; + +import { buildApiUrl, rootUrl } from './util'; export const route: Route = { path: '/news', diff --git a/lib/routes/aibase/topic.ts b/lib/routes/aibase/topic.ts index 8880e5ef23..dff5ea8ca4 100644 --- a/lib/routes/aibase/topic.ts +++ b/lib/routes/aibase/topic.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { rootUrl, buildApiUrl, processItems } from './util'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + +import { buildApiUrl, processItems, rootUrl } from './util'; export const handler = async (ctx) => { const { id, filter = 'id' } = ctx.req.param(); diff --git a/lib/routes/aibase/util.ts b/lib/routes/aibase/util.ts index e417c3c79a..5926f304f8 100644 --- a/lib/routes/aibase/util.ts +++ b/lib/routes/aibase/util.ts @@ -1,9 +1,11 @@ +import path from 'node:path'; + +import type { CheerioAPI } from 'cheerio'; + import ofetch from '@/utils/ofetch'; -import { CheerioAPI } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; const defaultSrc = '_static/ee6af7e.js'; const defaultToken = 'djflkdsoisknfoklsyhownfrlewfknoiaewf'; @@ -111,4 +113,4 @@ const processItems = (items: any[]): any[] => }; }); -export { rootUrl, processItems, buildApiUrl }; +export { buildApiUrl, processItems, rootUrl }; diff --git a/lib/routes/aiblog-2xv/archives.ts b/lib/routes/aiblog-2xv/archives.ts index d72bc2fca6..38528ecf74 100644 --- a/lib/routes/aiblog-2xv/archives.ts +++ b/lib/routes/aiblog-2xv/archives.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; export const route: Route = { path: '/archives', diff --git a/lib/routes/aicaijing/index.ts b/lib/routes/aicaijing/index.ts index 7e58207137..c57ee1cffd 100644 --- a/lib/routes/aicaijing/index.ts +++ b/lib/routes/aicaijing/index.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:category?/:id?', diff --git a/lib/routes/aiea/index.ts b/lib/routes/aiea/index.ts index 0d4a110969..d7ad69f45a 100644 --- a/lib/routes/aiea/index.ts +++ b/lib/routes/aiea/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import buildData from '@/utils/common-config'; export const route: Route = { diff --git a/lib/routes/aijishu/index.ts b/lib/routes/aijishu/index.ts index 522ad7d888..9371e56433 100644 --- a/lib/routes/aijishu/index.ts +++ b/lib/routes/aijishu/index.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import utils from './utils'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import utils from './utils'; + export const route: Route = { path: '/:type/:name?', categories: ['programming'], diff --git a/lib/routes/aijishu/utils.ts b/lib/routes/aijishu/utils.ts index c9f44616c9..6d4e2346d1 100644 --- a/lib/routes/aijishu/utils.ts +++ b/lib/routes/aijishu/utils.ts @@ -1,7 +1,8 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { parseRelativeDate, parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; +import { parseDate, parseRelativeDate } from '@/utils/parse-date'; const parseArticle = (item) => { const articleUrl = `https://aijishu.com${item.url || item.object.url}`; diff --git a/lib/routes/ainvest/article.ts b/lib/routes/ainvest/article.ts index e58f6e4faf..649e2bb327 100644 --- a/lib/routes/ainvest/article.ts +++ b/lib/routes/ainvest/article.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { getHeaders, randomString, encryptAES, decryptAES } from './utils'; + +import { decryptAES, encryptAES, getHeaders, randomString } from './utils'; export const route: Route = { path: '/article', diff --git a/lib/routes/ainvest/news.ts b/lib/routes/ainvest/news.ts index fe124fe214..59dc87aa11 100644 --- a/lib/routes/ainvest/news.ts +++ b/lib/routes/ainvest/news.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { getHeaders, randomString, decryptAES } from './utils'; + +import { decryptAES, getHeaders, randomString } from './utils'; export const route: Route = { path: '/news', diff --git a/lib/routes/ainvest/utils.ts b/lib/routes/ainvest/utils.ts index b67e8ea98c..49d15799aa 100644 --- a/lib/routes/ainvest/utils.ts +++ b/lib/routes/ainvest/utils.ts @@ -1,6 +1,7 @@ import crypto from 'node:crypto'; + import CryptoJS from 'crypto-js'; -import { KJUR, KEYUTIL, hextob64 } from 'jsrsasign'; +import { hextob64, KEYUTIL, KJUR } from 'jsrsasign'; const publicKey = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCARnxLlrhTK28bEV7s2IROjT73KLSjfqpKIvV8L+Yhe4BrF0Ut4oOH728HZlbSF0C3N0vXZjLAFesoS4v1pYOjVCPXl920Lh2seCv82m0cK78WMGuqZTfA44Nv7JsQMHC3+J6IZm8YD53ft2d8mYBFgKektduucjx8sObe7eRyoQIDAQAB'; @@ -65,4 +66,4 @@ const getHeaders = (key) => { }; }; -export { randomString, encryptAES, decryptAES, getHeaders }; +export { decryptAES, encryptAES, getHeaders, randomString }; diff --git a/lib/routes/aip/journal-pupp.ts b/lib/routes/aip/journal-pupp.ts index 32f73e72bf..a6eb8dcafd 100644 --- a/lib/routes/aip/journal-pupp.ts +++ b/lib/routes/aip/journal-pupp.ts @@ -1,10 +1,12 @@ -import cache from '@/utils/cache'; import { load } from 'cheerio'; -import { puppeteerGet, renderDesc } from './utils'; + import { config } from '@/config'; -import { isValidHost } from '@/utils/valid-host'; -import puppeteer from '@/utils/puppeteer'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import cache from '@/utils/cache'; +import puppeteer from '@/utils/puppeteer'; +import { isValidHost } from '@/utils/valid-host'; + +import { puppeteerGet, renderDesc } from './utils'; const handler = async (ctx) => { const pub = ctx.req.param('pub'); diff --git a/lib/routes/aip/journal.ts b/lib/routes/aip/journal.ts index 4a721ec7c3..f958c3a5b4 100644 --- a/lib/routes/aip/journal.ts +++ b/lib/routes/aip/journal.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; + import { renderDesc } from './utils'; export const route: Route = { diff --git a/lib/routes/aip/utils.ts b/lib/routes/aip/utils.ts index 24895b6f6d..1590c8d022 100644 --- a/lib/routes/aip/utils.ts +++ b/lib/routes/aip/utils.ts @@ -1,4 +1,5 @@ import path from 'node:path'; + import { art } from '@/utils/render'; const puppeteerGet = async (url, browser) => { diff --git a/lib/routes/air-level/index.ts b/lib/routes/air-level/index.ts index 93ba54123b..d5b05efdc4 100644 --- a/lib/routes/air-level/index.ts +++ b/lib/routes/air-level/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; // 统一使用的请求库 import { load } from 'cheerio'; // 类似 jQuery 的 API HTML 解析器 +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; // 统一使用的请求库 + export const route: Route = { path: '/air/:area', radar: [ diff --git a/lib/routes/air-level/levelrank.ts b/lib/routes/air-level/levelrank.ts index 31136891ae..856466be7b 100644 --- a/lib/routes/air-level/levelrank.ts +++ b/lib/routes/air-level/levelrank.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; // 统一使用的请求库 import { load } from 'cheerio'; // 类似 jQuery 的 API HTML 解析器 +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; // 统一使用的请求库 + export const route: Route = { path: ['/rank/:status?'], radar: [ diff --git a/lib/routes/airchina/index.ts b/lib/routes/airchina/index.ts index 7d53833956..dbe342e582 100644 --- a/lib/routes/airchina/index.ts +++ b/lib/routes/airchina/index.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import buildData from '@/utils/common-config'; +import got from '@/utils/got'; + const baseUrl = 'https://www.airchina.com.cn'; export const route: Route = { diff --git a/lib/routes/aisixiang/column.ts b/lib/routes/aisixiang/column.ts index 409cd29288..ba0d9f5363 100644 --- a/lib/routes/aisixiang/column.ts +++ b/lib/routes/aisixiang/column.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; -import { rootUrl, ossUrl, ProcessFeed } from './utils'; +import { ossUrl, ProcessFeed, rootUrl } from './utils'; export const route: Route = { path: '/column/:id', diff --git a/lib/routes/aisixiang/thinktank.ts b/lib/routes/aisixiang/thinktank.ts index 0d618a8403..d32d707996 100644 --- a/lib/routes/aisixiang/thinktank.ts +++ b/lib/routes/aisixiang/thinktank.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { rootUrl, ossUrl, ProcessFeed } from './utils'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + +import { ossUrl, ProcessFeed, rootUrl } from './utils'; export const route: Route = { path: '/thinktank/:id/:type?', diff --git a/lib/routes/aisixiang/toplist.ts b/lib/routes/aisixiang/toplist.ts index 0e9e2990e9..3599fe035e 100644 --- a/lib/routes/aisixiang/toplist.ts +++ b/lib/routes/aisixiang/toplist.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { rootUrl, ossUrl, ProcessFeed } from './utils'; +import { ossUrl, ProcessFeed, rootUrl } from './utils'; export const route: Route = { path: ['/ranking/:id?/:period?', '/toplist/:id?/:period?'], diff --git a/lib/routes/aisixiang/utils.ts b/lib/routes/aisixiang/utils.ts index 5e96958ab2..94ba3e62ec 100644 --- a/lib/routes/aisixiang/utils.ts +++ b/lib/routes/aisixiang/utils.ts @@ -1,7 +1,8 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const ossUrl = 'https://oss.aisixiang.com'; const rootUrl = 'https://www.aisixiang.com'; @@ -36,4 +37,4 @@ const ProcessFeed = (limit, tryGet, items) => ) ); -export { rootUrl, ossUrl, ProcessFeed }; +export { ossUrl, ProcessFeed, rootUrl }; diff --git a/lib/routes/aisixiang/zhuanti.ts b/lib/routes/aisixiang/zhuanti.ts index 4699f2b8c9..212adbd89c 100644 --- a/lib/routes/aisixiang/zhuanti.ts +++ b/lib/routes/aisixiang/zhuanti.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; -import { rootUrl, ossUrl, ProcessFeed } from './utils'; +import { ossUrl, ProcessFeed, rootUrl } from './utils'; export const route: Route = { path: '/zhuanti/:id', diff --git a/lib/routes/ajcass/shxyj.ts b/lib/routes/ajcass/shxyj.ts index e4324927d1..7402ef221e 100644 --- a/lib/routes/ajcass/shxyj.ts +++ b/lib/routes/ajcass/shxyj.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ajmide/index.ts b/lib/routes/ajmide/index.ts index 60394984c3..40fea47b35 100644 --- a/lib/routes/ajmide/index.ts +++ b/lib/routes/ajmide/index.ts @@ -1,4 +1,5 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/ali213/news.ts b/lib/routes/ali213/news.ts index c41d832b9f..dc3f03d566 100644 --- a/lib/routes/ali213/news.ts +++ b/lib/routes/ali213/news.ts @@ -1,15 +1,14 @@ import path from 'node:path'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type Context } from 'hono'; -import { type DataItem, type Route, type Data, ViewType } from '@/types'; - -import { art } from '@/utils/render'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; export const handler = async (ctx: Context): Promise => { diff --git a/lib/routes/ali213/zl.ts b/lib/routes/ali213/zl.ts index ac72236f36..baa7d1345e 100644 --- a/lib/routes/ali213/zl.ts +++ b/lib/routes/ali213/zl.ts @@ -1,15 +1,14 @@ import path from 'node:path'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type Context } from 'hono'; -import { type DataItem, type Route, type Data, ViewType } from '@/types'; - -import { art } from '@/utils/render'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { category } = ctx.req.param(); diff --git a/lib/routes/alicesoft/infomation.ts b/lib/routes/alicesoft/infomation.ts index dc855add30..0cffbbdf45 100644 --- a/lib/routes/alicesoft/infomation.ts +++ b/lib/routes/alicesoft/infomation.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + const baseUrl = 'https://www.alicesoft.com'; export const route: Route = { diff --git a/lib/routes/alipan/files.ts b/lib/routes/alipan/files.ts index ddb3730286..0c2b5d4587 100644 --- a/lib/routes/alipan/files.ts +++ b/lib/routes/alipan/files.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { AnonymousShareInfo, ShareList, TokenResponse } from './types'; + +import type { AnonymousShareInfo, ShareList, TokenResponse } from './types'; export const route: Route = { path: '/files/:share_id/:parent_file_id?', diff --git a/lib/routes/aliresearch/information.ts b/lib/routes/aliresearch/information.ts index 98ea075bec..2baf52a7c2 100644 --- a/lib/routes/aliresearch/information.ts +++ b/lib/routes/aliresearch/information.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/information/:type?', diff --git a/lib/routes/alistapart/index.ts b/lib/routes/alistapart/index.ts index c603423017..ded80ed7db 100644 --- a/lib/routes/alistapart/index.ts +++ b/lib/routes/alistapart/index.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { getData, getList } from './utils'; export const route: Route = { diff --git a/lib/routes/alistapart/topic.ts b/lib/routes/alistapart/topic.ts index 5dbe0d1e7d..350a682532 100644 --- a/lib/routes/alistapart/topic.ts +++ b/lib/routes/alistapart/topic.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { getData, getList } from './utils'; export const route: Route = { diff --git a/lib/routes/aliyun/database-month.ts b/lib/routes/aliyun/database-month.ts index 3fffe494e7..c005de1d56 100644 --- a/lib/routes/aliyun/database-month.ts +++ b/lib/routes/aliyun/database-month.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/database_month', diff --git a/lib/routes/aliyun/developer/group.ts b/lib/routes/aliyun/developer/group.ts index b2f1771777..60a01fbc9b 100644 --- a/lib/routes/aliyun/developer/group.ts +++ b/lib/routes/aliyun/developer/group.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/aliyun/notice.ts b/lib/routes/aliyun/notice.ts index 7dc3be6a57..f86cb0b642 100644 --- a/lib/routes/aliyun/notice.ts +++ b/lib/routes/aliyun/notice.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/aljazeera/index.ts b/lib/routes/aljazeera/index.ts index b1aa2cd161..40f93eb45b 100644 --- a/lib/routes/aljazeera/index.ts +++ b/lib/routes/aljazeera/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; - -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; import ofetch from '@/utils/ofetch'; +import { art } from '@/utils/render'; const languages = { arabic: { diff --git a/lib/routes/ally/rail.ts b/lib/routes/ally/rail.ts index 9db8b66f76..412d8bb9c4 100644 --- a/lib/routes/ally/rail.ts +++ b/lib/routes/ally/rail.ts @@ -1,6 +1,7 @@ -import { DataItem, Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/alpinelinux/pkgs.ts b/lib/routes/alpinelinux/pkgs.ts index ea0c180d20..bcaf1c4aa0 100644 --- a/lib/routes/alpinelinux/pkgs.ts +++ b/lib/routes/alpinelinux/pkgs.ts @@ -1,10 +1,11 @@ -import { Data, Route } from '@/types'; import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import { config } from '@/config'; +import type { Data, Route } from '@/types'; import cache from '@/utils/cache'; -import { Context } from 'hono'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; export const route: Route = { name: 'Packages', diff --git a/lib/routes/alternativeto/platform.ts b/lib/routes/alternativeto/platform.ts index 1369c3d920..8d3e5d1dfb 100644 --- a/lib/routes/alternativeto/platform.ts +++ b/lib/routes/alternativeto/platform.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import { baseURL, puppeteerGet } from './utils'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; + +import { baseURL, puppeteerGet } from './utils'; + export const route: Route = { path: '/platform/:name/:routeParams?', categories: ['programming'], diff --git a/lib/routes/alternativeto/software.ts b/lib/routes/alternativeto/software.ts index 8df4515ebb..8a23ff78b9 100644 --- a/lib/routes/alternativeto/software.ts +++ b/lib/routes/alternativeto/software.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import { baseURL, puppeteerGet } from './utils'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; + +import { baseURL, puppeteerGet } from './utils'; + export const route: Route = { path: '/software/:name/:routeParams?', categories: ['programming'], diff --git a/lib/routes/altotrain/news.ts b/lib/routes/altotrain/news.ts index b5eaa8cee7..b5d735f2b2 100644 --- a/lib/routes/altotrain/news.ts +++ b/lib/routes/altotrain/news.ts @@ -1,11 +1,15 @@ +import 'dayjs/locale/fr.js'; + +import type { Cheerio} from 'cheerio'; +import { load } from 'cheerio'; +import dayjs from 'dayjs'; +import localizedFormat from 'dayjs/plugin/localizedFormat.js'; +import type { Context } from 'hono'; + import type { Data, DataItem, Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { Cheerio, load } from 'cheerio'; -import dayjs from 'dayjs'; -import 'dayjs/locale/fr.js'; -import localizedFormat from 'dayjs/plugin/localizedFormat.js'; -import type { Context } from 'hono'; + dayjs.extend(localizedFormat); export const route: Route = { diff --git a/lib/routes/amazfitwatchfaces/index.ts b/lib/routes/amazfitwatchfaces/index.ts index 64a14f10eb..2ee9e63e1d 100644 --- a/lib/routes/amazfitwatchfaces/index.ts +++ b/lib/routes/amazfitwatchfaces/index.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { device, sort, searchParams } = ctx.req.param(); diff --git a/lib/routes/amazon/awsblogs.ts b/lib/routes/amazon/awsblogs.ts index 8fcdc32f0e..c925755156 100644 --- a/lib/routes/amazon/awsblogs.ts +++ b/lib/routes/amazon/awsblogs.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/amazon/kindle-software-updates.ts b/lib/routes/amazon/kindle-software-updates.ts index ce6ebd76e5..4af10e1fb6 100644 --- a/lib/routes/amazon/kindle-software-updates.ts +++ b/lib/routes/amazon/kindle-software-updates.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { load } from 'cheerio'; + const host = 'https://www.amazon.com'; export const route: Route = { path: '/kindle/software-updates', diff --git a/lib/routes/amz123/kx.ts b/lib/routes/amz123/kx.ts index 329b764b3f..b662c520c5 100644 --- a/lib/routes/amz123/kx.ts +++ b/lib/routes/amz123/kx.ts @@ -1,4 +1,5 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/android/platform-tools-releases.ts b/lib/routes/android/platform-tools-releases.ts index cd50bd812e..b8a7ac5794 100644 --- a/lib/routes/android/platform-tools-releases.ts +++ b/lib/routes/android/platform-tools-releases.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/android/security-bulletin.ts b/lib/routes/android/security-bulletin.ts index 4f29e7c8ee..b81271a129 100644 --- a/lib/routes/android/security-bulletin.ts +++ b/lib/routes/android/security-bulletin.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; + export const route: Route = { path: '/security-bulletin', categories: ['program-update'], diff --git a/lib/routes/anime1/anime.ts b/lib/routes/anime1/anime.ts index a106a001c5..5537c1e956 100644 --- a/lib/routes/anime1/anime.ts +++ b/lib/routes/anime1/anime.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + export const route: Route = { path: 'anime/:category/:name', name: 'Anime', diff --git a/lib/routes/anime1/search.ts b/lib/routes/anime1/search.ts index 2e2e8fa806..773cd69ebd 100644 --- a/lib/routes/anime1/search.ts +++ b/lib/routes/anime1/search.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + export const route: Route = { path: 'search/:keyword', name: 'Search', diff --git a/lib/routes/annualreviews/index.ts b/lib/routes/annualreviews/index.ts index 679f95cbc2..6329050781 100644 --- a/lib/routes/annualreviews/index.ts +++ b/lib/routes/annualreviews/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/anquanke/category.ts b/lib/routes/anquanke/category.ts index dbc4e5f7f4..2da6a9349e 100644 --- a/lib/routes/anquanke/category.ts +++ b/lib/routes/anquanke/category.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/anquanke/vul.ts b/lib/routes/anquanke/vul.ts index e8eea8f717..1ecdf681ab 100644 --- a/lib/routes/anquanke/vul.ts +++ b/lib/routes/anquanke/vul.ts @@ -1,5 +1,6 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const handler = async () => { diff --git a/lib/routes/anthropic/engineering.ts b/lib/routes/anthropic/engineering.ts index a325831d6d..794e7b0f03 100644 --- a/lib/routes/anthropic/engineering.ts +++ b/lib/routes/anthropic/engineering.ts @@ -1,8 +1,9 @@ -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import cache from '@/utils/cache'; -import { Route } from '@/types'; import pMap from 'p-map'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/anthropic/news.ts b/lib/routes/anthropic/news.ts index 9665209cf4..e827f9c10d 100644 --- a/lib/routes/anthropic/news.ts +++ b/lib/routes/anthropic/news.ts @@ -1,9 +1,10 @@ -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import cache from '@/utils/cache'; -import { DataItem, Route } from '@/types'; import pMap from 'p-map'; +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + export const route: Route = { path: '/news', categories: ['programming'], diff --git a/lib/routes/anthropic/research.ts b/lib/routes/anthropic/research.ts index 7fa69d408b..55961d98a8 100644 --- a/lib/routes/anthropic/research.ts +++ b/lib/routes/anthropic/research.ts @@ -1,8 +1,9 @@ -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import cache from '@/utils/cache'; -import { Route } from '@/types'; import pMap from 'p-map'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/anytxt/release-notes.ts b/lib/routes/anytxt/release-notes.ts index 05e7dac65f..f8e2975ddd 100644 --- a/lib/routes/anytxt/release-notes.ts +++ b/lib/routes/anytxt/release-notes.ts @@ -1,12 +1,11 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/apache/apisix/blog.ts b/lib/routes/apache/apisix/blog.ts index d1b65259ab..8bf1d32742 100644 --- a/lib/routes/apache/apisix/blog.ts +++ b/lib/routes/apache/apisix/blog.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; async function getArticles() { diff --git a/lib/routes/apiseven/blog.ts b/lib/routes/apiseven/blog.ts index 910db1836e..eb53f4bcda 100644 --- a/lib/routes/apiseven/blog.ts +++ b/lib/routes/apiseven/blog.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import MarkdownIt from 'markdown-it'; const md = MarkdownIt({ html: true, diff --git a/lib/routes/apkpure/versions.ts b/lib/routes/apkpure/versions.ts index 300c00931a..19d288ede3 100644 --- a/lib/routes/apkpure/versions.ts +++ b/lib/routes/apkpure/versions.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import logger from '@/utils/logger'; import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; diff --git a/lib/routes/apnews/mobile-api.ts b/lib/routes/apnews/mobile-api.ts index 692e45df81..b63d79a9ce 100644 --- a/lib/routes/apnews/mobile-api.ts +++ b/lib/routes/apnews/mobile-api.ts @@ -1,9 +1,12 @@ -import { Route, ViewType } from '@/types'; -import { fetchArticle } from './utils'; import pMap from 'p-map'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { fetchArticle } from './utils'; + export const route: Route = { path: '/mobile/:path{.+}?', categories: ['traditional-media'], diff --git a/lib/routes/apnews/rss.ts b/lib/routes/apnews/rss.ts index c14ad46713..3392d90a31 100644 --- a/lib/routes/apnews/rss.ts +++ b/lib/routes/apnews/rss.ts @@ -1,6 +1,9 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import parser from '@/utils/rss-parser'; + import { fetchArticle } from './utils'; + const HOME_PAGE = 'https://apnews.com'; export const route: Route = { diff --git a/lib/routes/apnews/sitemap.ts b/lib/routes/apnews/sitemap.ts index 833cbceb27..dfc131a0d0 100644 --- a/lib/routes/apnews/sitemap.ts +++ b/lib/routes/apnews/sitemap.ts @@ -1,10 +1,14 @@ -import { Route, ViewType } from '@/types'; -import { fetchArticle } from './utils'; -import pMap from 'p-map'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import pMap from 'p-map'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + +import { fetchArticle } from './utils'; + const HOME_PAGE = 'https://apnews.com'; export const route: Route = { diff --git a/lib/routes/apnews/topics.ts b/lib/routes/apnews/topics.ts index 96185f087b..7215fe2c39 100644 --- a/lib/routes/apnews/topics.ts +++ b/lib/routes/apnews/topics.ts @@ -1,8 +1,12 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { fetchArticle, removeDuplicateByKey } from './utils'; import pMap from 'p-map'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; + +import { fetchArticle, removeDuplicateByKey } from './utils'; + const HOME_PAGE = 'https://apnews.com'; export const route: Route = { diff --git a/lib/routes/apnews/utils.ts b/lib/routes/apnews/utils.ts index b8ce492725..083c19fb9a 100644 --- a/lib/routes/apnews/utils.ts +++ b/lib/routes/apnews/utils.ts @@ -1,7 +1,8 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; export function removeDuplicateByKey(items, key: string) { return [...new Map(items.map((x) => [x[key], x])).values()]; diff --git a/lib/routes/apnic/index.ts b/lib/routes/apnic/index.ts index 6570faec28..fcf98adb86 100644 --- a/lib/routes/apnic/index.ts +++ b/lib/routes/apnic/index.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/app-center/release.ts b/lib/routes/app-center/release.ts index e5f014e908..ebe6106ea4 100644 --- a/lib/routes/app-center/release.ts +++ b/lib/routes/app-center/release.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import MarkdownIt from 'markdown-it'; export const route: Route = { path: '/release/:user/:app/:distribution_group', diff --git a/lib/routes/app-sales/index.ts b/lib/routes/app-sales/index.ts index b1f7ee9e98..07ed4170d2 100644 --- a/lib/routes/app-sales/index.ts +++ b/lib/routes/app-sales/index.ts @@ -1,10 +1,9 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; - import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; + import { baseUrl, fetchItems } from './util'; export const handler = async (ctx: Context): Promise => { diff --git a/lib/routes/app-sales/mostwanted.ts b/lib/routes/app-sales/mostwanted.ts index dfbd32dd67..2469ee7985 100644 --- a/lib/routes/app-sales/mostwanted.ts +++ b/lib/routes/app-sales/mostwanted.ts @@ -1,10 +1,9 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; - import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; + import { baseUrl, fetchItems } from './util'; export const handler = async (ctx: Context): Promise => { diff --git a/lib/routes/app-sales/util.ts b/lib/routes/app-sales/util.ts index 18c92b21be..e58783d873 100644 --- a/lib/routes/app-sales/util.ts +++ b/lib/routes/app-sales/util.ts @@ -1,12 +1,12 @@ -import { type DataItem } from '@/types'; - -import { art } from '@/utils/render'; -import ofetch from '@/utils/ofetch'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; import path from 'node:path'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; + +import { type DataItem } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { art } from '@/utils/render'; + const baseUrl: string = 'https://www.app-sales.net'; /** diff --git a/lib/routes/apple/apps.ts b/lib/routes/apple/apps.ts index fdcba82d68..fd09d51bde 100644 --- a/lib/routes/apple/apps.ts +++ b/lib/routes/apple/apps.ts @@ -1,6 +1,8 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; + import { appstoreBearerToken } from './utils'; const platformIds = { diff --git a/lib/routes/apple/design.ts b/lib/routes/apple/design.ts index 7569420f25..db5d470453 100644 --- a/lib/routes/apple/design.ts +++ b/lib/routes/apple/design.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import ofetch from '@/utils/ofetch'; -import md5 from '@/utils/md5'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import md5 from '@/utils/md5'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + export const route: Route = { categories: ['design'], example: '/apple/design', diff --git a/lib/routes/apple/exchange-repair.ts b/lib/routes/apple/exchange-repair.ts index 8eb4918331..1f879c470e 100644 --- a/lib/routes/apple/exchange-repair.ts +++ b/lib/routes/apple/exchange-repair.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const host = 'https://support.apple.com/'; export const route: Route = { diff --git a/lib/routes/apple/podcast.ts b/lib/routes/apple/podcast.ts index 07853678af..d73d90fe34 100644 --- a/lib/routes/apple/podcast.ts +++ b/lib/routes/apple/podcast.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import cache from '@/utils/cache'; + import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/podcast/:id/:region?', diff --git a/lib/routes/apple/security-releases.ts b/lib/routes/apple/security-releases.ts index bfc1a2458e..94ea8e6981 100644 --- a/lib/routes/apple/security-releases.ts +++ b/lib/routes/apple/security-releases.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { language = 'en-us' } = ctx.req.param(); diff --git a/lib/routes/apple/utils.ts b/lib/routes/apple/utils.ts index 14f88a7465..04cbf4b867 100644 --- a/lib/routes/apple/utils.ts +++ b/lib/routes/apple/utils.ts @@ -1,7 +1,8 @@ -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + import { config } from '@/config'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; // App Store and Podcast use different bearer tokens export const appstoreBearerToken = () => diff --git a/lib/routes/appleinsider/index.ts b/lib/routes/appleinsider/index.ts index bc5e5e1e35..227b4c299d 100644 --- a/lib/routes/appleinsider/index.ts +++ b/lib/routes/appleinsider/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/appstare/comments.ts b/lib/routes/appstare/comments.ts index 8db1faf2f7..cc8d072cdb 100644 --- a/lib/routes/appstare/comments.ts +++ b/lib/routes/appstare/comments.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const handler = async (ctx) => { diff --git a/lib/routes/appstore/in-app-purchase.ts b/lib/routes/appstore/in-app-purchase.ts index d7d4cd27af..94688010f0 100644 --- a/lib/routes/appstore/in-app-purchase.ts +++ b/lib/routes/appstore/in-app-purchase.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + import { appstoreBearerToken } from '@/routes/apple/utils'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; export const route: Route = { path: '/iap/:country/:id', diff --git a/lib/routes/appstore/price.ts b/lib/routes/appstore/price.ts index 996a274315..829df08ea3 100644 --- a/lib/routes/appstore/price.ts +++ b/lib/routes/appstore/price.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import currency from 'currency-symbol-map'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/price/:country/:type/:id', categories: ['program-update'], diff --git a/lib/routes/appstore/xianmian.ts b/lib/routes/appstore/xianmian.ts index 11954d0429..c4cabc5cd8 100644 --- a/lib/routes/appstore/xianmian.ts +++ b/lib/routes/appstore/xianmian.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/appstorrent/programs.ts b/lib/routes/appstorrent/programs.ts index 75fc01bac5..3e273623bf 100644 --- a/lib/routes/appstorrent/programs.ts +++ b/lib/routes/appstorrent/programs.ts @@ -1,12 +1,15 @@ -import { Data, DataItem, Route } from '@/types'; -import cache from '@/utils/cache'; -import got, { Options } from '@/utils/got'; -import { parseDate } from '@/utils/parse-date'; -import { art } from '@/utils/render'; +import path from 'node:path'; + import { load } from 'cheerio'; import dayjs from 'dayjs'; -import { Context } from 'hono'; -import path from 'node:path'; +import type { Context } from 'hono'; + +import type { Data, DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import type { Options } from '@/utils/got'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; export const route: Route = { path: '/programs', diff --git a/lib/routes/aqara/community.ts b/lib/routes/aqara/community.ts index dfeaf2a8ab..2d9a136db9 100644 --- a/lib/routes/aqara/community.ts +++ b/lib/routes/aqara/community.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/aqara/news.ts b/lib/routes/aqara/news.ts index f812916c70..898ea0dac6 100644 --- a/lib/routes/aqara/news.ts +++ b/lib/routes/aqara/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/aqara/post.ts b/lib/routes/aqara/post.ts index 3bbd283fea..d64e1d96a4 100644 --- a/lib/routes/aqara/post.ts +++ b/lib/routes/aqara/post.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import { getSubPath } from '@/utils/common-utils'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '*', diff --git a/lib/routes/aqara/region.ts b/lib/routes/aqara/region.ts index 48174a0834..b321cfeb54 100644 --- a/lib/routes/aqara/region.ts +++ b/lib/routes/aqara/region.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + export const route: Route = { path: '/:region/:type?', name: 'Unknown', diff --git a/lib/routes/aqicn/aqi.ts b/lib/routes/aqicn/aqi.ts index f5f94a129e..6f07c3e636 100644 --- a/lib/routes/aqicn/aqi.ts +++ b/lib/routes/aqicn/aqi.ts @@ -1,6 +1,6 @@ +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { Route } from '@/types'; export const route: Route = { path: '/:city/:pollution?', diff --git a/lib/routes/arcteryx/new-arrivals.ts b/lib/routes/arcteryx/new-arrivals.ts index 49f15c9b9a..6885aab2c4 100644 --- a/lib/routes/arcteryx/new-arrivals.ts +++ b/lib/routes/arcteryx/new-arrivals.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; + import { generateRssData } from './utils'; export const route: Route = { diff --git a/lib/routes/arcteryx/outlet.ts b/lib/routes/arcteryx/outlet.ts index 4fbc66e79b..71020df27c 100644 --- a/lib/routes/arcteryx/outlet.ts +++ b/lib/routes/arcteryx/outlet.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; + import { generateRssData } from './utils'; export const route: Route = { diff --git a/lib/routes/arcteryx/regear-new-arrivals.ts b/lib/routes/arcteryx/regear-new-arrivals.ts index 8c89e55ed7..a0dba42937 100644 --- a/lib/routes/arcteryx/regear-new-arrivals.ts +++ b/lib/routes/arcteryx/regear-new-arrivals.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + const host = 'https://www.regear.arcteryx.com'; function getUSDPrice(number) { return (number / 100).toLocaleString('en-US', { style: 'currency', currency: 'USD' }); diff --git a/lib/routes/artstation/user.ts b/lib/routes/artstation/user.ts index 403bfac2bf..420b99aae6 100644 --- a/lib/routes/artstation/user.ts +++ b/lib/routes/artstation/user.ts @@ -1,12 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import path from 'node:path'; import { art } from '@/utils/render'; -import { config } from '@/config'; export const route: Route = { path: '/:handle', diff --git a/lib/routes/asiafruitchina/categories.ts b/lib/routes/asiafruitchina/categories.ts index c63053946f..51fd1970fc 100644 --- a/lib/routes/asiafruitchina/categories.ts +++ b/lib/routes/asiafruitchina/categories.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { category = 'all' } = ctx.req.param(); diff --git a/lib/routes/asiafruitchina/news.ts b/lib/routes/asiafruitchina/news.ts index d4d3ef3561..d624c4d4a8 100644 --- a/lib/routes/asiafruitchina/news.ts +++ b/lib/routes/asiafruitchina/news.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/asianfanfics/tag.ts b/lib/routes/asianfanfics/tag.ts index e834630928..60e7eb8f35 100644 --- a/lib/routes/asianfanfics/tag.ts +++ b/lib/routes/asianfanfics/tag.ts @@ -1,9 +1,9 @@ -import { DataItem, Route } from '@/types'; +import { load } from 'cheerio'; import { config } from '@/config'; +import type { DataItem, Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; // test url http://localhost:1200/asianfanfics/tag/milklove/N diff --git a/lib/routes/asianfanfics/text-search.ts b/lib/routes/asianfanfics/text-search.ts index d6b8fb0041..35e915c1f4 100644 --- a/lib/routes/asianfanfics/text-search.ts +++ b/lib/routes/asianfanfics/text-search.ts @@ -1,8 +1,9 @@ +import { load } from 'cheerio'; + import { config } from '@/config'; -import { DataItem, Route } from '@/types'; +import type { DataItem, Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; // test url http://localhost:1200/asianfanfics/text-search/milklove diff --git a/lib/routes/asiantolick/index.ts b/lib/routes/asiantolick/index.ts index 55ff5782e0..6000d8151b 100644 --- a/lib/routes/asiantolick/index.ts +++ b/lib/routes/asiantolick/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:category{.+}?', diff --git a/lib/routes/asmr-200/index.ts b/lib/routes/asmr-200/index.ts index aae88f9e28..293f22ffb9 100644 --- a/lib/routes/asmr-200/index.ts +++ b/lib/routes/asmr-200/index.ts @@ -1,7 +1,8 @@ -import { Result, Work } from '@/routes/asmr-200/type'; -import { DataItem, Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import path from 'node:path'; + +import type { Result, Work } from '@/routes/asmr-200/type'; +import type { DataItem, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/asus/bios.ts b/lib/routes/asus/bios.ts index aa74ef54d8..ad34d46a89 100644 --- a/lib/routes/asus/bios.ts +++ b/lib/routes/asus/bios.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import cache from '@/utils/cache'; const endPoints = { zh: { diff --git a/lib/routes/asus/gpu-tweak.ts b/lib/routes/asus/gpu-tweak.ts index 54ea508f4a..75e87aad69 100644 --- a/lib/routes/asus/gpu-tweak.ts +++ b/lib/routes/asus/gpu-tweak.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + const pageUrl = 'https://www.asus.com/campaign/GPU-Tweak-III/tw/index.php'; export const route: Route = { diff --git a/lib/routes/atcoder/contest.ts b/lib/routes/atcoder/contest.ts index 7e29b3ff5f..270a9689a9 100644 --- a/lib/routes/atcoder/contest.ts +++ b/lib/routes/atcoder/contest.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/atcoder/post.ts b/lib/routes/atcoder/post.ts index 01ce18ee50..55130f7687 100644 --- a/lib/routes/atcoder/post.ts +++ b/lib/routes/atcoder/post.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/post/:language?/:keyword?', diff --git a/lib/routes/atptour/news.ts b/lib/routes/atptour/news.ts index a5698bdd34..0382bf2ecd 100644 --- a/lib/routes/atptour/news.ts +++ b/lib/routes/atptour/news.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import got from '@/utils/got'; import { config } from '@/config'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/news/:lang?', diff --git a/lib/routes/augmentcode/blog.ts b/lib/routes/augmentcode/blog.ts index f816bdec5c..126bda8d05 100644 --- a/lib/routes/augmentcode/blog.ts +++ b/lib/routes/augmentcode/blog.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '50', 10); diff --git a/lib/routes/auto-stats/index.ts b/lib/routes/auto-stats/index.ts index 350de7136b..e5c1640cb7 100644 --- a/lib/routes/auto-stats/index.ts +++ b/lib/routes/auto-stats/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/autocentre/index.ts b/lib/routes/autocentre/index.ts index 7a434f5a7f..3ee5c01303 100644 --- a/lib/routes/autocentre/index.ts +++ b/lib/routes/autocentre/index.ts @@ -1,4 +1,4 @@ -import { Data, Route } from '@/types'; +import type { Data, Route } from '@/types'; import parser from '@/utils/rss-parser'; export const route: Route = { diff --git a/lib/routes/azul/packages.ts b/lib/routes/azul/packages.ts index e630ccd599..4aba0504f1 100644 --- a/lib/routes/azul/packages.ts +++ b/lib/routes/azul/packages.ts @@ -1,10 +1,9 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; - import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; + export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/baai/events.ts b/lib/routes/baai/events.ts index 779c9de48f..6fc1cbbfee 100644 --- a/lib/routes/baai/events.ts +++ b/lib/routes/baai/events.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { baseUrl, apiHost, parseEventDetail, parseItem } from './utils'; +import { apiHost, baseUrl, parseEventDetail, parseItem } from './utils'; export const route: Route = { path: '/hub/events', diff --git a/lib/routes/baai/hub.ts b/lib/routes/baai/hub.ts index 92c2266ee7..93877d157c 100644 --- a/lib/routes/baai/hub.ts +++ b/lib/routes/baai/hub.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { baseUrl, apiHost, getTagsData, parseEventDetail, parseItem } from './utils'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + +import { apiHost, baseUrl, getTagsData, parseEventDetail, parseItem } from './utils'; export const route: Route = { path: ['/hub/:tagId?/:sort?/:range?'], diff --git a/lib/routes/baai/utils.ts b/lib/routes/baai/utils.ts index f6d4a48352..c54648ad67 100644 --- a/lib/routes/baai/utils.ts +++ b/lib/routes/baai/utils.ts @@ -1,8 +1,9 @@ -import ofetch from '@/utils/ofetch'; import { destr } from 'destr'; + +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import cache from '@/utils/cache'; const baseUrl = 'https://hub.baai.ac.cn'; const eventUrl = 'https://event.baai.ac.cn'; @@ -39,4 +40,4 @@ const parseEventDetail = async (item) => { return data.data.ac_desc + data.data.ac_desc_two; }; -export { baseUrl, eventUrl, apiHost, getTagsData, parseItem, parseEventDetail }; +export { apiHost, baseUrl, eventUrl, getTagsData, parseEventDetail, parseItem }; diff --git a/lib/routes/backlinko/blog.ts b/lib/routes/backlinko/blog.ts index b87325cf9a..a90fe1bde0 100644 --- a/lib/routes/backlinko/blog.ts +++ b/lib/routes/backlinko/blog.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/bad/index.ts b/lib/routes/bad/index.ts index 9df29dcd7d..a821ead9b6 100644 --- a/lib/routes/bad/index.ts +++ b/lib/routes/bad/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '*', diff --git a/lib/routes/baidu/gushitong/index.ts b/lib/routes/baidu/gushitong/index.ts index b51ca0056c..27212464f2 100644 --- a/lib/routes/baidu/gushitong/index.ts +++ b/lib/routes/baidu/gushitong/index.ts @@ -1,8 +1,9 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; const STATUS_MAP = { up: '上涨', diff --git a/lib/routes/baidu/search.ts b/lib/routes/baidu/search.ts index 7c95c0d36e..0ea1539cdf 100644 --- a/lib/routes/baidu/search.ts +++ b/lib/routes/baidu/search.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { art } from '@/utils/render'; -import path from 'node:path'; + const renderDescription = (description, images) => art(path.join(__dirname, './templates/description.art'), { description, images }); -import { config } from '@/config'; export const route: Route = { path: '/search/:keyword', diff --git a/lib/routes/baidu/tieba/forum.ts b/lib/routes/baidu/tieba/forum.ts index fe432fcd3a..04d912a248 100644 --- a/lib/routes/baidu/tieba/forum.ts +++ b/lib/routes/baidu/tieba/forum.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: ['/tieba/forum/good/:kw/:cid?/:sortBy?', '/tieba/forum/:kw/:sortBy?'], diff --git a/lib/routes/baidu/tieba/post.ts b/lib/routes/baidu/tieba/post.ts index d5e9cd067d..9ce26f3fc4 100644 --- a/lib/routes/baidu/tieba/post.ts +++ b/lib/routes/baidu/tieba/post.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; /** * 获取最新的帖子回复(倒序查看) diff --git a/lib/routes/baidu/tieba/search.ts b/lib/routes/baidu/tieba/search.ts index b2356b8eba..e2240fa3ed 100644 --- a/lib/routes/baidu/tieba/search.ts +++ b/lib/routes/baidu/tieba/search.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/tieba/search/:qw/:routeParams?', diff --git a/lib/routes/baidu/tieba/user.ts b/lib/routes/baidu/tieba/user.ts index 73448bddb9..a5a9288e45 100644 --- a/lib/routes/baidu/tieba/user.ts +++ b/lib/routes/baidu/tieba/user.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/baidu/top.ts b/lib/routes/baidu/top.ts index 7ff72313be..fedce7cdeb 100644 --- a/lib/routes/baidu/top.ts +++ b/lib/routes/baidu/top.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + export const route: Route = { path: '/top/:board?', categories: ['other'], diff --git a/lib/routes/baijing/index.ts b/lib/routes/baijing/index.ts index 79b2bda6b4..c0918ba51c 100644 --- a/lib/routes/baijing/index.ts +++ b/lib/routes/baijing/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/article', diff --git a/lib/routes/bakamh/manga.ts b/lib/routes/bakamh/manga.ts index 10f538227e..3bad01f2f8 100644 --- a/lib/routes/bakamh/manga.ts +++ b/lib/routes/bakamh/manga.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; const url = 'https://bakamh.com'; diff --git a/lib/routes/bandcamp/live.ts b/lib/routes/bandcamp/live.ts index 845d021568..a6c3ef8102 100644 --- a/lib/routes/bandcamp/live.ts +++ b/lib/routes/bandcamp/live.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/bandcamp/tag.ts b/lib/routes/bandcamp/tag.ts index b75e1232c4..42fdc97c70 100644 --- a/lib/routes/bandcamp/tag.ts +++ b/lib/routes/bandcamp/tag.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/tag/:tag?', diff --git a/lib/routes/bandcamp/weekly.ts b/lib/routes/bandcamp/weekly.ts index 687f5e9af0..5e8d49d23c 100644 --- a/lib/routes/bandcamp/weekly.ts +++ b/lib/routes/bandcamp/weekly.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/weekly', diff --git a/lib/routes/bandisoft/history.ts b/lib/routes/bandisoft/history.ts index 39fd2dcb6a..371d7d5db9 100644 --- a/lib/routes/bandisoft/history.ts +++ b/lib/routes/bandisoft/history.ts @@ -1,12 +1,11 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + const idOptions = [ { label: 'Bandizip', diff --git a/lib/routes/bangumi.moe/index.ts b/lib/routes/bangumi.moe/index.ts index e8a3667a8a..7654929549 100644 --- a/lib/routes/bangumi.moe/index.ts +++ b/lib/routes/bangumi.moe/index.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import { getSubPath } from '@/utils/common-utils'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/bangumi.online/online.ts b/lib/routes/bangumi.online/online.ts index 76ecccb68b..9166142489 100644 --- a/lib/routes/bangumi.online/online.ts +++ b/lib/routes/bangumi.online/online.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { art } from '@/utils/render'; -import { parseDate } from '@/utils/parse-date'; import path from 'node:path'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + export const route: Route = { path: '/', categories: ['anime'], diff --git a/lib/routes/bangumi.tv/calendar/_base.ts b/lib/routes/bangumi.tv/calendar/_base.ts index 4e6bc8accf..140b9da62a 100644 --- a/lib/routes/bangumi.tv/calendar/_base.ts +++ b/lib/routes/bangumi.tv/calendar/_base.ts @@ -1,5 +1,5 @@ -import got from '@/utils/got'; import { config } from '@/config'; +import got from '@/utils/got'; const getData = (tryGet) => { const bgmCalendarUrl = 'https://api.bgm.tv/calendar'; diff --git a/lib/routes/bangumi.tv/calendar/today.ts b/lib/routes/bangumi.tv/calendar/today.ts index 6055b44ad7..0ff553425e 100644 --- a/lib/routes/bangumi.tv/calendar/today.ts +++ b/lib/routes/bangumi.tv/calendar/today.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; -import getData from './_base'; -import { art } from '@/utils/render'; import path from 'node:path'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { art } from '@/utils/render'; + +import getData from './_base'; + export const route: Route = { path: '/calendar/today', categories: ['anime'], diff --git a/lib/routes/bangumi.tv/group/reply.ts b/lib/routes/bangumi.tv/group/reply.ts index 33ead23f1a..2e4412235e 100644 --- a/lib/routes/bangumi.tv/group/reply.ts +++ b/lib/routes/bangumi.tv/group/reply.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/bangumi.tv/group/topic.ts b/lib/routes/bangumi.tv/group/topic.ts index 2ba94387fc..3b135a7987 100644 --- a/lib/routes/bangumi.tv/group/topic.ts +++ b/lib/routes/bangumi.tv/group/topic.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const baseUrl = 'https://bgm.tv'; export const route: Route = { diff --git a/lib/routes/bangumi.tv/other/followrank.ts b/lib/routes/bangumi.tv/other/followrank.ts index 08e6e0f2dd..804beecf72 100644 --- a/lib/routes/bangumi.tv/other/followrank.ts +++ b/lib/routes/bangumi.tv/other/followrank.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/bangumi.tv/person/index.ts b/lib/routes/bangumi.tv/person/index.ts index d4e566f81e..cb89b750e8 100644 --- a/lib/routes/bangumi.tv/person/index.ts +++ b/lib/routes/bangumi.tv/person/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/bangumi.tv/subject/comments.ts b/lib/routes/bangumi.tv/subject/comments.ts index 4f52ee191b..f3d1e76d2a 100644 --- a/lib/routes/bangumi.tv/subject/comments.ts +++ b/lib/routes/bangumi.tv/subject/comments.ts @@ -1,5 +1,6 @@ -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import ofetch from '@/utils/ofetch'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; const getComments = async (subjectID, minLength) => { diff --git a/lib/routes/bangumi.tv/subject/ep.ts b/lib/routes/bangumi.tv/subject/ep.ts index 503986f030..60f33d0d6c 100644 --- a/lib/routes/bangumi.tv/subject/ep.ts +++ b/lib/routes/bangumi.tv/subject/ep.ts @@ -1,7 +1,9 @@ +import path from 'node:path'; + import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; + import { getLocalName } from './utils'; const getEps = async (subjectID, showOriginalName) => { diff --git a/lib/routes/bangumi.tv/subject/index.ts b/lib/routes/bangumi.tv/subject/index.ts index 9af2260bd0..88d3033040 100644 --- a/lib/routes/bangumi.tv/subject/index.ts +++ b/lib/routes/bangumi.tv/subject/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import getComments from './comments'; -import getFromAPI from './offcial-subject-api'; -import getEps from './ep'; -import { queryToBoolean } from '@/utils/readable-social'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import { queryToBoolean } from '@/utils/readable-social'; + +import getComments from './comments'; +import getEps from './ep'; +import getFromAPI from './offcial-subject-api'; export const route: Route = { path: '/subject/:id/:type?/:showOriginalName?', diff --git a/lib/routes/bangumi.tv/subject/offcial-subject-api.ts b/lib/routes/bangumi.tv/subject/offcial-subject-api.ts index cefadca81a..703beba305 100644 --- a/lib/routes/bangumi.tv/subject/offcial-subject-api.ts +++ b/lib/routes/bangumi.tv/subject/offcial-subject-api.ts @@ -1,5 +1,6 @@ import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; + import { getLocalName } from './utils'; const getFromAPI = (type) => { diff --git a/lib/routes/bangumi.tv/user/blog.ts b/lib/routes/bangumi.tv/user/blog.ts index da55b03efb..c96c32a56b 100644 --- a/lib/routes/bangumi.tv/user/blog.ts +++ b/lib/routes/bangumi.tv/user/blog.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/bangumi.tv/user/collections.ts b/lib/routes/bangumi.tv/user/collections.ts index 4002c39c45..6514406bb4 100644 --- a/lib/routes/bangumi.tv/user/collections.ts +++ b/lib/routes/bangumi.tv/user/collections.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import timezone from '@/utils/timezone'; -import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { config } from '@/config'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; + // 合并不同 subjectType 的 type 映射 const getTypeNames = (subjectType) => { const commonTypeNames = { diff --git a/lib/routes/banshujiang/index.ts b/lib/routes/banshujiang/index.ts index baa469aebe..5724734e0d 100644 --- a/lib/routes/banshujiang/index.ts +++ b/lib/routes/banshujiang/index.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { category } = ctx.req.param(); diff --git a/lib/routes/banyuetan/index.ts b/lib/routes/banyuetan/index.ts index bcc49e9861..440855f87d 100644 --- a/lib/routes/banyuetan/index.ts +++ b/lib/routes/banyuetan/index.ts @@ -1,16 +1,16 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; - export const handler = async (ctx: Context): Promise => { const { id = 'jinritan' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/baobua/article.ts b/lib/routes/baobua/article.ts index 7b40702fdf..82fe3bdf75 100644 --- a/lib/routes/baobua/article.ts +++ b/lib/routes/baobua/article.ts @@ -1,4 +1,5 @@ import { load } from 'cheerio'; + import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/baobua/category.ts b/lib/routes/baobua/category.ts index 54cad3a703..0618fd7dc7 100644 --- a/lib/routes/baobua/category.ts +++ b/lib/routes/baobua/category.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + import loadArticle from './article'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; export const route: Route = { path: '/category/:category', diff --git a/lib/routes/baobua/latest.ts b/lib/routes/baobua/latest.ts index 664f95c762..0fc235ff71 100644 --- a/lib/routes/baobua/latest.ts +++ b/lib/routes/baobua/latest.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + import loadArticle from './article'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; export const route: Route = { path: '/', diff --git a/lib/routes/baobua/search.ts b/lib/routes/baobua/search.ts index 804a61ea5f..11d62506b9 100644 --- a/lib/routes/baobua/search.ts +++ b/lib/routes/baobua/search.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + import loadArticle from './article'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; export const route: Route = { path: '/search/:keyword', diff --git a/lib/routes/baoyu/index.ts b/lib/routes/baoyu/index.ts index 5b10112088..6097f7facc 100644 --- a/lib/routes/baoyu/index.ts +++ b/lib/routes/baoyu/index.ts @@ -1,9 +1,10 @@ -import { Route, DataItem } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import parser from '@/utils/rss-parser'; -import cache from '@/utils/cache'; export const route: Route = { path: '/blog', diff --git a/lib/routes/baozimh/index.ts b/lib/routes/baozimh/index.ts index e726b5dac7..3cbf55fb81 100644 --- a/lib/routes/baozimh/index.ts +++ b/lib/routes/baozimh/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { art } from '@/utils/render'; -import path from 'node:path'; const rootUrl = 'https://www.baozimh.com'; diff --git a/lib/routes/barronschina/index.ts b/lib/routes/barronschina/index.ts index 70339fbf7c..f5e22d2526 100644 --- a/lib/routes/barronschina/index.ts +++ b/lib/routes/barronschina/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/:id?', diff --git a/lib/routes/baselang/index.ts b/lib/routes/baselang/index.ts index d8c7c13db0..3ca25a30a2 100644 --- a/lib/routes/baselang/index.ts +++ b/lib/routes/baselang/index.ts @@ -1,9 +1,10 @@ -import { Route, type Data } from '@/types'; +import type { Context } from 'hono'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { type Data, Route } from '@/types'; +import logger from '@/utils/logger'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; -import logger from '@/utils/logger'; -import { Context } from 'hono'; type WordpressPost = { id: number; diff --git a/lib/routes/bast/index.ts b/lib/routes/bast/index.ts index cfa5b946f3..3b2c9e63cd 100644 --- a/lib/routes/bast/index.ts +++ b/lib/routes/bast/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -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 type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '*', diff --git a/lib/routes/bbc/index.ts b/lib/routes/bbc/index.ts index 5eff388ef4..bc48c45df8 100644 --- a/lib/routes/bbc/index.ts +++ b/lib/routes/bbc/index.ts @@ -1,9 +1,12 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import parser from '@/utils/rss-parser'; import { load } from 'cheerio'; -import utils from './utils'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import parser from '@/utils/rss-parser'; + +import utils from './utils'; + export const route: Route = { path: '/:site?/:channel?', name: 'News', diff --git a/lib/routes/bbc/learningenglish.ts b/lib/routes/bbc/learningenglish.ts index 8259efab97..4c51ea4883 100644 --- a/lib/routes/bbc/learningenglish.ts +++ b/lib/routes/bbc/learningenglish.ts @@ -1,9 +1,10 @@ +import { load } from 'cheerio'; +import { type Context } from 'hono'; + import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; -import { load } from 'cheerio'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { type Context } from 'hono'; const channelMap = { 'take-away-english': '随身英语', diff --git a/lib/routes/bbcnewslabs/news.ts b/lib/routes/bbcnewslabs/news.ts index 894ea0e931..267d5efdf9 100644 --- a/lib/routes/bbcnewslabs/news.ts +++ b/lib/routes/bbcnewslabs/news.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/bc3ts/list.ts b/lib/routes/bc3ts/list.ts index 0325f3380a..2cbdee43a1 100644 --- a/lib/routes/bc3ts/list.ts +++ b/lib/routes/bc3ts/list.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { config } from '@/config'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { Media, PostResponse } from './types'; -import { config } from '@/config'; + +import type { Media, PostResponse } from './types'; export const route: Route = { path: '/post/list/:sort?', diff --git a/lib/routes/bdys/index.ts b/lib/routes/bdys/index.ts index 2a0c7527ae..5a112d6994 100644 --- a/lib/routes/bdys/index.ts +++ b/lib/routes/bdys/index.ts @@ -1,15 +1,16 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; import pMap from 'p-map'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; // Visit https://www.bdys.me for the list of domains const allowDomains = new Set(['52bdys.com', 'bde4.icu', 'bdys01.com']); diff --git a/lib/routes/behance/user.ts b/lib/routes/behance/user.ts index 8930c03c46..3a7f302203 100644 --- a/lib/routes/behance/user.ts +++ b/lib/routes/behance/user.ts @@ -1,10 +1,13 @@ -import { Route, ViewType } from '@/types'; +import crypto from 'node:crypto'; +import path from 'node:path'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import crypto from 'node:crypto'; -import path from 'node:path'; import { art } from '@/utils/render'; + import { getAppreciatedQuery, getProfileProjectsAndSelectionsQuery, getProjectPageQuery } from './queries'; export const route: Route = { diff --git a/lib/routes/beijingprice/index.ts b/lib/routes/beijingprice/index.ts index 8004d50b56..519c6f677f 100644 --- a/lib/routes/beijingprice/index.ts +++ b/lib/routes/beijingprice/index.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const handler = async (ctx) => { diff --git a/lib/routes/bellroy/new-releases.ts b/lib/routes/bellroy/new-releases.ts index c8c25522c1..a706ef4fbe 100644 --- a/lib/routes/bellroy/new-releases.ts +++ b/lib/routes/bellroy/new-releases.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/bendibao/news.ts b/lib/routes/bendibao/news.ts index 0f5404bcf9..c97c77a9f5 100644 --- a/lib/routes/bendibao/news.ts +++ b/lib/routes/bendibao/news.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; import { isValidHost } from '@/utils/valid-host'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; export const route: Route = { path: '/news/:city', diff --git a/lib/routes/bestblogs/feeds.ts b/lib/routes/bestblogs/feeds.ts index d4509e646b..151f2b1e56 100644 --- a/lib/routes/bestblogs/feeds.ts +++ b/lib/routes/bestblogs/feeds.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/bestofjs/monthly.ts b/lib/routes/bestofjs/monthly.ts index e34606b296..9df1bb83f9 100644 --- a/lib/routes/bestofjs/monthly.ts +++ b/lib/routes/bestofjs/monthly.ts @@ -1,8 +1,11 @@ import path from 'node:path'; + import { load } from 'cheerio'; -import { Route, ViewType } from '@/types'; -import ofetch from '@/utils/ofetch'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { art } from '@/utils/render'; const BASEURL = 'https://bestofjs.org/rankings/monthly'; diff --git a/lib/routes/bfl/announcements.ts b/lib/routes/bfl/announcements.ts index bc7bb930b2..dd4861f468 100644 --- a/lib/routes/bfl/announcements.ts +++ b/lib/routes/bfl/announcements.ts @@ -1,8 +1,9 @@ -import { Route, DataItem, Data } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; const ROOT_URL = 'https://bfl.ai'; // 根 URL 定义为常量 diff --git a/lib/routes/bgmlist/onair.ts b/lib/routes/bgmlist/onair.ts index d44221cb42..f2aeb21f7e 100644 --- a/lib/routes/bgmlist/onair.ts +++ b/lib/routes/bgmlist/onair.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; import path from 'node:path'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; diff --git a/lib/routes/bigquant/collections.ts b/lib/routes/bigquant/collections.ts index dd3ec64ba9..c5b85488b7 100644 --- a/lib/routes/bigquant/collections.ts +++ b/lib/routes/bigquant/collections.ts @@ -1,7 +1,10 @@ -import { Route, ViewType } from '@/types'; +import MarkdownIt from 'markdown-it'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import MarkdownIt from 'markdown-it'; + const md = MarkdownIt({ html: true, }); diff --git a/lib/routes/bilibili/app.ts b/lib/routes/bilibili/app.ts index f42c7dd788..408e846e87 100644 --- a/lib/routes/bilibili/app.ts +++ b/lib/routes/bilibili/app.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; const config = { diff --git a/lib/routes/bilibili/article.ts b/lib/routes/bilibili/article.ts index 1c9980d0e1..828f674657 100644 --- a/lib/routes/bilibili/article.ts +++ b/lib/routes/bilibili/article.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import cache from './cache'; -import cacheGeneral from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cacheGeneral from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import cache from './cache'; + export const route: Route = { path: '/user/article/:uid', categories: ['social-media'], diff --git a/lib/routes/bilibili/audio.ts b/lib/routes/bilibili/audio.ts index 5071ac56cd..b1a1fe48ab 100644 --- a/lib/routes/bilibili/audio.ts +++ b/lib/routes/bilibili/audio.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; const audio = 'https://www.bilibili.com/audio/au'; diff --git a/lib/routes/bilibili/bangumi.ts b/lib/routes/bilibili/bangumi.ts index 570f2f4d58..850e105f5f 100644 --- a/lib/routes/bilibili/bangumi.ts +++ b/lib/routes/bilibili/bangumi.ts @@ -1,6 +1,8 @@ -import { Data, DataItem, Route, ViewType } from '@/types'; +import type { Data, DataItem, Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; -import { EpisodeResult } from './types'; + +import type { EpisodeResult } from './types'; import utils from './utils'; export const route: Route = { diff --git a/lib/routes/bilibili/bilibili-recommend.ts b/lib/routes/bilibili/bilibili-recommend.ts index c6c93f0bfc..6a49ca86bc 100644 --- a/lib/routes/bilibili/bilibili-recommend.ts +++ b/lib/routes/bilibili/bilibili-recommend.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/bilibili/cache.ts b/lib/routes/bilibili/cache.ts index b17896a960..cbacd15e75 100644 --- a/lib/routes/bilibili/cache.ts +++ b/lib/routes/bilibili/cache.ts @@ -1,13 +1,15 @@ -import cache from '@/utils/cache'; -import got from '@/utils/got'; -import utils from './utils'; import { load } from 'cheerio'; -import { config } from '@/config'; -import logger from '@/utils/logger'; -import { getPuppeteerPage } from '@/utils/puppeteer'; import { JSDOM } from 'jsdom'; import { RateLimiterMemory, RateLimiterQueue } from 'rate-limiter-flexible'; +import { config } from '@/config'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import logger from '@/utils/logger'; +import { getPuppeteerPage } from '@/utils/puppeteer'; + +import utils from './utils'; + const subtitleLimiter = new RateLimiterMemory({ points: 5, duration: 1, diff --git a/lib/routes/bilibili/check-cookie.ts b/lib/routes/bilibili/check-cookie.ts index 45359c2f5b..f320751b65 100644 --- a/lib/routes/bilibili/check-cookie.ts +++ b/lib/routes/bilibili/check-cookie.ts @@ -1,7 +1,8 @@ -import { APIRoute } from '@/types'; -import cacheIn from './cache'; +import type { APIRoute } from '@/types'; import ofetch from '@/utils/ofetch'; +import cacheIn from './cache'; + export const apiRoute: APIRoute = { path: '/check-cookie', description: '检查 bilibili cookie 是否有效', diff --git a/lib/routes/bilibili/coin.ts b/lib/routes/bilibili/coin.ts index e2a19b82b0..3936af22d6 100644 --- a/lib/routes/bilibili/coin.ts +++ b/lib/routes/bilibili/coin.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + import cache from './cache'; import utils from './utils'; -import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/user/coin/:uid/:embed?', diff --git a/lib/routes/bilibili/danmaku.ts b/lib/routes/bilibili/danmaku.ts index 3340963742..9b52a7d782 100644 --- a/lib/routes/bilibili/danmaku.ts +++ b/lib/routes/bilibili/danmaku.ts @@ -1,9 +1,12 @@ -import { Route } from '@/types'; -import { load } from 'cheerio'; -import cache from './cache'; -import got from '@/utils/got'; import zlib from 'node:zlib'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import cache from './cache'; + const processFloatTime = (time) => { const totalSeconds = Number.parseInt(time); const seconds = totalSeconds % 60; diff --git a/lib/routes/bilibili/dynamic.ts b/lib/routes/bilibili/dynamic.ts index 8a7cf44194..df9cca0edb 100644 --- a/lib/routes/bilibili/dynamic.ts +++ b/lib/routes/bilibili/dynamic.ts @@ -1,15 +1,18 @@ -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import JSONbig from 'json-bigint'; -import utils, { getLiveUrl, getVideoUrl } from './utils'; -import { parseDate } from '@/utils/parse-date'; -import { fallback, queryToBoolean } from '@/utils/readable-social'; -import cacheIn from './cache'; -import { BilibiliWebDynamicResponse, Item2, Modules } from './api-interface'; -import { parseDuration } from '@/utils/helpers'; + import { config } from '@/config'; import CaptchaError from '@/errors/types/captcha'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDuration } from '@/utils/helpers'; +import { parseDate } from '@/utils/parse-date'; +import { fallback, queryToBoolean } from '@/utils/readable-social'; + +import type { BilibiliWebDynamicResponse, Item2, Modules } from './api-interface'; +import cacheIn from './cache'; +import utils, { getLiveUrl, getVideoUrl } from './utils'; export const route: Route = { path: '/user/dynamic/:uid/:routeParams?', diff --git a/lib/routes/bilibili/fav.ts b/lib/routes/bilibili/fav.ts index 81ed06aaf8..f1d1045480 100644 --- a/lib/routes/bilibili/fav.ts +++ b/lib/routes/bilibili/fav.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import utils from './utils'; -import { parseDate } from '@/utils/parse-date'; import { config } from '@/config'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + +import utils from './utils'; export const route: Route = { path: '/fav/:uid/:fid/:embed?', diff --git a/lib/routes/bilibili/followers.ts b/lib/routes/bilibili/followers.ts index 2662aedda1..b0b34adf13 100644 --- a/lib/routes/bilibili/followers.ts +++ b/lib/routes/bilibili/followers.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import cache from './cache'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import cache from './cache'; export const route: Route = { path: '/user/followers/:uid/:loginUid', diff --git a/lib/routes/bilibili/followings-article.ts b/lib/routes/bilibili/followings-article.ts index aa8371d223..1798fd9352 100644 --- a/lib/routes/bilibili/followings-article.ts +++ b/lib/routes/bilibili/followings-article.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import cache from './cache'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import cache from './cache'; export const route: Route = { path: '/followings/article/:uid', diff --git a/lib/routes/bilibili/followings-dynamic.ts b/lib/routes/bilibili/followings-dynamic.ts index 8ed5972148..5bdda1f5d7 100644 --- a/lib/routes/bilibili/followings-dynamic.ts +++ b/lib/routes/bilibili/followings-dynamic.ts @@ -1,13 +1,16 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import cache from './cache'; -import { config } from '@/config'; -import utils from './utils'; -import JSONbig from 'json-bigint'; -import { fallback, queryToBoolean } from '@/utils/readable-social'; import querystring from 'node:querystring'; + +import JSONbig from 'json-bigint'; + +import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import got from '@/utils/got'; import logger from '@/utils/logger'; +import { fallback, queryToBoolean } from '@/utils/readable-social'; + +import cache from './cache'; +import utils from './utils'; export const route: Route = { path: '/followings/dynamic/:uid/:routeParams?', diff --git a/lib/routes/bilibili/followings-video.ts b/lib/routes/bilibili/followings-video.ts index 9332ce1124..dd64b01bd1 100644 --- a/lib/routes/bilibili/followings-video.ts +++ b/lib/routes/bilibili/followings-video.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import cache from './cache'; import { config } from '@/config'; -import utils from './utils'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import got from '@/utils/got'; import logger from '@/utils/logger'; +import cache from './cache'; +import utils from './utils'; + export const route: Route = { path: '/followings/video/:uid/:embed?', categories: ['social-media'], diff --git a/lib/routes/bilibili/followings.ts b/lib/routes/bilibili/followings.ts index 5fc22cbea4..55644f48aa 100644 --- a/lib/routes/bilibili/followings.ts +++ b/lib/routes/bilibili/followings.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import cache from './cache'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import cache from './cache'; export const route: Route = { path: '/user/followings/:uid/:loginUid', diff --git a/lib/routes/bilibili/hot-search.ts b/lib/routes/bilibili/hot-search.ts index 647159f696..ecfaff915b 100644 --- a/lib/routes/bilibili/hot-search.ts +++ b/lib/routes/bilibili/hot-search.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import cache from './cache'; import utils from './utils'; diff --git a/lib/routes/bilibili/like.ts b/lib/routes/bilibili/like.ts index 3c92b4b845..e930c4d1c8 100644 --- a/lib/routes/bilibili/like.ts +++ b/lib/routes/bilibili/like.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + import cache from './cache'; import utils from './utils'; -import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/user/like/:uid/:embed?', diff --git a/lib/routes/bilibili/link-news.ts b/lib/routes/bilibili/link-news.ts index 04bd0d4b21..3a43bc62b4 100644 --- a/lib/routes/bilibili/link-news.ts +++ b/lib/routes/bilibili/link-news.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/bilibili/live-area.ts b/lib/routes/bilibili/live-area.ts index c3cb69dbc5..d195306159 100644 --- a/lib/routes/bilibili/live-area.ts +++ b/lib/routes/bilibili/live-area.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/bilibili/live-room.ts b/lib/routes/bilibili/live-room.ts index 7285da7adf..800b4c83f6 100644 --- a/lib/routes/bilibili/live-room.ts +++ b/lib/routes/bilibili/live-room.ts @@ -1,10 +1,12 @@ -import { DataItem, Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import cache from './cache'; import { decodeHTML } from 'entities'; + +import type { DataItem, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; +import cache from './cache'; + export const route: Route = { path: '/live/room/:roomID', categories: ['live'], diff --git a/lib/routes/bilibili/live-search.ts b/lib/routes/bilibili/live-search.ts index 1e54f69a96..e06e4b8267 100644 --- a/lib/routes/bilibili/live-search.ts +++ b/lib/routes/bilibili/live-search.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import utils from './utils'; + import cache from './cache'; +import utils from './utils'; export const route: Route = { path: '/live/search/:key/:order', diff --git a/lib/routes/bilibili/mall-ip.ts b/lib/routes/bilibili/mall-ip.ts index 7f1100537d..fb590d6738 100644 --- a/lib/routes/bilibili/mall-ip.ts +++ b/lib/routes/bilibili/mall-ip.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/bilibili/mall-new.ts b/lib/routes/bilibili/mall-new.ts index 0552e1588c..1c3a1895fd 100644 --- a/lib/routes/bilibili/mall-new.ts +++ b/lib/routes/bilibili/mall-new.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/bilibili/manga-followings.ts b/lib/routes/bilibili/manga-followings.ts index 3ecf19ef2e..29af1585a3 100644 --- a/lib/routes/bilibili/manga-followings.ts +++ b/lib/routes/bilibili/manga-followings.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import cache from './cache'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import cache from './cache'; export const route: Route = { path: '/manga/followings/:uid/:limits?', diff --git a/lib/routes/bilibili/manga-update.ts b/lib/routes/bilibili/manga-update.ts index 4cf7f182a8..cae76c3ba7 100644 --- a/lib/routes/bilibili/manga-update.ts +++ b/lib/routes/bilibili/manga-update.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; diff --git a/lib/routes/bilibili/page.ts b/lib/routes/bilibili/page.ts index 91cd5ea73a..33551058eb 100644 --- a/lib/routes/bilibili/page.ts +++ b/lib/routes/bilibili/page.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/bilibili/partion-ranking.ts b/lib/routes/bilibili/partion-ranking.ts index 2ae4f3fc7b..1b160d1673 100644 --- a/lib/routes/bilibili/partion-ranking.ts +++ b/lib/routes/bilibili/partion-ranking.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import utils from './utils'; + const got_ins = got.extend({ headers: { Referer: 'https://www.bilibili.com/', diff --git a/lib/routes/bilibili/partion.ts b/lib/routes/bilibili/partion.ts index 043d0897ac..bce20691ed 100644 --- a/lib/routes/bilibili/partion.ts +++ b/lib/routes/bilibili/partion.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/bilibili/platform.ts b/lib/routes/bilibili/platform.ts index c7cbd590c0..d92d957cc7 100644 --- a/lib/routes/bilibili/platform.ts +++ b/lib/routes/bilibili/platform.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; +import { config } from '@/config'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; export const route: Route = { path: '/platform/:area?/:p_type?/:uid?', diff --git a/lib/routes/bilibili/popular.ts b/lib/routes/bilibili/popular.ts index cc8df1a431..6398942aec 100644 --- a/lib/routes/bilibili/popular.ts +++ b/lib/routes/bilibili/popular.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/bilibili/ranking.ts b/lib/routes/bilibili/ranking.ts index aef830044c..dc81344082 100644 --- a/lib/routes/bilibili/ranking.ts +++ b/lib/routes/bilibili/ranking.ts @@ -1,9 +1,11 @@ -import { Route, ViewType } from '@/types'; -import ofetch from '@/utils/ofetch'; -import utils, { getVideoUrl } from './utils'; -import { parseDate } from '@/utils/parse-date'; import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + import cache from './cache'; +import utils, { getVideoUrl } from './utils'; // https://www.bilibili.com/v/popular/rank/all diff --git a/lib/routes/bilibili/readlist.ts b/lib/routes/bilibili/readlist.ts index 7dcc133058..18aa1f6c98 100644 --- a/lib/routes/bilibili/readlist.ts +++ b/lib/routes/bilibili/readlist.ts @@ -1,4 +1,5 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/bilibili/reply.ts b/lib/routes/bilibili/reply.ts index 25a69415cf..5af8d0aa71 100644 --- a/lib/routes/bilibili/reply.ts +++ b/lib/routes/bilibili/reply.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import cache from './cache'; export const route: Route = { diff --git a/lib/routes/bilibili/user-bangumi.ts b/lib/routes/bilibili/user-bangumi.ts index 0e4f355455..889fbae481 100644 --- a/lib/routes/bilibili/user-bangumi.ts +++ b/lib/routes/bilibili/user-bangumi.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import cache from './cache'; export const route: Route = { diff --git a/lib/routes/bilibili/user-channel.ts b/lib/routes/bilibili/user-channel.ts index a319a67fd7..4e8ba7ace7 100644 --- a/lib/routes/bilibili/user-channel.ts +++ b/lib/routes/bilibili/user-channel.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import cacheIn from './cache'; import utils from './utils'; diff --git a/lib/routes/bilibili/user-collection.ts b/lib/routes/bilibili/user-collection.ts index 5dab48de71..fa09627dc2 100644 --- a/lib/routes/bilibili/user-collection.ts +++ b/lib/routes/bilibili/user-collection.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import cache from './cache'; -import utils from './utils'; import { parseDate } from '@/utils/parse-date'; import { queryToBoolean } from '@/utils/readable-social'; +import cache from './cache'; +import utils from './utils'; + const notFoundData = { title: '此 bilibili 频道不存在', }; diff --git a/lib/routes/bilibili/user-fav.ts b/lib/routes/bilibili/user-fav.ts index 04deeb6d0e..fc6cee593d 100644 --- a/lib/routes/bilibili/user-fav.ts +++ b/lib/routes/bilibili/user-fav.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { config } from '@/config'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import cache from './cache'; import utils from './utils'; -import { config } from '@/config'; export const route: Route = { path: '/user/fav/:uid/:embed?', diff --git a/lib/routes/bilibili/utils.ts b/lib/routes/bilibili/utils.ts index a6109afaa0..bee611e0e6 100644 --- a/lib/routes/bilibili/utils.ts +++ b/lib/routes/bilibili/utils.ts @@ -1,10 +1,13 @@ +import path from 'node:path'; + +import CryptoJS from 'crypto-js'; + import { config } from '@/config'; import md5 from '@/utils/md5'; import ofetch from '@/utils/ofetch'; import { art } from '@/utils/render'; -import CryptoJS from 'crypto-js'; -import path from 'node:path'; -import { MediaResult, ResultResponse, SeasonResult } from './types'; + +import type { MediaResult, ResultResponse, SeasonResult } from './types'; // a function randomHexStr(length) { diff --git a/lib/routes/bilibili/video-all.ts b/lib/routes/bilibili/video-all.ts index cb43f447eb..ea5e55655e 100644 --- a/lib/routes/bilibili/video-all.ts +++ b/lib/routes/bilibili/video-all.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + import cache from './cache'; import utils from './utils'; -import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/user/video-all/:uid/:embed?', diff --git a/lib/routes/bilibili/video.ts b/lib/routes/bilibili/video.ts index c11bc5033a..417b9d33b3 100644 --- a/lib/routes/bilibili/video.ts +++ b/lib/routes/bilibili/video.ts @@ -1,11 +1,14 @@ -import { Route, ViewType } from '@/types'; +import type { Context } from 'hono'; + +import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDuration } from '@/utils/helpers'; import logger from '@/utils/logger'; -import type { Context } from 'hono'; + import cache from './cache'; import utils, { getVideoUrl } from './utils'; -import { config } from '@/config'; export const route: Route = { path: '/user/video/:uid/:embed?', diff --git a/lib/routes/bilibili/vsearch.ts b/lib/routes/bilibili/vsearch.ts index 401f80eb47..7f2c94538b 100644 --- a/lib/routes/bilibili/vsearch.ts +++ b/lib/routes/bilibili/vsearch.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import utils from './utils'; + import cacheIn from './cache'; +import utils from './utils'; export const route: Route = { path: '/vsearch/:kw/:order?/:embed?/:tid?', diff --git a/lib/routes/bilibili/watchlater.ts b/lib/routes/bilibili/watchlater.ts index 2fa1a14c66..2be2aee30c 100644 --- a/lib/routes/bilibili/watchlater.ts +++ b/lib/routes/bilibili/watchlater.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import cache from './cache'; import { config } from '@/config'; -import utils from './utils'; -import { parseDate } from '@/utils/parse-date'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + +import cache from './cache'; +import utils from './utils'; export const route: Route = { path: '/watchlater/:uid/:embed?', diff --git a/lib/routes/bilibili/weekly-recommend.ts b/lib/routes/bilibili/weekly-recommend.ts index 60484f5013..ad30fca8cf 100644 --- a/lib/routes/bilibili/weekly-recommend.ts +++ b/lib/routes/bilibili/weekly-recommend.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import utils, { getVideoUrl } from './utils'; -import { parseDuration } from '@/utils/helpers'; import { config } from '@/config'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDuration } from '@/utils/helpers'; + import cache from './cache'; +import utils, { getVideoUrl } from './utils'; export const route: Route = { path: '/weekly/:embed?', diff --git a/lib/routes/binance/announcement.ts b/lib/routes/binance/announcement.ts index ff12ebc297..b671770fbf 100644 --- a/lib/routes/binance/announcement.ts +++ b/lib/routes/binance/announcement.ts @@ -1,9 +1,12 @@ -import { DataItem, Route, ViewType } from '@/types'; +import * as cheerio from 'cheerio'; + +import type { DataItem, Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import * as cheerio from 'cheerio'; -import { AnnouncementCatalog, AnnouncementsConfig } from './types'; + +import type { AnnouncementCatalog, AnnouncementsConfig } from './types'; interface AnnouncementFragment { reactRoot: [{ id: 'Fragment'; children: { id: string; props: object }[]; props: object }]; diff --git a/lib/routes/binance/launchpool.ts b/lib/routes/binance/launchpool.ts index 5e8be2362a..de96631686 100644 --- a/lib/routes/binance/launchpool.ts +++ b/lib/routes/binance/launchpool.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/bing/daily-wallpaper.ts b/lib/routes/bing/daily-wallpaper.ts index 4545b273ad..c19a684de3 100644 --- a/lib/routes/bing/daily-wallpaper.ts +++ b/lib/routes/bing/daily-wallpaper.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/bing/search.ts b/lib/routes/bing/search.ts index bd7628dc8c..85f352e415 100644 --- a/lib/routes/bing/search.ts +++ b/lib/routes/bing/search.ts @@ -1,9 +1,12 @@ -import { Route } from '@/types'; -import parser from '@/utils/rss-parser'; -import { parseDate } from '@/utils/parse-date'; +import 'dayjs/locale/zh-cn.js'; + import dayjs from 'dayjs'; import localizedFormat from 'dayjs/plugin/localizedFormat.js'; -import 'dayjs/locale/zh-cn.js'; + +import type { Route } from '@/types'; +import { parseDate } from '@/utils/parse-date'; +import parser from '@/utils/rss-parser'; + dayjs.extend(localizedFormat); export const route: Route = { diff --git a/lib/routes/biodiscover/index.ts b/lib/routes/biodiscover/index.ts index 0b71e5ef4d..9f576d06fa 100644 --- a/lib/routes/biodiscover/index.ts +++ b/lib/routes/biodiscover/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/bioone/featured.ts b/lib/routes/bioone/featured.ts index b954f1e4c5..c8c9f8ea89 100644 --- a/lib/routes/bioone/featured.ts +++ b/lib/routes/bioone/featured.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/bioone/journal.ts b/lib/routes/bioone/journal.ts index b376f93bdc..b7a0a7b551 100644 --- a/lib/routes/bioone/journal.ts +++ b/lib/routes/bioone/journal.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/biquge/index.ts b/lib/routes/biquge/index.ts index 95e773f244..817222c6c6 100644 --- a/lib/routes/biquge/index.ts +++ b/lib/routes/biquge/index.ts @@ -1,13 +1,15 @@ -import { Route } from '@/types'; -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; -import timezone from '@/utils/timezone'; -import { parseDate } from '@/utils/parse-date'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; + const allowHost = new Set([ 'www.xbiquwx.la', 'www.biqu5200.net', diff --git a/lib/routes/bit/cs/cs.ts b/lib/routes/bit/cs/cs.ts index 078e9d43c3..ed0141fb29 100644 --- a/lib/routes/bit/cs/cs.ts +++ b/lib/routes/bit/cs/cs.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import util from './utils'; export const route: Route = { diff --git a/lib/routes/bit/cs/utils.ts b/lib/routes/bit/cs/utils.ts index dbb80c89e7..ad67790a43 100644 --- a/lib/routes/bit/cs/utils.ts +++ b/lib/routes/bit/cs/utils.ts @@ -1,5 +1,6 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/bit/jwc/jwc.ts b/lib/routes/bit/jwc/jwc.ts index f7748715bf..c0e1d40525 100644 --- a/lib/routes/bit/jwc/jwc.ts +++ b/lib/routes/bit/jwc/jwc.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import util from './utils'; export const route: Route = { diff --git a/lib/routes/bit/jwc/utils.ts b/lib/routes/bit/jwc/utils.ts index 8fabcc5e59..1bcc9b522b 100644 --- a/lib/routes/bit/jwc/utils.ts +++ b/lib/routes/bit/jwc/utils.ts @@ -1,5 +1,6 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/bit/rszhaopin.ts b/lib/routes/bit/rszhaopin.ts index 8e330f5198..b966cc9242 100644 --- a/lib/routes/bit/rszhaopin.ts +++ b/lib/routes/bit/rszhaopin.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/bit/yjs.ts b/lib/routes/bit/yjs.ts index d1dafe44d6..c20f2aa017 100644 --- a/lib/routes/bit/yjs.ts +++ b/lib/routes/bit/yjs.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/bitbucket/commits.ts b/lib/routes/bitbucket/commits.ts index f60fbd4c44..4d3d3ee89c 100644 --- a/lib/routes/bitbucket/commits.ts +++ b/lib/routes/bitbucket/commits.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import { config } from '@/config'; import queryString from 'query-string'; + +import { config } from '@/config'; +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/bitbucket/tags.ts b/lib/routes/bitbucket/tags.ts index 95933b2e4a..9add7af622 100644 --- a/lib/routes/bitbucket/tags.ts +++ b/lib/routes/bitbucket/tags.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import { config } from '@/config'; import queryString from 'query-string'; + +import { config } from '@/config'; +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/bitget/announcement.ts b/lib/routes/bitget/announcement.ts index 258ec98f6f..b0b018ce0f 100644 --- a/lib/routes/bitget/announcement.ts +++ b/lib/routes/bitget/announcement.ts @@ -1,10 +1,13 @@ -import { DataItem, Route, ViewType } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import cache from '@/utils/cache'; -import { BitgetResponse } from './type'; -import { parseDate } from '@/utils/parse-date'; + import { config } from '@/config'; +import type { DataItem, Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + +import type { BitgetResponse } from './type'; const handler: Route['handler'] = async (ctx) => { const baseUrl = 'https://www.bitget.com'; diff --git a/lib/routes/bitmovin/blog.ts b/lib/routes/bitmovin/blog.ts index e5ac7f6072..d7ff08da8f 100644 --- a/lib/routes/bitmovin/blog.ts +++ b/lib/routes/bitmovin/blog.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/bjfu/grs.ts b/lib/routes/bjfu/grs.ts index 4907b0f9ea..17cb96940f 100644 --- a/lib/routes/bjfu/grs.ts +++ b/lib/routes/bjfu/grs.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/bjfu/it/index.ts b/lib/routes/bjfu/it/index.ts index 4da69a4659..b9028da852 100644 --- a/lib/routes/bjfu/it/index.ts +++ b/lib/routes/bjfu/it/index.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import util from './utils'; -import iconv from 'iconv-lite'; export const route: Route = { path: '/it/:type', diff --git a/lib/routes/bjfu/it/utils.ts b/lib/routes/bjfu/it/utils.ts index b6c1ce6d76..ef3517502e 100644 --- a/lib/routes/bjfu/it/utils.ts +++ b/lib/routes/bjfu/it/utils.ts @@ -1,6 +1,7 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/bjfu/jwc/index.ts b/lib/routes/bjfu/jwc/index.ts index 6061aa69d3..60cbe74441 100644 --- a/lib/routes/bjfu/jwc/index.ts +++ b/lib/routes/bjfu/jwc/index.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import util from './utils'; export const route: Route = { diff --git a/lib/routes/bjfu/jwc/utils.ts b/lib/routes/bjfu/jwc/utils.ts index 5595f45340..c0e633ebae 100644 --- a/lib/routes/bjfu/jwc/utils.ts +++ b/lib/routes/bjfu/jwc/utils.ts @@ -1,5 +1,6 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/bjfu/kjc.ts b/lib/routes/bjfu/kjc.ts index de90da988d..dee0e77ed3 100644 --- a/lib/routes/bjfu/kjc.ts +++ b/lib/routes/bjfu/kjc.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/bjfu/news/index.ts b/lib/routes/bjfu/news/index.ts index 1e6edb7747..843c7858ec 100644 --- a/lib/routes/bjfu/news/index.ts +++ b/lib/routes/bjfu/news/index.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import util from './utils'; -import iconv from 'iconv-lite'; export const route: Route = { path: '/news/:type', diff --git a/lib/routes/bjfu/news/utils.ts b/lib/routes/bjfu/news/utils.ts index fb1dbb16eb..3511db1b2e 100644 --- a/lib/routes/bjfu/news/utils.ts +++ b/lib/routes/bjfu/news/utils.ts @@ -1,5 +1,6 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/bjnews/cat.ts b/lib/routes/bjnews/cat.ts index c88801b3e6..ce7296654c 100644 --- a/lib/routes/bjnews/cat.ts +++ b/lib/routes/bjnews/cat.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; +import pMap from 'p-map'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { fetchArticle } from './utils'; -import pMap from 'p-map'; export const route: Route = { path: '/cat/:cat', diff --git a/lib/routes/bjnews/column.ts b/lib/routes/bjnews/column.ts index 709138563d..6529d9b3e3 100644 --- a/lib/routes/bjnews/column.ts +++ b/lib/routes/bjnews/column.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/bjnews/utils.ts b/lib/routes/bjnews/utils.ts index 5b0496a7f5..86379eae19 100644 --- a/lib/routes/bjnews/utils.ts +++ b/lib/routes/bjnews/utils.ts @@ -1,8 +1,9 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; export function fetchArticle(item) { return cache.tryGet(item.link, async () => { diff --git a/lib/routes/bjp/apod.ts b/lib/routes/bjp/apod.ts index ae159d5b65..95ecda4fc8 100644 --- a/lib/routes/bjp/apod.ts +++ b/lib/routes/bjp/apod.ts @@ -1,6 +1,8 @@ -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/bjsk/index.ts b/lib/routes/bjsk/index.ts index 907b9c7706..c89e2a7a62 100644 --- a/lib/routes/bjsk/index.ts +++ b/lib/routes/bjsk/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://www.bjsk.org.cn'; diff --git a/lib/routes/bjsk/keti.ts b/lib/routes/bjsk/keti.ts index fef951a684..ea706b6f66 100644 --- a/lib/routes/bjsk/keti.ts +++ b/lib/routes/bjsk/keti.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/bjtu/gs.ts b/lib/routes/bjtu/gs.ts index e702c0b011..af3ab85f7c 100644 --- a/lib/routes/bjtu/gs.ts +++ b/lib/routes/bjtu/gs.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootURL = 'https://gs.bjtu.edu.cn'; diff --git a/lib/routes/bjtu/namespace.ts b/lib/routes/bjtu/namespace.ts index 4fd3ddb7a0..7b2e129cac 100644 --- a/lib/routes/bjtu/namespace.ts +++ b/lib/routes/bjtu/namespace.ts @@ -1,4 +1,5 @@ import type { Namespace } from '@/types'; + export const namespace: Namespace = { name: 'Beijing Jiaotong University', url: 'bjtu.edu.cn', diff --git a/lib/routes/bjwxdxh/index.ts b/lib/routes/bjwxdxh/index.ts index e01223dc4d..b90d7a8aff 100644 --- a/lib/routes/bjwxdxh/index.ts +++ b/lib/routes/bjwxdxh/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:type?', diff --git a/lib/routes/bjx/fd.ts b/lib/routes/bjx/fd.ts index 9d6c4d6813..899c703889 100644 --- a/lib/routes/bjx/fd.ts +++ b/lib/routes/bjx/fd.ts @@ -1,8 +1,9 @@ -import { DataItem, Route } from '@/types'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import ofetch from '@/utils/ofetch'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/fd/:type', diff --git a/lib/routes/bjx/huanbao.ts b/lib/routes/bjx/huanbao.ts index 302471c8df..a2e2fc1044 100644 --- a/lib/routes/bjx/huanbao.ts +++ b/lib/routes/bjx/huanbao.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import pMap from 'p-map'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; import timezone from '@/utils/timezone'; -import pMap from 'p-map'; export const route: Route = { path: '/huanbao', diff --git a/lib/routes/bjx/types.ts b/lib/routes/bjx/types.ts index 19e062ae4f..3dd8f58c99 100644 --- a/lib/routes/bjx/types.ts +++ b/lib/routes/bjx/types.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/blizzard/news-cn.ts b/lib/routes/blizzard/news-cn.ts index b13237a754..7580c1fc93 100644 --- a/lib/routes/blizzard/news-cn.ts +++ b/lib/routes/blizzard/news-cn.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/blizzard/news.ts b/lib/routes/blizzard/news.ts index 4d083bc401..4cbf0dcc55 100644 --- a/lib/routes/blizzard/news.ts +++ b/lib/routes/blizzard/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/news/:language?/:category?', diff --git a/lib/routes/blockworks/index.ts b/lib/routes/blockworks/index.ts index e4afea4235..e1a5ad6b77 100644 --- a/lib/routes/blockworks/index.ts +++ b/lib/routes/blockworks/index.ts @@ -1,11 +1,12 @@ -import { Route, Data, DataItem } from '@/types'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import logger from '@/utils/logger'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; -import logger from '@/utils/logger'; import parser from '@/utils/rss-parser'; -import { config } from '@/config'; export const route: Route = { path: '/', diff --git a/lib/routes/blogread/index.ts b/lib/routes/blogread/index.ts index e9591a61c0..c6091c6c17 100644 --- a/lib/routes/blogread/index.ts +++ b/lib/routes/blogread/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import * as cheerio from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/newest', categories: ['programming'], diff --git a/lib/routes/bloomberg/authors.ts b/lib/routes/bloomberg/authors.ts index b8192de670..6a72b1f618 100644 --- a/lib/routes/bloomberg/authors.ts +++ b/lib/routes/bloomberg/authors.ts @@ -1,9 +1,12 @@ -import { Route, ViewType } from '@/types'; import { load } from 'cheerio'; +import pMap from 'p-map'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; import rssParser from '@/utils/rss-parser'; + import { parseArticle } from './utils'; -import pMap from 'p-map'; const parseAuthorNewsList = async (slug) => { const baseURL = `https://www.bloomberg.com/authors/${slug}`; diff --git a/lib/routes/bloomberg/index.ts b/lib/routes/bloomberg/index.ts index e4fdefcbd1..f3625721b7 100644 --- a/lib/routes/bloomberg/index.ts +++ b/lib/routes/bloomberg/index.ts @@ -1,6 +1,10 @@ -import { Route, ViewType } from '@/types'; -import { rootUrl, parseNewsList, parseArticle } from './utils'; import pMap from 'p-map'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; + +import { parseArticle, parseNewsList, rootUrl } from './utils'; + const siteTitleMapping = { '/': 'News', bpol: 'Politics', diff --git a/lib/routes/bloomberg/utils.ts b/lib/routes/bloomberg/utils.ts index 924e160831..ae2a85c8fd 100644 --- a/lib/routes/bloomberg/utils.ts +++ b/lib/routes/bloomberg/utils.ts @@ -1,11 +1,12 @@ -import cache from '@/utils/cache'; -import { load } from 'cheerio'; import path from 'node:path'; + +import { load } from 'cheerio'; import { destr } from 'destr'; -import { parseDate } from '@/utils/parse-date'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; const rootUrl = 'https://www.bloomberg.com/feeds'; @@ -603,4 +604,4 @@ const documentToHtmlString = async (document) => { return str; }; -export { rootUrl, parseNewsList, parseArticle }; +export { parseArticle, parseNewsList, rootUrl }; diff --git a/lib/routes/bluestacks/release.ts b/lib/routes/bluestacks/release.ts index 5f12893799..8823a1da4d 100644 --- a/lib/routes/bluestacks/release.ts +++ b/lib/routes/bluestacks/release.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import * as cheerio from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; diff --git a/lib/routes/bmkg/earthquake.ts b/lib/routes/bmkg/earthquake.ts index 4467954f04..d60f1dd89a 100644 --- a/lib/routes/bmkg/earthquake.ts +++ b/lib/routes/bmkg/earthquake.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/bmkg/news.ts b/lib/routes/bmkg/news.ts index d9bc9c9e26..7a9a21693a 100644 --- a/lib/routes/bmkg/news.ts +++ b/lib/routes/bmkg/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/news', diff --git a/lib/routes/bnext/index.ts b/lib/routes/bnext/index.ts index 217355ef3c..2c9848c166 100644 --- a/lib/routes/bnext/index.ts +++ b/lib/routes/bnext/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import parser from '@/utils/rss-parser'; import type { Item } from 'rss-parser'; +import type { Route } from '@/types'; +import parser from '@/utils/rss-parser'; + const FEED_URL = 'https://rss.bnextmedia.com.tw/feed/bnext'; export const route: Route = { diff --git a/lib/routes/bnu/bs.ts b/lib/routes/bnu/bs.ts index 0728c7980c..4693d69468 100644 --- a/lib/routes/bnu/bs.ts +++ b/lib/routes/bnu/bs.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/bnu/dwxgb.ts b/lib/routes/bnu/dwxgb.ts index aee206c818..4b67dc0bc4 100644 --- a/lib/routes/bnu/dwxgb.ts +++ b/lib/routes/bnu/dwxgb.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/bnu/fdy.ts b/lib/routes/bnu/fdy.ts index 0d52179a6a..b94dbfc775 100644 --- a/lib/routes/bnu/fdy.ts +++ b/lib/routes/bnu/fdy.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/bnu/fe.ts b/lib/routes/bnu/fe.ts index 9f405637c8..68ff77d128 100644 --- a/lib/routes/bnu/fe.ts +++ b/lib/routes/bnu/fe.ts @@ -1,8 +1,9 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/fe/:category', diff --git a/lib/routes/bnu/jwb.ts b/lib/routes/bnu/jwb.ts index dc728361db..f28cb29c9c 100644 --- a/lib/routes/bnu/jwb.ts +++ b/lib/routes/bnu/jwb.ts @@ -1,8 +1,9 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/jwb', diff --git a/lib/routes/bnu/lib.ts b/lib/routes/bnu/lib.ts index 2598d6d392..12c815ad8f 100644 --- a/lib/routes/bnu/lib.ts +++ b/lib/routes/bnu/lib.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/bnu/mba.ts b/lib/routes/bnu/mba.ts index e42435d0e3..09715046c0 100644 --- a/lib/routes/bnu/mba.ts +++ b/lib/routes/bnu/mba.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const handler = async (ctx) => { diff --git a/lib/routes/boc/whpj.ts b/lib/routes/boc/whpj.ts index e167d84731..51ee1f4897 100644 --- a/lib/routes/boc/whpj.ts +++ b/lib/routes/boc/whpj.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/whpj/:format?', categories: ['other'], diff --git a/lib/routes/bookfere/category.ts b/lib/routes/bookfere/category.ts index 503ac16044..16ceacd57e 100644 --- a/lib/routes/bookfere/category.ts +++ b/lib/routes/bookfere/category.ts @@ -1,6 +1,8 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/bookwalker/search.ts b/lib/routes/bookwalker/search.ts index 5af7654648..a6fab55c9c 100644 --- a/lib/routes/bookwalker/search.ts +++ b/lib/routes/bookwalker/search.ts @@ -1,12 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; -import ofetch from '@/utils/ofetch'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type Context } from 'hono'; -import path from 'node:path'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { filter = 'order=sell_desc' } = ctx.req.param(); diff --git a/lib/routes/booru/mmda.ts b/lib/routes/booru/mmda.ts index 677ac99bbb..90b3853069 100644 --- a/lib/routes/booru/mmda.ts +++ b/lib/routes/booru/mmda.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import queryString from 'query-string'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import cache from '@/utils/cache'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; +import queryString from 'query-string'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + export const route: Route = { path: '/mmda/tags/:tags?', categories: ['picture'], diff --git a/lib/routes/bossdesign/index.ts b/lib/routes/bossdesign/index.ts index 84c3fc16f1..fa4db84ceb 100644 --- a/lib/routes/bossdesign/index.ts +++ b/lib/routes/bossdesign/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/brave/latest.ts b/lib/routes/brave/latest.ts index d623ad3150..9fd36130e2 100644 --- a/lib/routes/brave/latest.ts +++ b/lib/routes/brave/latest.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/brooklynmuseum/exhibitions.ts b/lib/routes/brooklynmuseum/exhibitions.ts index 4b8aecb10f..9e7980ccf5 100644 --- a/lib/routes/brooklynmuseum/exhibitions.ts +++ b/lib/routes/brooklynmuseum/exhibitions.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import buildData from '@/utils/common-config'; export const route: Route = { diff --git a/lib/routes/bse/index.ts b/lib/routes/bse/index.ts index 58c4fffcbc..96a3d17120 100644 --- a/lib/routes/bse/index.ts +++ b/lib/routes/bse/index.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const nodes = { important_news: { diff --git a/lib/routes/bsky/feeds.ts b/lib/routes/bsky/feeds.ts index d97bfca02f..3e194b6d36 100644 --- a/lib/routes/bsky/feeds.ts +++ b/lib/routes/bsky/feeds.ts @@ -1,10 +1,12 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; -import { resolveHandle, getFeed, getFeedGenerator } from './utils'; import { art } from '@/utils/render'; -import path from 'node:path'; + +import { getFeed, getFeedGenerator, resolveHandle } from './utils'; export const route: Route = { path: '/profile/:handle/feed/:space/:routeParams?', diff --git a/lib/routes/bsky/keyword.ts b/lib/routes/bsky/keyword.ts index 3b6f71616d..53ec169cba 100644 --- a/lib/routes/bsky/keyword.ts +++ b/lib/routes/bsky/keyword.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/bsky/posts.ts b/lib/routes/bsky/posts.ts index ca6020353d..91d1b36de9 100644 --- a/lib/routes/bsky/posts.ts +++ b/lib/routes/bsky/posts.ts @@ -1,12 +1,14 @@ -import { Route, ViewType } from '@/types'; - -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; -import { resolveHandle, getProfile, getAuthorFeed } from './utils'; -import { art } from '@/utils/render'; import path from 'node:path'; import querystring from 'node:querystring'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + +import { getAuthorFeed, getProfile, resolveHandle } from './utils'; + export const route: Route = { path: '/profile/:handle/:routeParams?', categories: ['social-media'], diff --git a/lib/routes/bsky/utils.ts b/lib/routes/bsky/utils.ts index 654a2eda7c..f167308a2a 100644 --- a/lib/routes/bsky/utils.ts +++ b/lib/routes/bsky/utils.ts @@ -1,5 +1,5 @@ -import got from '@/utils/got'; import { config } from '@/config'; +import got from '@/utils/got'; /** * docs: https://atproto.com/lexicons/app-bsky @@ -78,4 +78,4 @@ const getFeedGenerator = (uri, tryGet) => false ); -export { resolveHandle, getProfile, getFeed, getAuthorFeed, getFeedGenerator }; +export { getAuthorFeed, getFeed, getFeedGenerator, getProfile, resolveHandle }; diff --git a/lib/routes/bt0/mv.ts b/lib/routes/bt0/mv.ts index 36ef8d33e9..4fe24a61af 100644 --- a/lib/routes/bt0/mv.ts +++ b/lib/routes/bt0/mv.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; + import { doGot, genSize } from './util'; export const route: Route = { diff --git a/lib/routes/bt0/tlist.ts b/lib/routes/bt0/tlist.ts index 481eab960d..55dc9763ae 100644 --- a/lib/routes/bt0/tlist.ts +++ b/lib/routes/bt0/tlist.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { doGot, genSize } from './util'; +import type { Route } from '@/types'; import { parseRelativeDate } from '@/utils/parse-date'; +import { doGot, genSize } from './util'; + const categoryDict = { 1: '电影', 2: '电视剧', diff --git a/lib/routes/bt0/util.ts b/lib/routes/bt0/util.ts index 1cb34774af..dfcd8d7203 100644 --- a/lib/routes/bt0/util.ts +++ b/lib/routes/bt0/util.ts @@ -1,5 +1,7 @@ import { CookieJar } from 'tough-cookie'; + import got from '@/utils/got'; + const cookieJar = new CookieJar(); async function doGot(num, host, link) { diff --git a/lib/routes/btzj/index.ts b/lib/routes/btzj/index.ts index d18a042b87..0bc11e7e10 100644 --- a/lib/routes/btzj/index.ts +++ b/lib/routes/btzj/index.ts @@ -1,14 +1,16 @@ -import { Route } from '@/types'; - -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 path from 'node:path'; + +import { load } from 'cheerio'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; + const allowDomain = new Set(['2btjia.com', '88btbtt.com', 'btbtt15.com', 'btbtt20.com']); export const route: Route = { diff --git a/lib/routes/buaa/jiaowu.ts b/lib/routes/buaa/jiaowu.ts index f19ba75e93..3f7af41101 100644 --- a/lib/routes/buaa/jiaowu.ts +++ b/lib/routes/buaa/jiaowu.ts @@ -1,8 +1,9 @@ -import { Data, Route } from '@/types'; -import { Context } from 'hono'; +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { Data, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/buaa/lib/space/newbook.ts b/lib/routes/buaa/lib/space/newbook.ts index add51285fb..303cb1e46f 100644 --- a/lib/routes/buaa/lib/space/newbook.ts +++ b/lib/routes/buaa/lib/space/newbook.ts @@ -1,11 +1,13 @@ -import { Data, DataItem, Route } from '@/types'; -import { Context } from 'hono'; +import path from 'node:path'; + +import type { Context } from 'hono'; + +import type { Data, DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; -import cache from '@/utils/cache'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; interface Book { bibId: string; diff --git a/lib/routes/buaa/news/index.ts b/lib/routes/buaa/news/index.ts index 3389d086aa..24fef9850a 100644 --- a/lib/routes/buaa/news/index.ts +++ b/lib/routes/buaa/news/index.ts @@ -1,8 +1,9 @@ -import { Route, Data, DataItem } from '@/types'; -import { Context } from 'hono'; +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/buaa/sme.ts b/lib/routes/buaa/sme.ts index 9511895ac1..2e370a20ed 100755 --- a/lib/routes/buaa/sme.ts +++ b/lib/routes/buaa/sme.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/buct/cist.ts b/lib/routes/buct/cist.ts index c482373d42..64b358b944 100644 --- a/lib/routes/buct/cist.ts +++ b/lib/routes/buct/cist.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/cist', diff --git a/lib/routes/buct/gr.ts b/lib/routes/buct/gr.ts index f9f0f36fdd..eeabde4d22 100644 --- a/lib/routes/buct/gr.ts +++ b/lib/routes/buct/gr.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import type { Context } from 'hono'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + export const route: Route = { path: '/gr/:type', categories: ['university'], diff --git a/lib/routes/buct/jwc.ts b/lib/routes/buct/jwc.ts index 3c084861a9..35c4b7dcc5 100644 --- a/lib/routes/buct/jwc.ts +++ b/lib/routes/buct/jwc.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/jwc', diff --git a/lib/routes/bugzilla/bug.ts b/lib/routes/bugzilla/bug.ts index afd82f3a3a..da5530d1c4 100644 --- a/lib/routes/bugzilla/bug.ts +++ b/lib/routes/bugzilla/bug.ts @@ -1,7 +1,8 @@ import { load } from 'cheerio'; -import { Context } from 'hono'; +import type { Context } from 'hono'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { Data, DataItem, Route } from '@/types'; +import type { Data, DataItem, Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/bulianglin/rss.ts b/lib/routes/bulianglin/rss.ts index a69cef1fc1..4dd3edc1a1 100644 --- a/lib/routes/bulianglin/rss.ts +++ b/lib/routes/bulianglin/rss.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + export const route: Route = { path: '/', categories: ['blog'], diff --git a/lib/routes/bullionvault/gold-news.ts b/lib/routes/bullionvault/gold-news.ts index dfd5e22a0d..07dda60932 100644 --- a/lib/routes/bullionvault/gold-news.ts +++ b/lib/routes/bullionvault/gold-news.ts @@ -1,13 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const { category } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/bupt/jwc.ts b/lib/routes/bupt/jwc.ts index db112b71bb..f1c9507ebb 100644 --- a/lib/routes/bupt/jwc.ts +++ b/lib/routes/bupt/jwc.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { Route } from '@/types'; 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 type { Context } from 'hono'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/jwc/:type', diff --git a/lib/routes/bupt/rczp.ts b/lib/routes/bupt/rczp.ts index bbe4458a57..acf1d795c2 100644 --- a/lib/routes/bupt/rczp.ts +++ b/lib/routes/bupt/rczp.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/rczp', diff --git a/lib/routes/bupt/scss.ts b/lib/routes/bupt/scss.ts index 2c3c86abec..3a87e867e9 100644 --- a/lib/routes/bupt/scss.ts +++ b/lib/routes/bupt/scss.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/scss/tzgg', diff --git a/lib/routes/byau/xinwen/index.ts b/lib/routes/byau/xinwen/index.ts index b6dc00800f..aa1892012b 100644 --- a/lib/routes/byau/xinwen/index.ts +++ b/lib/routes/byau/xinwen/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/byteclicks/index.ts b/lib/routes/byteclicks/index.ts index 16fcb05855..67865b163b 100644 --- a/lib/routes/byteclicks/index.ts +++ b/lib/routes/byteclicks/index.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import { parseItem } from './utils'; + const baseUrl = 'https://byteclicks.com'; export const route: Route = { diff --git a/lib/routes/byteclicks/tag.ts b/lib/routes/byteclicks/tag.ts index 8ca6ba2d06..8a15daa89e 100644 --- a/lib/routes/byteclicks/tag.ts +++ b/lib/routes/byteclicks/tag.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import { parseItem } from './utils'; + const baseUrl = 'https://byteclicks.com'; export const route: Route = { diff --git a/lib/routes/bytes/bytes.ts b/lib/routes/bytes/bytes.ts index c7b2b24a6c..906306c110 100644 --- a/lib/routes/bytes/bytes.ts +++ b/lib/routes/bytes/bytes.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -const currentURL = 'https://bytes.dev/archives'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +const currentURL = 'https://bytes.dev/archives'; + export const route: Route = { path: '/', radar: [ diff --git a/lib/routes/c114/roll.ts b/lib/routes/c114/roll.ts index 2e4835cad7..12629867a8 100644 --- a/lib/routes/c114/roll.ts +++ b/lib/routes/c114/roll.ts @@ -1,11 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import iconv from 'iconv-lite'; +import type { Route } from '@/types'; 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 iconv from 'iconv-lite'; +import timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { original = 'false' } = ctx.req.param(); diff --git a/lib/routes/caai/index.ts b/lib/routes/caai/index.ts index 82e17bd37f..360519205d 100644 --- a/lib/routes/caai/index.ts +++ b/lib/routes/caai/index.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import utils from './utils'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + +import utils from './utils'; + export const route: Route = { path: '/:caty', categories: ['study'], diff --git a/lib/routes/caai/utils.ts b/lib/routes/caai/utils.ts index 47a57b5935..0894a5ca85 100644 --- a/lib/routes/caai/utils.ts +++ b/lib/routes/caai/utils.ts @@ -1,8 +1,10 @@ -import { load } from 'cheerio'; -import got from '@/utils/got'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; const base = 'http://www.caai.cn'; diff --git a/lib/routes/caam/index.ts b/lib/routes/caam/index.ts index f2ee231f2f..9753cb9086 100644 --- a/lib/routes/caam/index.ts +++ b/lib/routes/caam/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/caareviews/book.ts b/lib/routes/caareviews/book.ts index 38cbcafd95..5950fa4b92 100644 --- a/lib/routes/caareviews/book.ts +++ b/lib/routes/caareviews/book.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; -import { rootUrl, getList, getItems } from './utils'; +import type { Route } from '@/types'; + +import { getItems, getList, rootUrl } from './utils'; export const route: Route = { path: '/book', diff --git a/lib/routes/caareviews/essay.ts b/lib/routes/caareviews/essay.ts index 4c99eee9d1..2b404cfe59 100644 --- a/lib/routes/caareviews/essay.ts +++ b/lib/routes/caareviews/essay.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; -import { rootUrl, getList, getItems } from './utils'; +import type { Route } from '@/types'; + +import { getItems, getList, rootUrl } from './utils'; export const route: Route = { path: '/essay', diff --git a/lib/routes/caareviews/exhibition.ts b/lib/routes/caareviews/exhibition.ts index a6fd9d97dd..fc9ab6c526 100644 --- a/lib/routes/caareviews/exhibition.ts +++ b/lib/routes/caareviews/exhibition.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; -import { rootUrl, getList, getItems } from './utils'; +import type { Route } from '@/types'; + +import { getItems, getList, rootUrl } from './utils'; export const route: Route = { path: '/exhibition', diff --git a/lib/routes/caareviews/utils.ts b/lib/routes/caareviews/utils.ts index 918fd88f47..98a4781788 100644 --- a/lib/routes/caareviews/utils.ts +++ b/lib/routes/caareviews/utils.ts @@ -1,9 +1,11 @@ +import path from 'node:path'; + +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const rootUrl = 'http://www.caareviews.org'; @@ -43,4 +45,4 @@ const getItems = (ctx, list) => ) ); -export { rootUrl, getList, getItems }; +export { getItems, getList, rootUrl }; diff --git a/lib/routes/cags/edu/index.ts b/lib/routes/cags/edu/index.ts index f5e71ed6d6..9a117f4e49 100644 --- a/lib/routes/cags/edu/index.ts +++ b/lib/routes/cags/edu/index.ts @@ -1,5 +1,5 @@ +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; -import { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/cahkms/index.ts b/lib/routes/cahkms/index.ts index 4f0258db7f..7b7e6e5dde 100644 --- a/lib/routes/cahkms/index.ts +++ b/lib/routes/cahkms/index.ts @@ -1,11 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; const titles = { '01': '关于我们', diff --git a/lib/routes/caijing/roll.ts b/lib/routes/caijing/roll.ts index bdcf72e67e..eac82084e2 100644 --- a/lib/routes/caijing/roll.ts +++ b/lib/routes/caijing/roll.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/caixin/article.ts b/lib/routes/caixin/article.ts index 1fd50c3920..522d1f5064 100644 --- a/lib/routes/caixin/article.ts +++ b/lib/routes/caixin/article.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { parseArticle } from './utils'; export const route: Route = { diff --git a/lib/routes/caixin/blog.ts b/lib/routes/caixin/blog.ts index 5a3a789dd4..89d61546fb 100644 --- a/lib/routes/caixin/blog.ts +++ b/lib/routes/caixin/blog.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { isValidHost } from '@/utils/valid-host'; import { parseDate } from '@/utils/parse-date'; +import { isValidHost } from '@/utils/valid-host'; + import { parseBlogArticle } from './utils'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; export const route: Route = { path: '/blog/:column?', diff --git a/lib/routes/caixin/category.ts b/lib/routes/caixin/category.ts index 134c9a162b..ba2d71265a 100644 --- a/lib/routes/caixin/category.ts +++ b/lib/routes/caixin/category.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { isValidHost } from '@/utils/valid-host'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; +import { isValidHost } from '@/utils/valid-host'; + import { parseArticle } from './utils'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; export const route: Route = { path: '/:column/:category', diff --git a/lib/routes/caixin/database.ts b/lib/routes/caixin/database.ts index 1cc8cfa9fa..5909b3b7a7 100644 --- a/lib/routes/caixin/database.ts +++ b/lib/routes/caixin/database.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/database', diff --git a/lib/routes/caixin/k.ts b/lib/routes/caixin/k.ts index 3f75a29459..9328f5aa51 100644 --- a/lib/routes/caixin/k.ts +++ b/lib/routes/caixin/k.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/caixin/latest.ts b/lib/routes/caixin/latest.ts index 7705ecefe4..4af188a3b5 100644 --- a/lib/routes/caixin/latest.ts +++ b/lib/routes/caixin/latest.ts @@ -1,9 +1,10 @@ -import { Route, ViewType } from '@/types'; -import { getFulltext } from './utils-fulltext'; - +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; + import { parseArticle } from './utils'; +import { getFulltext } from './utils-fulltext'; export const route: Route = { path: '/latest', diff --git a/lib/routes/caixin/utils-fulltext.ts b/lib/routes/caixin/utils-fulltext.ts index 6b517feb1f..3d1b01da06 100644 --- a/lib/routes/caixin/utils-fulltext.ts +++ b/lib/routes/caixin/utils-fulltext.ts @@ -1,7 +1,9 @@ import crypto from 'node:crypto'; + import { hextob64, KJUR } from 'jsrsasign'; -import ofetch from '@/utils/ofetch'; + import { config } from '@/config'; +import ofetch from '@/utils/ofetch'; // The following constant is extracted from this script: https://file.caixin.com/pkg/cx-pay-layer/js/wap.js?v=5.15.421933 . It is believed to contain no sensitive information. // Refer to this discussion for further explanation: https://github.com/DIYgod/RSSHub/pull/17231 diff --git a/lib/routes/caixin/utils.ts b/lib/routes/caixin/utils.ts index fd00ad4c1a..9268e05d8a 100644 --- a/lib/routes/caixin/utils.ts +++ b/lib/routes/caixin/utils.ts @@ -1,8 +1,10 @@ -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import got from '@/utils/got'; +import { art } from '@/utils/render'; + const parseArticle = async (item) => { if (/\.blog\.caixin\.com$/.test(new URL(item.link).hostname)) { return parseBlogArticle(item); diff --git a/lib/routes/caixin/weekly.ts b/lib/routes/caixin/weekly.ts index 2ce6f0b958..c67ef5b04c 100644 --- a/lib/routes/caixin/weekly.ts +++ b/lib/routes/caixin/weekly.ts @@ -1,7 +1,8 @@ -import { DataItem, Route } from '@/types'; +import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/caixinglobal/latest.ts b/lib/routes/caixinglobal/latest.ts index 598e3a5f93..87b02b2384 100644 --- a/lib/routes/caixinglobal/latest.ts +++ b/lib/routes/caixinglobal/latest.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/camchina/index.ts b/lib/routes/camchina/index.ts index 0c7976c9b3..811d9311ca 100644 --- a/lib/routes/camchina/index.ts +++ b/lib/routes/camchina/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/:id?', diff --git a/lib/routes/cankaoxiaoxi/index.ts b/lib/routes/cankaoxiaoxi/index.ts index 96388e0d1e..b6bc80fb3d 100644 --- a/lib/routes/cankaoxiaoxi/index.ts +++ b/lib/routes/cankaoxiaoxi/index.ts @@ -1,11 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: ['/column/:id?', '/:id?'], diff --git a/lib/routes/capitalmind/insights.ts b/lib/routes/capitalmind/insights.ts index 195a83f1f8..4ed414609d 100644 --- a/lib/routes/capitalmind/insights.ts +++ b/lib/routes/capitalmind/insights.ts @@ -1,4 +1,5 @@ -import { Data, Route } from '@/types'; +import type { Data, Route } from '@/types'; + import { baseUrl, fetchArticles } from './utils'; export const route: Route = { diff --git a/lib/routes/capitalmind/podcasts.ts b/lib/routes/capitalmind/podcasts.ts index 12e2d7c750..4a1bfa7d86 100644 --- a/lib/routes/capitalmind/podcasts.ts +++ b/lib/routes/capitalmind/podcasts.ts @@ -1,4 +1,5 @@ -import { Data, Route } from '@/types'; +import type { Data, Route } from '@/types'; + import { baseUrl, fetchArticles } from './utils'; export const route: Route = { diff --git a/lib/routes/capitalmind/utils.ts b/lib/routes/capitalmind/utils.ts index fa2d05566d..5f92b42769 100644 --- a/lib/routes/capitalmind/utils.ts +++ b/lib/routes/capitalmind/utils.ts @@ -1,7 +1,8 @@ import { load } from 'cheerio'; -import ofetch from '@/utils/ofetch'; + +import type { DataItem } from '@/types'; import cache from '@/utils/cache'; -import { DataItem } from '@/types'; +import ofetch from '@/utils/ofetch'; export const baseUrl = 'https://www.capitalmind.in'; diff --git a/lib/routes/cara/likes.ts b/lib/routes/cara/likes.ts index 422452a46d..30b82896dc 100644 --- a/lib/routes/cara/likes.ts +++ b/lib/routes/cara/likes.ts @@ -1,10 +1,12 @@ +import path from 'node:path'; + import type { Data, DataItem, Route } from '@/types'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + +import { API_HOST, CDN_HOST, HOST } from './constant'; import type { PostsResponse } from './types'; import { customFetch, parseUserData } from './utils'; -import { API_HOST, CDN_HOST, HOST } from './constant'; -import { art } from '@/utils/render'; -import { parseDate } from '@/utils/parse-date'; -import path from 'node:path'; export const route: Route = { path: ['/likes/:user'], diff --git a/lib/routes/cara/portfolio.ts b/lib/routes/cara/portfolio.ts index bfbc41b5d0..48e57f2f7b 100644 --- a/lib/routes/cara/portfolio.ts +++ b/lib/routes/cara/portfolio.ts @@ -1,8 +1,9 @@ import type { Data, DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; + +import { API_HOST, CDN_HOST, HOST } from './constant'; import type { PortfolioResponse } from './types'; import { customFetch, fetchPortfolioItem, parseUserData } from './utils'; -import { API_HOST, CDN_HOST, HOST } from './constant'; -import cache from '@/utils/cache'; export const route: Route = { path: ['/portfolio/:user'], diff --git a/lib/routes/cara/timeline.ts b/lib/routes/cara/timeline.ts index 776feba310..00ff39209d 100644 --- a/lib/routes/cara/timeline.ts +++ b/lib/routes/cara/timeline.ts @@ -1,10 +1,12 @@ +import path from 'node:path'; + import type { Data, DataItem, Route } from '@/types'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + +import { API_HOST, CDN_HOST, HOST } from './constant'; import type { PostsResponse } from './types'; import { customFetch, parseUserData } from './utils'; -import { API_HOST, CDN_HOST, HOST } from './constant'; -import { art } from '@/utils/render'; -import { parseDate } from '@/utils/parse-date'; -import path from 'node:path'; export const route: Route = { path: ['/timeline/:user'], diff --git a/lib/routes/cara/utils.ts b/lib/routes/cara/utils.ts index 92d1ce4c4d..39c2aa74b7 100644 --- a/lib/routes/cara/utils.ts +++ b/lib/routes/cara/utils.ts @@ -1,12 +1,14 @@ -import { config } from '@/config'; -import ofetch from '@/utils/ofetch'; -import type { FetchOptions, FetchRequest, ResponseType } from 'ofetch'; -import type { PortfolioDetailResponse, PortfolioResponse, UserNextData } from './types'; -import type { DataItem } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import { API_HOST, CDN_HOST, HOST } from './constant'; import { load } from 'cheerio'; +import type { FetchOptions, FetchRequest, ResponseType } from 'ofetch'; + +import { config } from '@/config'; +import type { DataItem } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + +import { API_HOST, CDN_HOST, HOST } from './constant'; +import type { PortfolioDetailResponse, PortfolioResponse, UserNextData } from './types'; export function customFetch(request: FetchRequest, options?: FetchOptions) { return ofetch(request, { diff --git a/lib/routes/cartoonmad/comic.ts b/lib/routes/cartoonmad/comic.ts index 0cb816462e..75eddc6f08 100644 --- a/lib/routes/cartoonmad/comic.ts +++ b/lib/routes/cartoonmad/comic.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; -import { load } from 'cheerio'; -import got from '@/utils/got'; -import iconv from 'iconv-lite'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; +import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + const baseUrl = 'https://www.cartoonmad.com'; const KEY = '5e585'; diff --git a/lib/routes/cas/cg/index.ts b/lib/routes/cas/cg/index.ts index 714d637bd9..a4aba4e7c7 100644 --- a/lib/routes/cas/cg/index.ts +++ b/lib/routes/cas/cg/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/cas/genetics/index.ts b/lib/routes/cas/genetics/index.ts index 1f910cf67e..842288e94b 100644 --- a/lib/routes/cas/genetics/index.ts +++ b/lib/routes/cas/genetics/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://genetics.cas.cn'; diff --git a/lib/routes/cas/ia/yjs.ts b/lib/routes/cas/ia/yjs.ts index 536334dc6d..d37b8a99c8 100644 --- a/lib/routes/cas/ia/yjs.ts +++ b/lib/routes/cas/ia/yjs.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/ia/yjs', categories: ['university'], diff --git a/lib/routes/cas/iee/kydt.ts b/lib/routes/cas/iee/kydt.ts index e52b38d436..8d5e23ffc1 100644 --- a/lib/routes/cas/iee/kydt.ts +++ b/lib/routes/cas/iee/kydt.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/cas/is/index.ts b/lib/routes/cas/is/index.ts index c608a8cc8e..ec7390918d 100644 --- a/lib/routes/cas/is/index.ts +++ b/lib/routes/cas/is/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://is.cas.cn'; diff --git a/lib/routes/cas/mesalab/kb.ts b/lib/routes/cas/mesalab/kb.ts index 346aacc2a4..35bebdfa89 100644 --- a/lib/routes/cas/mesalab/kb.ts +++ b/lib/routes/cas/mesalab/kb.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import * as cheerio from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/cas/sim/kyjz.ts b/lib/routes/cas/sim/kyjz.ts index 1be7fd41e1..116fc6ccb3 100644 --- a/lib/routes/cas/sim/kyjz.ts +++ b/lib/routes/cas/sim/kyjz.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const host = 'http://www.sim.cas.cn/'; diff --git a/lib/routes/casssp/news.ts b/lib/routes/casssp/news.ts index 8c9c5f20bc..ec9e359fbb 100644 --- a/lib/routes/casssp/news.ts +++ b/lib/routes/casssp/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/cast/index.ts b/lib/routes/cast/index.ts index 56759bd7a3..887283ca4d 100644 --- a/lib/routes/cast/index.ts +++ b/lib/routes/cast/index.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + const baseUrl = 'https://www.cast.org.cn'; async function parsePage(html: string) { diff --git a/lib/routes/catti/news.ts b/lib/routes/catti/news.ts index 8d926c5141..20fd5aae4f 100644 --- a/lib/routes/catti/news.ts +++ b/lib/routes/catti/news.ts @@ -1,8 +1,9 @@ -import { DataItem, Route } from '@/types'; +import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; type NewsCategory = { title: string; diff --git a/lib/routes/cau/ele.ts b/lib/routes/cau/ele.ts index e7810da2dd..99d2510407 100644 --- a/lib/routes/cau/ele.ts +++ b/lib/routes/cau/ele.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/cau/yjs.ts b/lib/routes/cau/yjs.ts index e2a447355a..a2a77d545a 100644 --- a/lib/routes/cau/yjs.ts +++ b/lib/routes/cau/yjs.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/caus/index.ts b/lib/routes/caus/index.ts index a7a8bf1bab..d93a108da1 100644 --- a/lib/routes/caus/index.ts +++ b/lib/routes/caus/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; diff --git a/lib/routes/cbaigui/index.ts b/lib/routes/cbaigui/index.ts index 81bc814dc4..fab210c7ba 100644 --- a/lib/routes/cbaigui/index.ts +++ b/lib/routes/cbaigui/index.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; - -import { getSubPath } from '@/utils/common-utils'; -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import { art } from '@/utils/render'; import path from 'node:path'; -import { rootUrl, apiSlug, GetFilterId } from './utils'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + +import { apiSlug, GetFilterId, rootUrl } from './utils'; export const route: Route = { path: '*', diff --git a/lib/routes/cbaigui/utils.ts b/lib/routes/cbaigui/utils.ts index eb43835f15..1adfa72d90 100644 --- a/lib/routes/cbaigui/utils.ts +++ b/lib/routes/cbaigui/utils.ts @@ -11,4 +11,4 @@ const GetFilterId = async (type, name) => { return filterResponse.findLast((f) => f.name === name)?.id ?? undefined; }; -export { rootUrl, apiSlug, GetFilterId }; +export { apiSlug, GetFilterId, rootUrl }; diff --git a/lib/routes/cbc/topics.ts b/lib/routes/cbc/topics.ts index 95aa183036..5b9721eed7 100644 --- a/lib/routes/cbc/topics.ts +++ b/lib/routes/cbc/topics.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/topics/:topic?', diff --git a/lib/routes/cbirc/index.ts b/lib/routes/cbirc/index.ts index e4e5fb69e7..41a1bbfdc3 100644 --- a/lib/routes/cbirc/index.ts +++ b/lib/routes/cbirc/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; diff --git a/lib/routes/cbndata/information.ts b/lib/routes/cbndata/information.ts index f0c8a984ad..ceb96c5c4b 100644 --- a/lib/routes/cbndata/information.ts +++ b/lib/routes/cbndata/information.ts @@ -1,13 +1,13 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import { art } from '@/utils/render'; -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; +import path from 'node:path'; import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; -import path from 'node:path'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { id = 'all' } = ctx.req.param(); diff --git a/lib/routes/cbnweek/index.ts b/lib/routes/cbnweek/index.ts index aa3ad620d6..9b2474be1c 100644 --- a/lib/routes/cbnweek/index.ts +++ b/lib/routes/cbnweek/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/cbpanet/index.ts b/lib/routes/cbpanet/index.ts index c21d1d2f20..46b080bae4 100644 --- a/lib/routes/cbpanet/index.ts +++ b/lib/routes/cbpanet/index.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { bigId = '2', smallId = '11' } = ctx.req.param(); diff --git a/lib/routes/ccac/news.ts b/lib/routes/ccac/news.ts index 94f4cec3ae..8af1f2ff98 100644 --- a/lib/routes/ccac/news.ts +++ b/lib/routes/ccac/news.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import utils from './utils'; -import { parseDate } from '@/utils/parse-date'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; +import utils from './utils'; + export const route: Route = { path: '/news/:type/:lang?', categories: ['government'], diff --git a/lib/routes/ccagm/index.ts b/lib/routes/ccagm/index.ts index 9c294c3480..af79a1dc5e 100644 --- a/lib/routes/ccagm/index.ts +++ b/lib/routes/ccagm/index.ts @@ -1,14 +1,13 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const { category = 'association-news' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '10', 10); diff --git a/lib/routes/cccfna/index.ts b/lib/routes/cccfna/index.ts index de3dabbf3c..de6152dd93 100644 --- a/lib/routes/cccfna/index.ts +++ b/lib/routes/cccfna/index.ts @@ -1,9 +1,10 @@ -import { Route, DataItem } from '@/types'; +import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { load } from 'cheerio'; -import ofetch from '@/utils/ofetch'; export const route: Route = { path: '/:category/:type?', diff --git a/lib/routes/cccmc/index.ts b/lib/routes/cccmc/index.ts index 4e314289c6..3d9b618f77 100644 --- a/lib/routes/cccmc/index.ts +++ b/lib/routes/cccmc/index.ts @@ -1,13 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const { category = 'ywgg/tzgg' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '15', 10); diff --git a/lib/routes/ccf/ccfcv/index.ts b/lib/routes/ccf/ccfcv/index.ts index 902d88cfe9..4b038d0ea9 100644 --- a/lib/routes/ccf/ccfcv/index.ts +++ b/lib/routes/ccf/ccfcv/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const rootUrl = 'https://tc.ccf.org.cn'; diff --git a/lib/routes/ccf/news.ts b/lib/routes/ccf/news.ts index e3ddc11b65..98daceb06e 100644 --- a/lib/routes/ccf/news.ts +++ b/lib/routes/ccf/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ccf/tfbd/index.ts b/lib/routes/ccf/tfbd/index.ts index 5576989890..7f3e8ec6b5 100644 --- a/lib/routes/ccf/tfbd/index.ts +++ b/lib/routes/ccf/tfbd/index.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import utils from './utils'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + +import utils from './utils'; + export const route: Route = { path: '/tfbd/:caty/:id', categories: ['study'], diff --git a/lib/routes/ccf/tfbd/utils.ts b/lib/routes/ccf/tfbd/utils.ts index c7e9ddbd94..544f2c9a7f 100644 --- a/lib/routes/ccf/tfbd/utils.ts +++ b/lib/routes/ccf/tfbd/utils.ts @@ -1,8 +1,10 @@ -import { load } from 'cheerio'; -import got from '@/utils/got'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; const base = 'http://tfbd.ccf.org.cn'; diff --git a/lib/routes/ccfa/index.ts b/lib/routes/ccfa/index.ts index dfb7bf2b44..83c7c988d0 100644 --- a/lib/routes/ccfa/index.ts +++ b/lib/routes/ccfa/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const handler = async (ctx) => { const { type = '1' } = ctx.req.param(); diff --git a/lib/routes/ccg/index.ts b/lib/routes/ccg/index.ts index b3ee013f7e..782783ff71 100644 --- a/lib/routes/ccg/index.ts +++ b/lib/routes/ccg/index.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { category = 'news' } = ctx.req.param(); diff --git a/lib/routes/ccnu/career.ts b/lib/routes/ccnu/career.ts index 171e1cc8f1..d77e931499 100644 --- a/lib/routes/ccnu/career.ts +++ b/lib/routes/ccnu/career.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ccnu/cs.ts b/lib/routes/ccnu/cs.ts index c463ca9406..b83e71aef2 100644 --- a/lib/routes/ccnu/cs.ts +++ b/lib/routes/ccnu/cs.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ccnu/wu.ts b/lib/routes/ccnu/wu.ts index 68a537d7c3..5c076f8de2 100644 --- a/lib/routes/ccnu/wu.ts +++ b/lib/routes/ccnu/wu.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ccnu/yjs.ts b/lib/routes/ccnu/yjs.ts index 7f838f99b2..c5e71f259a 100644 --- a/lib/routes/ccnu/yjs.ts +++ b/lib/routes/ccnu/yjs.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ccreports/index.ts b/lib/routes/ccreports/index.ts index 76c4914e0d..969e3e137b 100644 --- a/lib/routes/ccreports/index.ts +++ b/lib/routes/ccreports/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/cctv/category.ts b/lib/routes/cctv/category.ts index f1f854bb28..6b018770ad 100644 --- a/lib/routes/cctv/category.ts +++ b/lib/routes/cctv/category.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import getMzzlbg from './utils/mzzlbg'; -import xinwen1j1 from './utils/xinwen1j1'; import getNews from './utils/news'; +import xinwen1j1 from './utils/xinwen1j1'; import getXWLB from './xwlb'; export const route: Route = { diff --git a/lib/routes/cctv/jx.ts b/lib/routes/cctv/jx.ts index bc15e61dc2..c1ee3fe06f 100644 --- a/lib/routes/cctv/jx.ts +++ b/lib/routes/cctv/jx.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/cctv/lm.ts b/lib/routes/cctv/lm.ts index 7294c74c01..a1af830997 100644 --- a/lib/routes/cctv/lm.ts +++ b/lib/routes/cctv/lm.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/lm/:id?', diff --git a/lib/routes/cctv/utils/news.ts b/lib/routes/cctv/utils/news.ts index d466486f35..14ef0ce7f3 100644 --- a/lib/routes/cctv/utils/news.ts +++ b/lib/routes/cctv/utils/news.ts @@ -1,9 +1,10 @@ +import path from 'node:path'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import path from 'node:path'; +import { PRESETS } from '@/utils/header-generator'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { PRESETS } from '@/utils/header-generator'; const getNews = async (category) => { const url = `https://news.cctv.com/2019/07/gaiban/cmsdatainterface/page/${category}_1.jsonp`; diff --git a/lib/routes/cctv/utils/xinwen1j1.ts b/lib/routes/cctv/utils/xinwen1j1.ts index 57a1edf3f5..a2072272c1 100644 --- a/lib/routes/cctv/utils/xinwen1j1.ts +++ b/lib/routes/cctv/utils/xinwen1j1.ts @@ -1,6 +1,7 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; // // 测试http://localhost:1200/cctv/xinwen1j1 diff --git a/lib/routes/cctv/xwlb.ts b/lib/routes/cctv/xwlb.ts index e7f2fdc543..9d8856f6b0 100644 --- a/lib/routes/cctv/xwlb.ts +++ b/lib/routes/cctv/xwlb.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import dayjs from 'dayjs'; +import customParseFormat from 'dayjs/plugin/customParseFormat.js'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { load } from 'cheerio'; -import dayjs from 'dayjs'; -import customParseFormat from 'dayjs/plugin/customParseFormat.js'; + dayjs.extend(customParseFormat); export const route: Route = { diff --git a/lib/routes/cde/index.ts b/lib/routes/cde/index.ts index f142f95f0d..2d342a48a9 100644 --- a/lib/routes/cde/index.ts +++ b/lib/routes/cde/index.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import utils from './utils'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import utils from './utils'; + const channelLinkMap = { news: 'https://www.cde.org.cn/main/news/listpage/545cf855a50574699b46b26bcb165f32', policy: 'https://www.cde.org.cn/main/policy/listpage/9f9c74c73e0f8f56a8bfbc646055026d', diff --git a/lib/routes/cde/xxgk.ts b/lib/routes/cde/xxgk.ts index 72c5396758..adf107dff9 100644 --- a/lib/routes/cde/xxgk.ts +++ b/lib/routes/cde/xxgk.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; + import utils from './utils'; const baseUrl = 'https://www.cde.org.cn'; diff --git a/lib/routes/cde/zdyz.ts b/lib/routes/cde/zdyz.ts index a3166acf57..5f78fa5114 100644 --- a/lib/routes/cde/zdyz.ts +++ b/lib/routes/cde/zdyz.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + import utils from './utils'; const baseUrl = 'https://www.cde.org.cn'; diff --git a/lib/routes/cdi/index.ts b/lib/routes/cdi/index.ts index 93338d7252..f518124bfd 100644 --- a/lib/routes/cdi/index.ts +++ b/lib/routes/cdi/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/:id?', diff --git a/lib/routes/cdu/cdrw.ts b/lib/routes/cdu/cdrw.ts index 912a746b66..57c9336b38 100644 --- a/lib/routes/cdu/cdrw.ts +++ b/lib/routes/cdu/cdrw.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/cdu/jwgg.ts b/lib/routes/cdu/jwgg.ts index dcd2f2be0f..0b682be6d0 100644 --- a/lib/routes/cdu/jwgg.ts +++ b/lib/routes/cdu/jwgg.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/cdu/tzggcdunews.ts b/lib/routes/cdu/tzggcdunews.ts index c4f299dc4a..319cdf8848 100644 --- a/lib/routes/cdu/tzggcdunews.ts +++ b/lib/routes/cdu/tzggcdunews.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/cdzjryb/project-list.ts b/lib/routes/cdzjryb/project-list.ts index f9cc192e37..f60cc6f8a1 100644 --- a/lib/routes/cdzjryb/project-list.ts +++ b/lib/routes/cdzjryb/project-list.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/zw/projectList', diff --git a/lib/routes/ce/district.ts b/lib/routes/ce/district.ts index 23eebe8a60..7a083ccd3a 100644 --- a/lib/routes/ce/district.ts +++ b/lib/routes/ce/district.ts @@ -1,9 +1,11 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { load } from 'cheerio'; -import ofetch from '@/utils/ofetch'; export const route: Route = { path: '/district/:category?', diff --git a/lib/routes/cebbank/all.ts b/lib/routes/cebbank/all.ts index 6d97641742..8fc204ea95 100644 --- a/lib/routes/cebbank/all.ts +++ b/lib/routes/cebbank/all.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import md5 from '@/utils/md5'; +import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; -import { parseDate } from '@/utils/parse-date'; -import md5 from '@/utils/md5'; export const route: Route = { path: '/quotation/all', diff --git a/lib/routes/cebbank/history.ts b/lib/routes/cebbank/history.ts index cc68ca0816..5dc11efaf2 100644 --- a/lib/routes/cebbank/history.ts +++ b/lib/routes/cebbank/history.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { art } from '@/utils/render'; + import utils from './utils'; const { TYPE } = utils; diff --git a/lib/routes/ceph/blog.ts b/lib/routes/ceph/blog.ts index 7c5e1dc9a2..155518378b 100644 --- a/lib/routes/ceph/blog.ts +++ b/lib/routes/ceph/blog.ts @@ -1,9 +1,10 @@ -import { Data, Route } from '@/types'; +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { Data, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { Context } from 'hono'; export const route: Route = { path: '/blog/:topic?', diff --git a/lib/routes/cfachina/analygarden.ts b/lib/routes/cfachina/analygarden.ts index 0995860ec5..13bf4c7bc4 100644 --- a/lib/routes/cfachina/analygarden.ts +++ b/lib/routes/cfachina/analygarden.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/cffex/announcement.ts b/lib/routes/cffex/announcement.ts index f9d449335e..ecbac01275 100644 --- a/lib/routes/cffex/announcement.ts +++ b/lib/routes/cffex/announcement.ts @@ -1,9 +1,10 @@ -import { DataItem, Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import cache from '@/utils/cache'; export const route: Route = { path: '/announcement', diff --git a/lib/routes/cfmmc/index.ts b/lib/routes/cfmmc/index.ts index 974bb41cf2..447ca72c8e 100644 --- a/lib/routes/cfmmc/index.ts +++ b/lib/routes/cfmmc/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/:id{.+}?', diff --git a/lib/routes/cfr/index.ts b/lib/routes/cfr/index.ts index efcd508044..181bbe391c 100644 --- a/lib/routes/cfr/index.ts +++ b/lib/routes/cfr/index.ts @@ -1,10 +1,12 @@ -import type { Data, Route } from '@/types'; -import type { Context } from 'hono'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { getDataItem } from './utils'; +import type { Context } from 'hono'; import pMap from 'p-map'; +import type { Data, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + +import { getDataItem } from './utils'; + export const route: Route = { path: '/:category/:subCategory?', categories: ['traditional-media'], diff --git a/lib/routes/cfr/namespace.ts b/lib/routes/cfr/namespace.ts index 939154e0cb..a2816e4684 100644 --- a/lib/routes/cfr/namespace.ts +++ b/lib/routes/cfr/namespace.ts @@ -1,4 +1,4 @@ -import { Namespace } from '@/types'; +import type { Namespace } from '@/types'; export const namespace: Namespace = { name: 'Council on Foreign Relations', diff --git a/lib/routes/cfr/utils.ts b/lib/routes/cfr/utils.ts index 56f6ba9cc2..3521b15607 100644 --- a/lib/routes/cfr/utils.ts +++ b/lib/routes/cfr/utils.ts @@ -1,9 +1,11 @@ import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; -import ofetch from '@/utils/ofetch'; + import type { DataItem } from '@/types'; -import { parseDate } from '@/utils/parse-date'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + import type { LinkData, VideoSetup } from './types'; export function getDataItem(href: string) { diff --git a/lib/routes/cgtn/podcast.ts b/lib/routes/cgtn/podcast.ts index dcda53ae93..d43adfb85f 100644 --- a/lib/routes/cgtn/podcast.ts +++ b/lib/routes/cgtn/podcast.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; async function getData(category, id) { const url = `https://radio.cgtn.com/downapiRES/radio/v1/program/historyList/programId${id}_category${category}_page1.json`; diff --git a/lib/routes/chaincatcher/home.ts b/lib/routes/chaincatcher/home.ts index 199e9543a6..619c9e72e9 100644 --- a/lib/routes/chaincatcher/home.ts +++ b/lib/routes/chaincatcher/home.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const rootUrl = 'https://www.chaincatcher.com'; diff --git a/lib/routes/chaincatcher/news.ts b/lib/routes/chaincatcher/news.ts index e0119edf9a..ba3003a8d3 100644 --- a/lib/routes/chaincatcher/news.ts +++ b/lib/routes/chaincatcher/news.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/changba/user.ts b/lib/routes/changba/user.ts index b08fcfb629..a07980d2a4 100644 --- a/lib/routes/changba/user.ts +++ b/lib/routes/changba/user.ts @@ -1,10 +1,13 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { art } from '@/utils/render'; -import path from 'node:path'; + const headers = { 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1' }; export const route: Route = { diff --git a/lib/routes/chaoxing/qk.ts b/lib/routes/chaoxing/qk.ts index 1790f4b496..0381ae90aa 100644 --- a/lib/routes/chaoxing/qk.ts +++ b/lib/routes/chaoxing/qk.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/qk/:id/:needContent?', diff --git a/lib/routes/chaping/banner.ts b/lib/routes/chaping/banner.ts index 359f30701d..e26ecb272c 100644 --- a/lib/routes/chaping/banner.ts +++ b/lib/routes/chaping/banner.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/chaping/news.ts b/lib/routes/chaping/news.ts index 5f74b2aa0b..8cceee1844 100644 --- a/lib/routes/chaping/news.ts +++ b/lib/routes/chaping/news.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/chaping/newsflash.ts b/lib/routes/chaping/newsflash.ts index 8f77d10808..d54eb163d8 100644 --- a/lib/routes/chaping/newsflash.ts +++ b/lib/routes/chaping/newsflash.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/cherrytimes/market.ts b/lib/routes/cherrytimes/market.ts index 121be3e0be..cc0ff977e0 100644 --- a/lib/routes/cherrytimes/market.ts +++ b/lib/routes/cherrytimes/market.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + export const route: Route = { path: '/market', categories: ['new-media'], diff --git a/lib/routes/chiculture/topic.ts b/lib/routes/chiculture/topic.ts index c992caa535..276df7a1ac 100644 --- a/lib/routes/chiculture/topic.ts +++ b/lib/routes/chiculture/topic.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/topic/:category?', diff --git a/lib/routes/chikubi/category.ts b/lib/routes/chikubi/category.ts index 0b29eb176b..c3ebafa910 100644 --- a/lib/routes/chikubi/category.ts +++ b/lib/routes/chikubi/category.ts @@ -1,4 +1,5 @@ -import { Route, Data } from '@/types'; +import type { Data, Route } from '@/types'; + import { getBySlug, getPostsBy } from './utils'; export const route: Route = { diff --git a/lib/routes/chikubi/index.ts b/lib/routes/chikubi/index.ts index d23747d255..8957304c5d 100644 --- a/lib/routes/chikubi/index.ts +++ b/lib/routes/chikubi/index.ts @@ -1,4 +1,5 @@ -import { Route, Data } from '@/types'; +import type { Data, Route } from '@/types'; + import { getPosts } from './utils'; export const route: Route = { diff --git a/lib/routes/chikubi/navigation.ts b/lib/routes/chikubi/navigation.ts index 7598d3ffe7..68b8f0ec40 100644 --- a/lib/routes/chikubi/navigation.ts +++ b/lib/routes/chikubi/navigation.ts @@ -1,7 +1,8 @@ -import { Route, Data } from '@/types'; -import { getBySlug, getPostsBy, processItems } from './utils'; +import type { Data, Route } from '@/types'; import parser from '@/utils/rss-parser'; +import { getBySlug, getPostsBy, processItems } from './utils'; + export const route: Route = { path: '/:keyword', categories: ['multimedia'], diff --git a/lib/routes/chikubi/nipple-video-category.ts b/lib/routes/chikubi/nipple-video-category.ts index 6be5f39c60..5077f504b0 100644 --- a/lib/routes/chikubi/nipple-video-category.ts +++ b/lib/routes/chikubi/nipple-video-category.ts @@ -1,7 +1,8 @@ -import { Route, Data } from '@/types'; -import { processItems } from './utils'; +import type { Data, Route } from '@/types'; import parser from '@/utils/rss-parser'; +import { processItems } from './utils'; + export const route: Route = { path: '/nipple-video-category/:keyword', categories: ['multimedia'], diff --git a/lib/routes/chikubi/nipple-video-maker.ts b/lib/routes/chikubi/nipple-video-maker.ts index 1dc2d3130c..2d2d1a2ee6 100644 --- a/lib/routes/chikubi/nipple-video-maker.ts +++ b/lib/routes/chikubi/nipple-video-maker.ts @@ -1,7 +1,8 @@ -import { Route, Data } from '@/types'; -import { processItems } from './utils'; +import type { Data, Route } from '@/types'; import parser from '@/utils/rss-parser'; +import { processItems } from './utils'; + export const route: Route = { path: '/nipple-video-maker/:keyword', categories: ['multimedia'], diff --git a/lib/routes/chikubi/search.ts b/lib/routes/chikubi/search.ts index e92b556047..da1802990e 100644 --- a/lib/routes/chikubi/search.ts +++ b/lib/routes/chikubi/search.ts @@ -1,7 +1,8 @@ -import { Route, Data } from '@/types'; -import { getPosts } from './utils'; +import type { Data, Route } from '@/types'; import got from '@/utils/got'; +import { getPosts } from './utils'; + export const route: Route = { path: '/search/:keyword', categories: ['multimedia'], diff --git a/lib/routes/chikubi/tag.ts b/lib/routes/chikubi/tag.ts index 43f92307b4..35eea4bee3 100644 --- a/lib/routes/chikubi/tag.ts +++ b/lib/routes/chikubi/tag.ts @@ -1,4 +1,5 @@ -import { Route, Data } from '@/types'; +import type { Data, Route } from '@/types'; + import { getBySlug, getPostsBy } from './utils'; export const route: Route = { diff --git a/lib/routes/chikubi/utils.ts b/lib/routes/chikubi/utils.ts index 2edbdea745..e2b075b239 100644 --- a/lib/routes/chikubi/utils.ts +++ b/lib/routes/chikubi/utils.ts @@ -1,7 +1,8 @@ -import { DataItem } from '@/types'; +import { load } from 'cheerio'; + +import type { DataItem } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const CONTENT_TYPES = { diff --git a/lib/routes/china/finance/finance.ts b/lib/routes/china/finance/finance.ts index f32547a99e..aa1e3b258d 100644 --- a/lib/routes/china/finance/finance.ts +++ b/lib/routes/china/finance/finance.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/china/news/highlights/news.ts b/lib/routes/china/news/highlights/news.ts index a042330281..6040938293 100644 --- a/lib/routes/china/news/highlights/news.ts +++ b/lib/routes/china/news/highlights/news.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/china/news/military/news.ts b/lib/routes/china/news/military/news.ts index a088ad43c2..a5520bcfdc 100644 --- a/lib/routes/china/news/military/news.ts +++ b/lib/routes/china/news/military/news.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/chinacdc/index.ts b/lib/routes/chinacdc/index.ts index 9c625f36ca..e72ddd1a68 100644 --- a/lib/routes/chinacdc/index.ts +++ b/lib/routes/chinacdc/index.ts @@ -1,15 +1,14 @@ import path from 'node:path'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type Context } from 'hono'; -import { type DataItem, type Route, type Data, ViewType } from '@/types'; - -import { art } from '@/utils/render'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { category = 'zxyw' } = ctx.req.param(); diff --git a/lib/routes/chinadaily/language.ts b/lib/routes/chinadaily/language.ts index 37ae513d15..7bd2523e81 100644 --- a/lib/routes/chinadaily/language.ts +++ b/lib/routes/chinadaily/language.ts @@ -1,16 +1,16 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; - export const handler = async (ctx: Context): Promise => { const { category = 'thelatest' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/chinadegrees/province.ts b/lib/routes/chinadegrees/province.ts index 52d7f15f73..8a762d1c63 100644 --- a/lib/routes/chinadegrees/province.ts +++ b/lib/routes/chinadegrees/province.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; + import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; +import { art } from '@/utils/render'; + const baseUrl = 'http://www.chinadegrees.com.cn'; export const route: Route = { diff --git a/lib/routes/chinafactcheck/index.ts b/lib/routes/chinafactcheck/index.ts index 69b19df153..75d1721a74 100644 --- a/lib/routes/chinafactcheck/index.ts +++ b/lib/routes/chinafactcheck/index.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import utils from './utils'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; +import utils from './utils'; + export const route: Route = { path: '/', radar: [ diff --git a/lib/routes/chinafactcheck/utils.ts b/lib/routes/chinafactcheck/utils.ts index 96e71d4c98..293a1ad6e9 100644 --- a/lib/routes/chinafactcheck/utils.ts +++ b/lib/routes/chinafactcheck/utils.ts @@ -1,7 +1,8 @@ import { load } from 'cheerio'; + +import { config } from '@/config'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; const siteLink = 'https://chinafactcheck.com'; diff --git a/lib/routes/chinaisa/index.ts b/lib/routes/chinaisa/index.ts index 17bc02430d..548079fa2b 100644 --- a/lib/routes/chinaisa/index.ts +++ b/lib/routes/chinaisa/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/chinamoney/notice.ts b/lib/routes/chinamoney/notice.ts index 8fb5c22eee..c524af19df 100644 --- a/lib/routes/chinamoney/notice.ts +++ b/lib/routes/chinamoney/notice.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { channels } from './channels'; export const route: Route = { diff --git a/lib/routes/chinanews/index.ts b/lib/routes/chinanews/index.ts index 762247fb87..aaccff0bac 100644 --- a/lib/routes/chinanews/index.ts +++ b/lib/routes/chinanews/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; +import timezone from '@/utils/timezone'; const rootUrl = 'https://www.chinanews.com.cn'; diff --git a/lib/routes/chinania/index.ts b/lib/routes/chinania/index.ts index b49960a7b8..9875fb0ded 100644 --- a/lib/routes/chinania/index.ts +++ b/lib/routes/chinania/index.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const handler = async (ctx) => { diff --git a/lib/routes/chinaratings/credit-research.ts b/lib/routes/chinaratings/credit-research.ts index d5e8ad31cc..bc9a870597 100644 --- a/lib/routes/chinaratings/credit-research.ts +++ b/lib/routes/chinaratings/credit-research.ts @@ -1,13 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const { category = 'Industry/Comment' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '15', 10); diff --git a/lib/routes/chinathinktanks/viewpoint.ts b/lib/routes/chinathinktanks/viewpoint.ts index 9cdd0e718e..021c8654ef 100644 --- a/lib/routes/chinathinktanks/viewpoint.ts +++ b/lib/routes/chinathinktanks/viewpoint.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import { CookieJar } from 'tough-cookie'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { CookieJar } from 'tough-cookie'; const cookieJar = new CookieJar(); const baseUrl = 'https://www.chinathinktanks.org.cn'; diff --git a/lib/routes/chinatimes/index.ts b/lib/routes/chinatimes/index.ts index 46e050656f..dc7a7bf0b6 100644 --- a/lib/routes/chinatimes/index.ts +++ b/lib/routes/chinatimes/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; -import puppeteer from '@/utils/puppeteer'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import logger from '@/utils/logger'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import puppeteer from '@/utils/puppeteer'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/chinaventure/index.ts b/lib/routes/chinaventure/index.ts index 146de6e66d..aff8352168 100644 --- a/lib/routes/chinaventure/index.ts +++ b/lib/routes/chinaventure/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/chinawriter/index.ts b/lib/routes/chinawriter/index.ts index 5f583dca82..946c8bc79f 100644 --- a/lib/routes/chinawriter/index.ts +++ b/lib/routes/chinawriter/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/:id{.+}?', diff --git a/lib/routes/chiphell/portal.ts b/lib/routes/chiphell/portal.ts index 4b6f577d30..1ff83542b7 100644 --- a/lib/routes/chiphell/portal.ts +++ b/lib/routes/chiphell/portal.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import * as cheerio from 'cheerio'; import type { Context } from 'hono'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import * as cheerio from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/chlinlearn/daily-blog.ts b/lib/routes/chlinlearn/daily-blog.ts index 36a03081de..e0ef1a3aab 100644 --- a/lib/routes/chlinlearn/daily-blog.ts +++ b/lib/routes/chlinlearn/daily-blog.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import CryptoJS from 'crypto-js'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; // 统一使用的请求库 import { parseDate } from '@/utils/parse-date'; // 解析日期的工具函数 import timezone from '@/utils/timezone'; -import CryptoJS from 'crypto-js'; export const route: Route = { path: '/daily-blog', diff --git a/lib/routes/chnmuseum/xingnew.ts b/lib/routes/chnmuseum/xingnew.ts index f7cee82d3a..afccbdacb0 100644 --- a/lib/routes/chnmuseum/xingnew.ts +++ b/lib/routes/chnmuseum/xingnew.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/chnmuseum/xwzt.ts b/lib/routes/chnmuseum/xwzt.ts index 5b53947095..719d91e62c 100644 --- a/lib/routes/chnmuseum/xwzt.ts +++ b/lib/routes/chnmuseum/xwzt.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + export const route: Route = { path: '/zx/xwzt', categories: ['travel'], diff --git a/lib/routes/chocolatey/packages.ts b/lib/routes/chocolatey/packages.ts index f56fa04231..5a4cc37778 100644 --- a/lib/routes/chocolatey/packages.ts +++ b/lib/routes/chocolatey/packages.ts @@ -1,12 +1,11 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + export const handler = async (ctx: Context): Promise => { const { id } = ctx.req.param(); diff --git a/lib/routes/chongbuluo/index.ts b/lib/routes/chongbuluo/index.ts index d392278fdb..db542bbb76 100644 --- a/lib/routes/chongbuluo/index.ts +++ b/lib/routes/chongbuluo/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/newthread', diff --git a/lib/routes/chongdiantou/index.ts b/lib/routes/chongdiantou/index.ts index d798231e9a..36c91c288d 100644 --- a/lib/routes/chongdiantou/index.ts +++ b/lib/routes/chongdiantou/index.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import { namespace } from './namespace'; import { load } from 'cheerio'; -import ofetch from '@/utils/ofetch'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + +import { namespace } from './namespace'; export const route: Route = { path: '/', diff --git a/lib/routes/chsi/hotnews.ts b/lib/routes/chsi/hotnews.ts index d41290c107..316ab02af2 100644 --- a/lib/routes/chsi/hotnews.ts +++ b/lib/routes/chsi/hotnews.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const host = 'https://yz.chsi.com.cn'; diff --git a/lib/routes/chsi/kydt.ts b/lib/routes/chsi/kydt.ts index faf9b25d71..b590fdaa26 100644 --- a/lib/routes/chsi/kydt.ts +++ b/lib/routes/chsi/kydt.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; const host = 'https://yz.chsi.com.cn'; diff --git a/lib/routes/chsi/kyzx.ts b/lib/routes/chsi/kyzx.ts index 3955db9766..824ceb163d 100644 --- a/lib/routes/chsi/kyzx.ts +++ b/lib/routes/chsi/kyzx.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; const host = 'https://yz.chsi.com.cn'; diff --git a/lib/routes/chuanliu/nice.ts b/lib/routes/chuanliu/nice.ts index ed0cc0f842..9982f44acb 100644 --- a/lib/routes/chuanliu/nice.ts +++ b/lib/routes/chuanliu/nice.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import MarkdownIt from 'markdown-it'; + const md = MarkdownIt({ html: true, }); diff --git a/lib/routes/chuapp/chuapp.ts b/lib/routes/chuapp/chuapp.ts index 99e277de41..6ffd5d28e1 100644 --- a/lib/routes/chuapp/chuapp.ts +++ b/lib/routes/chuapp/chuapp.ts @@ -1,9 +1,10 @@ -import { Context } from 'hono'; import { load } from 'cheerio'; -import { Data, Route, DataItem } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Context } from 'hono'; + +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/chub/characters.ts b/lib/routes/chub/characters.ts index f2d1b3b105..0ed1d8a445 100644 --- a/lib/routes/chub/characters.ts +++ b/lib/routes/chub/characters.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/cib/whpj.ts b/lib/routes/cib/whpj.ts index ed45754177..ec3637e606 100644 --- a/lib/routes/cib/whpj.ts +++ b/lib/routes/cib/whpj.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; +import crypto from 'node:crypto'; +import https from 'node:https'; + +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import https from 'node:https'; -import crypto from 'node:crypto'; -import { config } from '@/config'; export const route: Route = { path: '/whpj/:format?', diff --git a/lib/routes/cih-index/report.ts b/lib/routes/cih-index/report.ts index f909df9bc5..b3f6a0263a 100644 --- a/lib/routes/cih-index/report.ts +++ b/lib/routes/cih-index/report.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ciidbnu/index.ts b/lib/routes/ciidbnu/index.ts index c4e44fa195..f9411e84a6 100644 --- a/lib/routes/ciidbnu/index.ts +++ b/lib/routes/ciidbnu/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/cisia/index.ts b/lib/routes/cisia/index.ts index 49d31e88cb..7e3bb4feab 100644 --- a/lib/routes/cisia/index.ts +++ b/lib/routes/cisia/index.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const handler = async (ctx) => { diff --git a/lib/routes/civitai/discussions.ts b/lib/routes/civitai/discussions.ts index 6a54687dfb..200574e1bf 100644 --- a/lib/routes/civitai/discussions.ts +++ b/lib/routes/civitai/discussions.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; -import { load } from 'cheerio'; export const route: Route = { path: '/discussions/:modelId', diff --git a/lib/routes/civitai/models.ts b/lib/routes/civitai/models.ts index 1a16ae5847..06cafbe508 100644 --- a/lib/routes/civitai/models.ts +++ b/lib/routes/civitai/models.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/civitai/user.ts b/lib/routes/civitai/user.ts index 08018c1649..0cecea8dad 100644 --- a/lib/routes/civitai/user.ts +++ b/lib/routes/civitai/user.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/ciweimao/chapter.ts b/lib/routes/ciweimao/chapter.ts index a6a88675d0..10412edba6 100644 --- a/lib/routes/ciweimao/chapter.ts +++ b/lib/routes/ciweimao/chapter.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/cjlu/yjsy/index.ts b/lib/routes/cjlu/yjsy/index.ts index 41dabe8ee8..1b333b623d 100644 --- a/lib/routes/cjlu/yjsy/index.ts +++ b/lib/routes/cjlu/yjsy/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import timezone from '@/utils/timezone'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import { getPuppeteerPage } from '@/utils/puppeteer'; +import timezone from '@/utils/timezone'; const host = 'https://yjsy.cjlu.edu.cn/'; diff --git a/lib/routes/clickme/index.ts b/lib/routes/clickme/index.ts index 0bee42418e..ff72aa1926 100644 --- a/lib/routes/clickme/index.ts +++ b/lib/routes/clickme/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/cline/blog.ts b/lib/routes/cline/blog.ts index 82dd8a80d3..a24306c921 100644 --- a/lib/routes/cline/blog.ts +++ b/lib/routes/cline/blog.ts @@ -1,7 +1,8 @@ -import { load, type CheerioAPI } from 'cheerio'; +import { type CheerioAPI, load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { Route, DataItem } from '@/types'; const rootUrl = 'https://cline.bot'; const blogUrl = `${rootUrl}/blog`; diff --git a/lib/routes/cloudflarestatus/index.ts b/lib/routes/cloudflarestatus/index.ts index 5744857f66..f49a12b6a6 100644 --- a/lib/routes/cloudflarestatus/index.ts +++ b/lib/routes/cloudflarestatus/index.ts @@ -1,13 +1,13 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type Context } from 'hono'; -import path from 'node:path'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '100', 10); diff --git a/lib/routes/cloudnative/blog.ts b/lib/routes/cloudnative/blog.ts index 46e74981b7..4da530cc9c 100644 --- a/lib/routes/cloudnative/blog.ts +++ b/lib/routes/cloudnative/blog.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/cls/depth.ts b/lib/routes/cls/depth.ts index d80754cdbd..28330d50db 100644 --- a/lib/routes/cls/depth.ts +++ b/lib/routes/cls/depth.ts @@ -1,14 +1,15 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import { art } from '@/utils/render'; import path from 'node:path'; -import { rootUrl, getSearchParams } from './utils'; +import { load } from 'cheerio'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + +import { getSearchParams, rootUrl } from './utils'; const categories = { 1000: '头条', diff --git a/lib/routes/cls/hot.ts b/lib/routes/cls/hot.ts index 4da407fac2..88c2ab1d59 100644 --- a/lib/routes/cls/hot.ts +++ b/lib/routes/cls/hot.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import { art } from '@/utils/render'; import path from 'node:path'; -import { rootUrl, getSearchParams } from './utils'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + +import { getSearchParams, rootUrl } from './utils'; export const route: Route = { path: '/hot', diff --git a/lib/routes/cls/subject.ts b/lib/routes/cls/subject.ts index 858135e449..cd92e10aaa 100644 --- a/lib/routes/cls/subject.ts +++ b/lib/routes/cls/subject.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import { art } from '@/utils/render'; import path from 'node:path'; -import { rootUrl, getSearchParams } from './utils'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + +import { getSearchParams, rootUrl } from './utils'; export const handler = async (ctx) => { const { id = '1103' } = ctx.req.param(); diff --git a/lib/routes/cls/telegraph.ts b/lib/routes/cls/telegraph.ts index ec0c4d09a7..46f034cacb 100644 --- a/lib/routes/cls/telegraph.ts +++ b/lib/routes/cls/telegraph.ts @@ -1,11 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { rootUrl, getSearchParams } from './utils'; +import { getSearchParams, rootUrl } from './utils'; const categories = { watch: '看盘', diff --git a/lib/routes/cls/utils.ts b/lib/routes/cls/utils.ts index 27c7cbac2b..59efa53c00 100644 --- a/lib/routes/cls/utils.ts +++ b/lib/routes/cls/utils.ts @@ -15,4 +15,4 @@ const getSearchParams = (moreParams) => { return searchParams; }; -export { rootUrl, getSearchParams }; +export { getSearchParams, rootUrl }; diff --git a/lib/routes/cma/channel.ts b/lib/routes/cma/channel.ts index dc9a13e5dd..a24f5ea29d 100644 --- a/lib/routes/cma/channel.ts +++ b/lib/routes/cma/channel.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/channel/:id?', diff --git a/lib/routes/cmde/index.ts b/lib/routes/cmde/index.ts index 99e34f4c5c..5a5f567b63 100644 --- a/lib/routes/cmde/index.ts +++ b/lib/routes/cmde/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; +import timezone from '@/utils/timezone'; const rootURL = 'https://www.cmde.org.cn'; diff --git a/lib/routes/cmpxchg8b/articles.ts b/lib/routes/cmpxchg8b/articles.ts index e8330ff3df..63a883b2a3 100644 --- a/lib/routes/cmpxchg8b/articles.ts +++ b/lib/routes/cmpxchg8b/articles.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; const baseUrl = 'https://lock.cmpxchg8b.com/'; const title = 'cmpxchg8b'; diff --git a/lib/routes/cmu/andypavlo/blog.ts b/lib/routes/cmu/andypavlo/blog.ts index c31ed07b2a..bdf87b6a83 100644 --- a/lib/routes/cmu/andypavlo/blog.ts +++ b/lib/routes/cmu/andypavlo/blog.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; async function getArticles() { diff --git a/lib/routes/cn-healthcare/index.ts b/lib/routes/cn-healthcare/index.ts index a624b006d5..df0fef4155 100644 --- a/lib/routes/cn-healthcare/index.ts +++ b/lib/routes/cn-healthcare/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/cna/index.ts b/lib/routes/cna/index.ts index 632032c74f..6145100d6f 100644 --- a/lib/routes/cna/index.ts +++ b/lib/routes/cna/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { getFullText } from './utils'; export const route: Route = { diff --git a/lib/routes/cna/utils.ts b/lib/routes/cna/utils.ts index 77cd2e8649..8df70e51ac 100644 --- a/lib/routes/cna/utils.ts +++ b/lib/routes/cna/utils.ts @@ -1,6 +1,7 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; +import got from '@/utils/got'; + export async function getFullText(item) { const detailResponse = await got({ method: 'get', diff --git a/lib/routes/cna/web/index.ts b/lib/routes/cna/web/index.ts index bf79963bd0..b56bd7921e 100644 --- a/lib/routes/cna/web/index.ts +++ b/lib/routes/cna/web/index.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { getFullText } from '../utils'; export const route: Route = { diff --git a/lib/routes/cnbc/rss.ts b/lib/routes/cnbc/rss.ts index ecc6620f1d..06a3f8dda6 100644 --- a/lib/routes/cnbc/rss.ts +++ b/lib/routes/cnbc/rss.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import parser from '@/utils/rss-parser'; export const route: Route = { diff --git a/lib/routes/cnbeta/category.ts b/lib/routes/cnbeta/category.ts index a873cb0783..f2a9162048 100644 --- a/lib/routes/cnbeta/category.ts +++ b/lib/routes/cnbeta/category.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { handler } from './common'; export const route: Route = { diff --git a/lib/routes/cnbeta/common.ts b/lib/routes/cnbeta/common.ts index 5f4af27818..a96f3a49b5 100644 --- a/lib/routes/cnbeta/common.ts +++ b/lib/routes/cnbeta/common.ts @@ -1,10 +1,11 @@ +import { load } from 'cheerio'; + 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 timezone from '@/utils/timezone'; -import { rootUrl, ProcessItems } from './utils'; +import { ProcessItems, rootUrl } from './utils'; export async function handler(ctx) { const { type, id } = ctx.req.param(); diff --git a/lib/routes/cnbeta/index.ts b/lib/routes/cnbeta/index.ts index 9d7f3012e7..2d1d8d94f0 100644 --- a/lib/routes/cnbeta/index.ts +++ b/lib/routes/cnbeta/index.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { handler } from './common'; export const route: Route = { diff --git a/lib/routes/cnbeta/topics.ts b/lib/routes/cnbeta/topics.ts index 84dc83eaf6..a2d986130d 100644 --- a/lib/routes/cnbeta/topics.ts +++ b/lib/routes/cnbeta/topics.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { handler } from './common'; export const route: Route = { diff --git a/lib/routes/cnbeta/utils.ts b/lib/routes/cnbeta/utils.ts index bdeea03583..a7df94b7de 100644 --- a/lib/routes/cnbeta/utils.ts +++ b/lib/routes/cnbeta/utils.ts @@ -1,7 +1,8 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const rootUrl = 'https://www.cnbeta.com.tw'; @@ -24,4 +25,4 @@ const ProcessItems = (items, limit, tryGet) => ) ); -export { rootUrl, ProcessItems }; +export { ProcessItems, rootUrl }; diff --git a/lib/routes/cnblogs/common.ts b/lib/routes/cnblogs/common.ts index 456c8ad667..c0dfee69ed 100644 --- a/lib/routes/cnblogs/common.ts +++ b/lib/routes/cnblogs/common.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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'; diff --git a/lib/routes/cncf/index.ts b/lib/routes/cncf/index.ts index 3dae0089e4..a4d07888f8 100644 --- a/lib/routes/cncf/index.ts +++ b/lib/routes/cncf/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootURL = 'https://www.cncf.io'; diff --git a/lib/routes/cncf/reports.ts b/lib/routes/cncf/reports.ts index 08fdf72b4e..7e7e2890b9 100644 --- a/lib/routes/cncf/reports.ts +++ b/lib/routes/cncf/reports.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootURL = 'https://www.cncf.io'; diff --git a/lib/routes/cneb/yjxw.ts b/lib/routes/cneb/yjxw.ts index 650ad57b4d..3ec000203d 100644 --- a/lib/routes/cneb/yjxw.ts +++ b/lib/routes/cneb/yjxw.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; const indexs = { gnxw: 0, diff --git a/lib/routes/cneb/yjxx.ts b/lib/routes/cneb/yjxx.ts index da1f585dd7..23ea3ee59f 100644 --- a/lib/routes/cneb/yjxx.ts +++ b/lib/routes/cneb/yjxx.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import { getSubPath } from '@/utils/common-utils'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/yjxx/*', diff --git a/lib/routes/cngal/entry.ts b/lib/routes/cngal/entry.ts index 537900cbc3..4929fd8a88 100644 --- a/lib/routes/cngal/entry.ts +++ b/lib/routes/cngal/entry.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/cngal/weekly.ts b/lib/routes/cngal/weekly.ts index 4f745797cf..f02f5f499f 100644 --- a/lib/routes/cngal/weekly.ts +++ b/lib/routes/cngal/weekly.ts @@ -1,9 +1,10 @@ -import { Route, ViewType } from '@/types'; - -import got from '@/utils/got'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; export const route: Route = { path: '/weekly', diff --git a/lib/routes/cngold/index.ts b/lib/routes/cngold/index.ts index 955fa46e0a..201c66eaa2 100644 --- a/lib/routes/cngold/index.ts +++ b/lib/routes/cngold/index.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const handler = async (ctx) => { diff --git a/lib/routes/cnjxol/index.ts b/lib/routes/cnjxol/index.ts index 453b3bf09c..ba41317fc2 100644 --- a/lib/routes/cnjxol/index.ts +++ b/lib/routes/cnjxol/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const categories = { jxrb: '嘉兴日报', diff --git a/lib/routes/cnki/author.ts b/lib/routes/cnki/author.ts index 94b6d8400f..add89da884 100644 --- a/lib/routes/cnki/author.ts +++ b/lib/routes/cnki/author.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + import { ProcessItem } from './utils'; export const route: Route = { diff --git a/lib/routes/cnki/debut.ts b/lib/routes/cnki/debut.ts index 67ce6192b9..0e5c6a7222 100644 --- a/lib/routes/cnki/debut.ts +++ b/lib/routes/cnki/debut.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const rootUrl = 'https://chn.oversea.cnki.net'; diff --git a/lib/routes/cnki/journals.ts b/lib/routes/cnki/journals.ts index 9e4d7e5ff5..24cd3b80d7 100644 --- a/lib/routes/cnki/journals.ts +++ b/lib/routes/cnki/journals.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import { ProcessItem } from './utils'; -import parser from '@/utils/rss-parser'; import logger from '@/utils/logger'; +import { parseDate } from '@/utils/parse-date'; +import parser from '@/utils/rss-parser'; + +import { ProcessItem } from './utils'; const rootUrl = 'https://navi.cnki.net'; diff --git a/lib/routes/cnki/utils.ts b/lib/routes/cnki/utils.ts index a4676fb26e..1f55c34e45 100644 --- a/lib/routes/cnki/utils.ts +++ b/lib/routes/cnki/utils.ts @@ -1,8 +1,10 @@ -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import got from '@/utils/got'; +import { art } from '@/utils/render'; + const ProcessItem = async (item) => { const detailResponse = await got(item.link); const $ = load(detailResponse.data); diff --git a/lib/routes/cnljxh/index.ts b/lib/routes/cnljxh/index.ts index 7fd6d49237..9f27bfdd5c 100644 --- a/lib/routes/cnljxh/index.ts +++ b/lib/routes/cnljxh/index.ts @@ -1,13 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const { category = 'news', id = '10' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '20', 10); diff --git a/lib/routes/cntheory/paper.ts b/lib/routes/cntheory/paper.ts index b545950f7a..159a4b3242 100644 --- a/lib/routes/cntheory/paper.ts +++ b/lib/routes/cntheory/paper.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/paper/:id?', diff --git a/lib/routes/cntv/column.ts b/lib/routes/cntv/column.ts index 0b1dce06a9..c73c894200 100644 --- a/lib/routes/cntv/column.ts +++ b/lib/routes/cntv/column.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; export const route: Route = { path: '/:column', diff --git a/lib/routes/cnu/iec.ts b/lib/routes/cnu/iec.ts index cc584863fc..21fc4eb760 100644 --- a/lib/routes/cnu/iec.ts +++ b/lib/routes/cnu/iec.ts @@ -1,7 +1,8 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { Route } from '@/types'; export const route: Route = { path: '/iec', diff --git a/lib/routes/cnu/jdxw.ts b/lib/routes/cnu/jdxw.ts index 2179592e2e..c2ecd618b4 100644 --- a/lib/routes/cnu/jdxw.ts +++ b/lib/routes/cnu/jdxw.ts @@ -1,7 +1,8 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { Route } from '@/types'; export const route: Route = { path: '/jdxw', diff --git a/lib/routes/cnu/jwc.ts b/lib/routes/cnu/jwc.ts index 99fa0f5a9b..c18fe69a1f 100644 --- a/lib/routes/cnu/jwc.ts +++ b/lib/routes/cnu/jwc.ts @@ -1,7 +1,8 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { Route } from '@/types'; export const route: Route = { path: '/jwc', diff --git a/lib/routes/cnu/physics.ts b/lib/routes/cnu/physics.ts index 48b5519e57..1c6b575158 100644 --- a/lib/routes/cnu/physics.ts +++ b/lib/routes/cnu/physics.ts @@ -1,7 +1,8 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { Route } from '@/types'; export const route: Route = { path: '/physics', diff --git a/lib/routes/cnu/smkxxy.ts b/lib/routes/cnu/smkxxy.ts index afbfe7d7bb..ea14a82c17 100644 --- a/lib/routes/cnu/smkxxy.ts +++ b/lib/routes/cnu/smkxxy.ts @@ -1,7 +1,8 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { Route } from '@/types'; export const route: Route = { path: '/smkxxy', diff --git a/lib/routes/cockroachlabs/blog.ts b/lib/routes/cockroachlabs/blog.ts index cc28c09b4a..a5ef5cc239 100644 --- a/lib/routes/cockroachlabs/blog.ts +++ b/lib/routes/cockroachlabs/blog.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/codeforces/contests.ts b/lib/routes/codeforces/contests.ts index cabbd8e7dd..dd16d8c45a 100644 --- a/lib/routes/codeforces/contests.ts +++ b/lib/routes/codeforces/contests.ts @@ -1,14 +1,15 @@ -import { Route } from '@/types'; +import 'dayjs/locale/zh-cn.js'; -import ofetch from '@/utils/ofetch'; import path from 'node:path'; -import { art } from '@/utils/render'; import dayjs from 'dayjs'; -import localizedFormat from 'dayjs/plugin/localizedFormat.js'; import duration from 'dayjs/plugin/duration.js'; +import localizedFormat from 'dayjs/plugin/localizedFormat.js'; import relativeTime from 'dayjs/plugin/relativeTime.js'; -import 'dayjs/locale/zh-cn.js'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { art } from '@/utils/render'; dayjs.extend(localizedFormat); dayjs.extend(duration); diff --git a/lib/routes/codeforces/recent-actions.ts b/lib/routes/codeforces/recent-actions.ts index 2baaf8c823..8673504291 100644 --- a/lib/routes/codeforces/recent-actions.ts +++ b/lib/routes/codeforces/recent-actions.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + export const route: Route = { path: '/recent-actions/:minrating?', categories: ['programming'], diff --git a/lib/routes/cognition/blog.ts b/lib/routes/cognition/blog.ts index ae87cb6737..8a1d34b729 100644 --- a/lib/routes/cognition/blog.ts +++ b/lib/routes/cognition/blog.ts @@ -1,7 +1,8 @@ +import { load } from 'cheerio'; + import { type Data, type DataItem, type Route, ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; export const route: Route = { path: '/blog', diff --git a/lib/routes/cohere/index.ts b/lib/routes/cohere/index.ts index 1e7cc83f81..b0c52eef3d 100644 --- a/lib/routes/cohere/index.ts +++ b/lib/routes/cohere/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/coindesk/consensus-magazine.ts b/lib/routes/coindesk/consensus-magazine.ts index 3ae06e973c..dec30fb54c 100644 --- a/lib/routes/coindesk/consensus-magazine.ts +++ b/lib/routes/coindesk/consensus-magazine.ts @@ -1,8 +1,11 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + import { parseItem } from './utils'; + const rootUrl = 'https://www.coindesk.com'; export const route: Route = { diff --git a/lib/routes/coindesk/news.ts b/lib/routes/coindesk/news.ts index 42adf1da81..c0d8236131 100644 --- a/lib/routes/coindesk/news.ts +++ b/lib/routes/coindesk/news.ts @@ -1,6 +1,7 @@ -import { Route, Data, DataItem } from '@/types'; +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import parser from '@/utils/rss-parser'; + import { parseItem } from './utils'; export const route: Route = { diff --git a/lib/routes/coindesk/utils.ts b/lib/routes/coindesk/utils.ts index d43d91f8ef..a8ed6705a4 100644 --- a/lib/routes/coindesk/utils.ts +++ b/lib/routes/coindesk/utils.ts @@ -1,5 +1,6 @@ -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const parseItem = async (item) => { diff --git a/lib/routes/cointelegraph/index.ts b/lib/routes/cointelegraph/index.ts index a1fe1db5e7..e984e6d7f6 100644 --- a/lib/routes/cointelegraph/index.ts +++ b/lib/routes/cointelegraph/index.ts @@ -1,9 +1,10 @@ -import { Route, Data, DataItem } from '@/types'; +import { load } from 'cheerio'; + +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import logger from '@/utils/logger'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; -import logger from '@/utils/logger'; import parser from '@/utils/rss-parser'; export const route: Route = { diff --git a/lib/routes/colamanga/manga.ts b/lib/routes/colamanga/manga.ts index be2b600b10..e5d0acb013 100644 --- a/lib/routes/colamanga/manga.ts +++ b/lib/routes/colamanga/manga.ts @@ -1,11 +1,11 @@ -import { Route } from '@/types'; -import puppeteer from '@/utils/puppeteer'; - import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; -import { Context } from 'hono'; +import type { Context } from 'hono'; + +import type { Route } from '@/types'; import logger from '@/utils/logger'; +import { parseDate } from '@/utils/parse-date'; +import puppeteer from '@/utils/puppeteer'; +import timezone from '@/utils/timezone'; const domain = 'www.colamanga.com'; diff --git a/lib/routes/collabo-cafe/category.ts b/lib/routes/collabo-cafe/category.ts index 844de43fcf..299c32b475 100644 --- a/lib/routes/collabo-cafe/category.ts +++ b/lib/routes/collabo-cafe/category.ts @@ -1,7 +1,9 @@ -import { Data, Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { Context } from 'hono'; +import type { Context } from 'hono'; + +import type { Data, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + import { parseItems } from './parser'; export const handler = async (ctx: Context): Promise => { diff --git a/lib/routes/collabo-cafe/index.ts b/lib/routes/collabo-cafe/index.ts index bb511df127..46a4f30985 100644 --- a/lib/routes/collabo-cafe/index.ts +++ b/lib/routes/collabo-cafe/index.ts @@ -1,6 +1,8 @@ -import { Data, Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Data, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + import { parseItems } from './parser'; export const handler = async (): Promise => { diff --git a/lib/routes/collabo-cafe/parser.ts b/lib/routes/collabo-cafe/parser.ts index e7f894d69c..8ef2f0cfe4 100644 --- a/lib/routes/collabo-cafe/parser.ts +++ b/lib/routes/collabo-cafe/parser.ts @@ -1,6 +1,7 @@ +import type { CheerioAPI } from 'cheerio'; + import { type DataItem } from '@/types'; import { parseDate } from '@/utils/parse-date'; -import { CheerioAPI } from 'cheerio'; export function parseItems($: CheerioAPI): DataItem[] { return $('div.top-post-list article') diff --git a/lib/routes/collabo-cafe/tag.ts b/lib/routes/collabo-cafe/tag.ts index a47b6bc56a..f74969e724 100644 --- a/lib/routes/collabo-cafe/tag.ts +++ b/lib/routes/collabo-cafe/tag.ts @@ -1,7 +1,9 @@ -import { Data, Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { Context } from 'hono'; +import type { Context } from 'hono'; + +import type { Data, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + import { parseItems } from './parser'; export const handler = async (ctx: Context): Promise => { diff --git a/lib/routes/comicat/search.ts b/lib/routes/comicat/search.ts index 4e3716756f..46d191f7aa 100644 --- a/lib/routes/comicat/search.ts +++ b/lib/routes/comicat/search.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://comicat.org'; diff --git a/lib/routes/comicskingdom/index.ts b/lib/routes/comicskingdom/index.ts index 3b18872da2..661e148900 100644 --- a/lib/routes/comicskingdom/index.ts +++ b/lib/routes/comicskingdom/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; export const route: Route = { path: '/:name', diff --git a/lib/routes/commonhealth/index.ts b/lib/routes/commonhealth/index.ts index 6e0b1116ea..297c09242d 100644 --- a/lib/routes/commonhealth/index.ts +++ b/lib/routes/commonhealth/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const apiKey = 'Cah2snYi52eJjpshbIfof1Tpx8ZhzXqh'; diff --git a/lib/routes/consumer/index.ts b/lib/routes/consumer/index.ts index 83b0e249e5..404cbc683e 100644 --- a/lib/routes/consumer/index.ts +++ b/lib/routes/consumer/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/consumer/shopping-guide.ts b/lib/routes/consumer/shopping-guide.ts index f0fc9b221f..976aac5673 100644 --- a/lib/routes/consumer/shopping-guide.ts +++ b/lib/routes/consumer/shopping-guide.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/cool18/index.ts b/lib/routes/cool18/index.ts index 6957c5ee2a..6f8007a8a3 100644 --- a/lib/routes/cool18/index.ts +++ b/lib/routes/cool18/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; import type { Context } from 'hono'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; type PageDataItem = { tid: string; diff --git a/lib/routes/coolapk/dyh.ts b/lib/routes/coolapk/dyh.ts index 4bc6e7d323..a998c093f9 100644 --- a/lib/routes/coolapk/dyh.ts +++ b/lib/routes/coolapk/dyh.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import utils from './utils'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import utils from './utils'; export const route: Route = { path: '/dyh/:dyhId', diff --git a/lib/routes/coolapk/hot.ts b/lib/routes/coolapk/hot.ts index 2bfeec1e35..13b21508ea 100644 --- a/lib/routes/coolapk/hot.ts +++ b/lib/routes/coolapk/hot.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import utils from './utils'; + const getLinkAndTitle = (type, period) => { const baseURL = 'https://api.coolapk.com/v6/page/dataList?url='; let link; diff --git a/lib/routes/coolapk/huati.ts b/lib/routes/coolapk/huati.ts index 67dc7d951c..5a21aeb3a1 100644 --- a/lib/routes/coolapk/huati.ts +++ b/lib/routes/coolapk/huati.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import utils from './utils'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import utils from './utils'; export const route: Route = { path: '/huati/:tag', diff --git a/lib/routes/coolapk/toutiao.ts b/lib/routes/coolapk/toutiao.ts index bd163a8808..1740501080 100644 --- a/lib/routes/coolapk/toutiao.ts +++ b/lib/routes/coolapk/toutiao.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/coolapk/tuwen.ts b/lib/routes/coolapk/tuwen.ts index 9c9d699cf7..4b5b7130c9 100644 --- a/lib/routes/coolapk/tuwen.ts +++ b/lib/routes/coolapk/tuwen.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/coolapk/user-dynamic.ts b/lib/routes/coolapk/user-dynamic.ts index a23425839d..736f1fef5b 100644 --- a/lib/routes/coolapk/user-dynamic.ts +++ b/lib/routes/coolapk/user-dynamic.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import utils from './utils'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import utils from './utils'; export const route: Route = { path: '/user/:uid/dynamic', diff --git a/lib/routes/coolapk/utils.ts b/lib/routes/coolapk/utils.ts index ec29fe2e5b..607ce5f77c 100644 --- a/lib/routes/coolapk/utils.ts +++ b/lib/routes/coolapk/utils.ts @@ -1,7 +1,8 @@ -import cache from '@/utils/cache'; -import md5 from '@/utils/md5'; import { load } from 'cheerio'; + +import cache from '@/utils/cache'; import got from '@/utils/got'; +import md5 from '@/utils/md5'; import { parseDate } from '@/utils/parse-date'; const dynamicTpye = { 0: '基本动态', 8: '酷图', 9: '评论', 10: '提问', 11: '回答', 12: '图文', 15: '二手', 17: '观点', 20: '交易动态' }; diff --git a/lib/routes/coolbuy/index.ts b/lib/routes/coolbuy/index.ts index c999fb3c4f..f092729a93 100644 --- a/lib/routes/coolbuy/index.ts +++ b/lib/routes/coolbuy/index.ts @@ -1,11 +1,11 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import { art } from '@/utils/render'; -import ofetch from '@/utils/ofetch'; +import path from 'node:path'; import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; -import path from 'node:path'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '50', 10); diff --git a/lib/routes/coolidge/film-guide.ts b/lib/routes/coolidge/film-guide.ts index a14c68f865..0c8b3d7ceb 100644 --- a/lib/routes/coolidge/film-guide.ts +++ b/lib/routes/coolidge/film-guide.ts @@ -1,8 +1,10 @@ +import path from 'node:path'; + +import { load } from 'cheerio'; + import { type Route } from '@/types'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { art } from '@/utils/render'; -import path from 'node:path'; const handler = async () => { const link = 'https://coolidge.org/film-guide'; diff --git a/lib/routes/coolidge/news.ts b/lib/routes/coolidge/news.ts index 52508736a8..8f4c1f2211 100644 --- a/lib/routes/coolidge/news.ts +++ b/lib/routes/coolidge/news.ts @@ -1,8 +1,10 @@ +import path from 'node:path'; + +import { load } from 'cheerio'; + import { type Route } from '@/types'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { art } from '@/utils/render'; -import path from 'node:path'; const handler = async () => { const link = 'https://coolidge.org/about-us/news-media'; diff --git a/lib/routes/coolpc/news.ts b/lib/routes/coolpc/news.ts index 3f6383d96f..cfe0dc8704 100644 --- a/lib/routes/coolpc/news.ts +++ b/lib/routes/coolpc/news.ts @@ -1,6 +1,7 @@ -import { DataItem, Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/coomer/index.ts b/lib/routes/coomer/index.ts index e7e8364184..48b8757bbe 100644 --- a/lib/routes/coomer/index.ts +++ b/lib/routes/coomer/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const headers = { Accept: 'text/css' }; diff --git a/lib/routes/copymanga/comic.ts b/lib/routes/copymanga/comic.ts index 3807794e80..29791ccc30 100644 --- a/lib/routes/copymanga/comic.ts +++ b/lib/routes/copymanga/comic.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; +import pMap from 'p-map'; + +import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { config } from '@/config'; -import pMap from 'p-map'; export const route: Route = { path: '/comic/:id/:chapterCnt?', diff --git a/lib/routes/cosplaytele/article.ts b/lib/routes/cosplaytele/article.ts index 00db9197e4..2089557dc3 100644 --- a/lib/routes/cosplaytele/article.ts +++ b/lib/routes/cosplaytele/article.ts @@ -1,4 +1,5 @@ import { load } from 'cheerio'; + import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/cosplaytele/category.ts b/lib/routes/cosplaytele/category.ts index e29adff158..0111e614c8 100644 --- a/lib/routes/cosplaytele/category.ts +++ b/lib/routes/cosplaytele/category.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + import loadArticle from './article'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; export const route: Route = { path: '/category/:category', diff --git a/lib/routes/cosplaytele/latest.ts b/lib/routes/cosplaytele/latest.ts index d50a194d4f..50ccbb11a7 100644 --- a/lib/routes/cosplaytele/latest.ts +++ b/lib/routes/cosplaytele/latest.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + import loadArticle from './article'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; export const route: Route = { path: '/', diff --git a/lib/routes/cosplaytele/popular.ts b/lib/routes/cosplaytele/popular.ts index 16e6296ddf..82b9333bf4 100644 --- a/lib/routes/cosplaytele/popular.ts +++ b/lib/routes/cosplaytele/popular.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + import loadArticle from './article'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; export const route: Route = { path: '/popular/:period', diff --git a/lib/routes/cosplaytele/tag.ts b/lib/routes/cosplaytele/tag.ts index 9a9a799c9d..db3639c032 100644 --- a/lib/routes/cosplaytele/tag.ts +++ b/lib/routes/cosplaytele/tag.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + import loadArticle from './article'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; export const route: Route = { path: '/tag/:tag', diff --git a/lib/routes/counter-strike/news.ts b/lib/routes/counter-strike/news.ts index 688ef33034..f82187934c 100644 --- a/lib/routes/counter-strike/news.ts +++ b/lib/routes/counter-strike/news.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; -import type { BBobCoreTagNodeTree, PresetFactory } from '@bbob/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; import bbobHTML from '@bbob/html'; import presetHTML5 from '@bbob/preset-html5'; +import type { BBobCoreTagNodeTree, PresetFactory } from '@bbob/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const swapLinebreak = (tree: BBobCoreTagNodeTree) => diff --git a/lib/routes/cpcaauto/index.ts b/lib/routes/cpcaauto/index.ts index c55f5e7328..e359184f2b 100644 --- a/lib/routes/cpcaauto/index.ts +++ b/lib/routes/cpcaauto/index.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { type = 'news', id } = ctx.req.param(); diff --git a/lib/routes/cpcey/index.ts b/lib/routes/cpcey/index.ts index 14570381f1..631c548743 100644 --- a/lib/routes/cpcey/index.ts +++ b/lib/routes/cpcey/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootUrl = 'https://cpc.ey.gov.tw'; diff --git a/lib/routes/cpta/handler.ts b/lib/routes/cpta/handler.ts index 605349447e..8c4e753c9b 100644 --- a/lib/routes/cpta/handler.ts +++ b/lib/routes/cpta/handler.ts @@ -1,9 +1,10 @@ -import { DataItem, Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import pMap from 'p-map'; +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + type NewsCategory = { title: string; baseUrl: string; diff --git a/lib/routes/cpuid/news.ts b/lib/routes/cpuid/news.ts index ed815da006..08c2cee9b4 100644 --- a/lib/routes/cpuid/news.ts +++ b/lib/routes/cpuid/news.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + const newsUrl = 'https://www.cpuid.com/news.html'; export const route: Route = { diff --git a/lib/routes/cqgas/tqtz.ts b/lib/routes/cqgas/tqtz.ts index 281690acc3..16cffb4d5b 100644 --- a/lib/routes/cqgas/tqtz.ts +++ b/lib/routes/cqgas/tqtz.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const url = 'http://www.cqgas.cn/portal/article/page?cateId=1082&pageNo=1'; export const route: Route = { path: '/tqtz', diff --git a/lib/routes/cqu/index.ts b/lib/routes/cqu/index.ts index c28ae10d29..e2147ad459 100644 --- a/lib/routes/cqu/index.ts +++ b/lib/routes/cqu/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/jwc/:path{.+}?', diff --git a/lib/routes/cqwu/index.ts b/lib/routes/cqwu/index.ts index 9b1123fb15..737e6a1852 100644 --- a/lib/routes/cqwu/index.ts +++ b/lib/routes/cqwu/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/crac/exam.ts b/lib/routes/crac/exam.ts index 3e575f4df6..4d20e718cd 100644 --- a/lib/routes/crac/exam.ts +++ b/lib/routes/crac/exam.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import path from 'node:path'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { art } from '@/utils/render'; export const route: Route = { diff --git a/lib/routes/crac/index.ts b/lib/routes/crac/index.ts index 41e61cfdee..8105b17c4a 100644 --- a/lib/routes/crac/index.ts +++ b/lib/routes/crac/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; export const route: Route = { path: '/:type?', diff --git a/lib/routes/creative-comic/book.ts b/lib/routes/creative-comic/book.ts index ade9fa7b36..b030144654 100644 --- a/lib/routes/creative-comic/book.ts +++ b/lib/routes/creative-comic/book.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { getUuid, getBook, getChapter, getChapters, getImgEncrypted, getImgKey, decrypt, getRealKey, apiHost } from './utils'; + +import { apiHost, decrypt, getBook, getChapter, getChapters, getImgEncrypted, getImgKey, getRealKey, getUuid } from './utils'; export const route: Route = { path: '/book/:id/:coverOnly?/:quality?', diff --git a/lib/routes/creative-comic/utils.ts b/lib/routes/creative-comic/utils.ts index a68723b5df..115136b890 100644 --- a/lib/routes/creative-comic/utils.ts +++ b/lib/routes/creative-comic/utils.ts @@ -1,6 +1,7 @@ -import got from '@/utils/got'; import CryptoJS from 'crypto-js'; +import got from '@/utils/got'; + const apiHost = 'https://api.creative-comic.tw'; const device = 'web_desktop'; const DEFAULT_TOKEN = 'freeforccc2020reading'; @@ -82,4 +83,4 @@ const getRealKey = (imgKey, token = DEFAULT_TOKEN) => { }; }; -export { apiHost, getBook, getChapter, getChapters, getImgEncrypted, getImgKey, getUuid, decrypt, token2Key, getRealKey }; +export { apiHost, decrypt, getBook, getChapter, getChapters, getImgEncrypted, getImgKey, getRealKey, getUuid, token2Key }; diff --git a/lib/routes/crossbell/feeds/following.ts b/lib/routes/crossbell/feeds/following.ts index b58028df93..96085286a4 100644 --- a/lib/routes/crossbell/feeds/following.ts +++ b/lib/routes/crossbell/feeds/following.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/crossbell/notes/character.ts b/lib/routes/crossbell/notes/character.ts index c9075b4050..57e376e459 100644 --- a/lib/routes/crossbell/notes/character.ts +++ b/lib/routes/crossbell/notes/character.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import { getItem } from './utils'; export const route: Route = { diff --git a/lib/routes/crossbell/notes/index.ts b/lib/routes/crossbell/notes/index.ts index f59ae30631..a2ba1d4fe9 100644 --- a/lib/routes/crossbell/notes/index.ts +++ b/lib/routes/crossbell/notes/index.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import { getItem } from './utils'; export const route: Route = { diff --git a/lib/routes/crossbell/notes/source.ts b/lib/routes/crossbell/notes/source.ts index 31a20e614d..16fe50cdb6 100644 --- a/lib/routes/crossbell/notes/source.ts +++ b/lib/routes/crossbell/notes/source.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import { getItem } from './utils'; export const route: Route = { diff --git a/lib/routes/crush/index.ts b/lib/routes/crush/index.ts index a6bb6de3e2..5656c1c1f1 100644 --- a/lib/routes/crush/index.ts +++ b/lib/routes/crush/index.ts @@ -1,9 +1,10 @@ -import { type Data, type DataItem, type Route } from '@/types'; import { type CheerioAPI, load } from 'cheerio'; + +import { type Data, type DataItem, type Route } from '@/types'; +import md5 from '@/utils/md5'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import md5 from '@/utils/md5'; const baseUrl = 'https://www.crush.ninja'; diff --git a/lib/routes/cryptoslate/index.ts b/lib/routes/cryptoslate/index.ts index 978411c335..abebfd6e0c 100644 --- a/lib/routes/cryptoslate/index.ts +++ b/lib/routes/cryptoslate/index.ts @@ -1,9 +1,10 @@ -import { Route, Data } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import logger from '@/utils/logger'; -import parser from '@/utils/rss-parser'; import { load } from 'cheerio'; +import type { Data, Route } from '@/types'; +import logger from '@/utils/logger'; +import { parseDate } from '@/utils/parse-date'; +import parser from '@/utils/rss-parser'; + export const route: Route = { path: '/', categories: ['finance'], diff --git a/lib/routes/cs/index.ts b/lib/routes/cs/index.ts index bcde4c99b1..4d28d01810 100644 --- a/lib/routes/cs/index.ts +++ b/lib/routes/cs/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const decodeBufferByCharset = (buffer) => { const isGBK = /charset="?'?gb/i.test(buffer.toString()); diff --git a/lib/routes/cs/video.ts b/lib/routes/cs/video.ts index 090f665610..9669cd574d 100644 --- a/lib/routes/cs/video.ts +++ b/lib/routes/cs/video.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/video/:category?', diff --git a/lib/routes/cs/zzkx.ts b/lib/routes/cs/zzkx.ts index 783ce264b5..9faf0397e6 100644 --- a/lib/routes/cs/zzkx.ts +++ b/lib/routes/cs/zzkx.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + export const route: Route = { path: ['/news/zzkx', '/zzkx'], name: 'Unknown', diff --git a/lib/routes/csdn/blog.ts b/lib/routes/csdn/blog.ts index 3f5fd52cc7..648a3b2123 100644 --- a/lib/routes/csdn/blog.ts +++ b/lib/routes/csdn/blog.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import rssParser from '@/utils/rss-parser'; export const route: Route = { diff --git a/lib/routes/css-tricks/articles.ts b/lib/routes/css-tricks/articles.ts index fc8170a1e3..4a2f12ce7d 100644 --- a/lib/routes/css-tricks/articles.ts +++ b/lib/routes/css-tricks/articles.ts @@ -1,7 +1,11 @@ -import { Data, Route, ViewType } from '@/types'; import { load } from 'cheerio'; + +import type { Data, Route} from '@/types'; +import { ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; + import { processWithWp } from './utils'; + export const route: Route = { path: '/articles', view: ViewType.Articles, diff --git a/lib/routes/css-tricks/collections.ts b/lib/routes/css-tricks/collections.ts index 592b7d289d..2fd4144691 100644 --- a/lib/routes/css-tricks/collections.ts +++ b/lib/routes/css-tricks/collections.ts @@ -1,5 +1,8 @@ -import { Data, Route, ViewType } from '@/types'; +import type { Data, Route} from '@/types'; +import { ViewType } from '@/types'; + import { extractMiniCards, processWithWp, rootUrl } from './utils'; + export const route: Route = { path: '/collections/:type', view: ViewType.Articles, diff --git a/lib/routes/css-tricks/popular.ts b/lib/routes/css-tricks/popular.ts index 83cdd35ab5..0d05dc3e1f 100644 --- a/lib/routes/css-tricks/popular.ts +++ b/lib/routes/css-tricks/popular.ts @@ -1,5 +1,8 @@ -import { Data, Route, ViewType } from '@/types'; +import type { Data, Route} from '@/types'; +import { ViewType } from '@/types'; + import { extractMiniCards, processWithWp, rootUrl } from './utils'; + export const route: Route = { path: '/popular', view: ViewType.Articles, diff --git a/lib/routes/css-tricks/utils.ts b/lib/routes/css-tricks/utils.ts index e5e7802710..637e2ba06b 100644 --- a/lib/routes/css-tricks/utils.ts +++ b/lib/routes/css-tricks/utils.ts @@ -1,6 +1,7 @@ import { load } from 'cheerio'; + +import type { DataItem } from '@/types'; import ofetch from '@/utils/ofetch'; -import { DataItem } from '@/types'; import { parseDate } from '@/utils/parse-date'; export const rootUrl = 'https://css-tricks.com'; diff --git a/lib/routes/cssn/iolaw.ts b/lib/routes/cssn/iolaw.ts index f0a48813c5..46e280be2b 100644 --- a/lib/routes/cssn/iolaw.ts +++ b/lib/routes/cssn/iolaw.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/cste/index.ts b/lib/routes/cste/index.ts index 2ba81cbb23..69b2929033 100644 --- a/lib/routes/cste/index.ts +++ b/lib/routes/cste/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/csu/career.ts b/lib/routes/csu/career.ts index 2157d2dd49..2ee08d4d42 100644 --- a/lib/routes/csu/career.ts +++ b/lib/routes/csu/career.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { unzip } from './utils'; export const route: Route = { diff --git a/lib/routes/csu/cse.ts b/lib/routes/csu/cse.ts index 2eb8397393..b8b8662d2c 100644 --- a/lib/routes/csu/cse.ts +++ b/lib/routes/csu/cse.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; async function fetch(address) { diff --git a/lib/routes/csu/mail.ts b/lib/routes/csu/mail.ts index 0beb31e329..46bda33d53 100644 --- a/lib/routes/csu/mail.ts +++ b/lib/routes/csu/mail.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/csust/tggs.ts b/lib/routes/csust/tggs.ts index eeea3d77df..38d44b98a6 100644 --- a/lib/routes/csust/tggs.ts +++ b/lib/routes/csust/tggs.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { createCsustHandler } from './utils'; const handler = createCsustHandler({ diff --git a/lib/routes/csust/utils.ts b/lib/routes/csust/utils.ts index 7c19453bb8..d373d8ed6e 100644 --- a/lib/routes/csust/utils.ts +++ b/lib/routes/csust/utils.ts @@ -1,6 +1,7 @@ -import got from '@/utils/got'; -import { load, type CheerioAPI } from 'cheerio'; +import { type CheerioAPI, load } from 'cheerio'; + import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; // 抓取并清清理内容 diff --git a/lib/routes/csust/xkxs.ts b/lib/routes/csust/xkxs.ts index bc97111ad7..fa641b293b 100644 --- a/lib/routes/csust/xkxs.ts +++ b/lib/routes/csust/xkxs.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { createCsustHandler } from './utils'; const handler = createCsustHandler({ diff --git a/lib/routes/ctbu/xxgg.ts b/lib/routes/ctbu/xxgg.ts index c651f29eed..c67fdae618 100644 --- a/lib/routes/ctbu/xxgg.ts +++ b/lib/routes/ctbu/xxgg.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + const baseURL = 'https://www.ctbu.edu.cn/index/xxgg.htm'; export const route: Route = { diff --git a/lib/routes/ctinews/topic.ts b/lib/routes/ctinews/topic.ts index 6eefb5336d..90536389f8 100644 --- a/lib/routes/ctinews/topic.ts +++ b/lib/routes/ctinews/topic.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/cts/news.ts b/lib/routes/cts/news.ts index 2e9c46511e..ce35dba652 100644 --- a/lib/routes/cts/news.ts +++ b/lib/routes/cts/news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import pMap from 'p-map'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import pMap from 'p-map'; export const route: Route = { path: '/:category', diff --git a/lib/routes/cuc/yz.ts b/lib/routes/cuc/yz.ts index eec7f8c93b..3e45816a32 100644 --- a/lib/routes/cuc/yz.ts +++ b/lib/routes/cuc/yz.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; /* 研究生招生网通知公告*/ diff --git a/lib/routes/cuilingmag/index.ts b/lib/routes/cuilingmag/index.ts index 986df7f894..ba719c741c 100644 --- a/lib/routes/cuilingmag/index.ts +++ b/lib/routes/cuilingmag/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const handler = async (ctx) => { const { category } = ctx.req.param(); diff --git a/lib/routes/cupl/jwc.ts b/lib/routes/cupl/jwc.ts index 45dc33cb97..6250b0b485 100644 --- a/lib/routes/cupl/jwc.ts +++ b/lib/routes/cupl/jwc.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; // import cache from '@/utils/cache'; export const route: Route = { diff --git a/lib/routes/curiouscat/user.ts b/lib/routes/curiouscat/user.ts index 9a372b3930..36972528f5 100644 --- a/lib/routes/curiouscat/user.ts +++ b/lib/routes/curiouscat/user.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; const fetchAPIByUser = async (user) => { diff --git a/lib/routes/curius/links.ts b/lib/routes/curius/links.ts index e491b4ce38..fec1d3f48c 100644 --- a/lib/routes/curius/links.ts +++ b/lib/routes/curius/links.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/links/:name', diff --git a/lib/routes/cursor/blog.ts b/lib/routes/cursor/blog.ts index 844fc44bd2..0175ee7cf4 100644 --- a/lib/routes/cursor/blog.ts +++ b/lib/routes/cursor/blog.ts @@ -1,8 +1,9 @@ +import { load } from 'cheerio'; +import { type Context } from 'hono'; + import { type Data, type Route, ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { type Context } from 'hono'; export const handler = async (ctx: Context): Promise => { const { topic } = ctx.req.param(); diff --git a/lib/routes/cursor/changelog.ts b/lib/routes/cursor/changelog.ts index bd196616f9..6fea01bc4b 100644 --- a/lib/routes/cursor/changelog.ts +++ b/lib/routes/cursor/changelog.ts @@ -1,12 +1,11 @@ -import { type Data, type DataItem, type Route, ViewType, type Language } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Language, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '100', 10); diff --git a/lib/routes/cw/author.ts b/lib/routes/cw/author.ts index d24a1777fd..8b9cfa23d6 100644 --- a/lib/routes/cw/author.ts +++ b/lib/routes/cw/author.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import { baseUrl, parsePage } from './utils'; +import type { Route } from '@/types'; import puppeteer from '@/utils/puppeteer'; +import { baseUrl, parsePage } from './utils'; + export const route: Route = { path: '/author/:channel', categories: ['traditional-media'], diff --git a/lib/routes/cw/master.ts b/lib/routes/cw/master.ts index aa34fb7b45..e354e49a70 100644 --- a/lib/routes/cw/master.ts +++ b/lib/routes/cw/master.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import { baseUrl, parsePage } from './utils'; +import type { Route } from '@/types'; import puppeteer from '@/utils/puppeteer'; +import { baseUrl, parsePage } from './utils'; + export const route: Route = { path: '/master/:channel', categories: ['traditional-media'], diff --git a/lib/routes/cw/sub.ts b/lib/routes/cw/sub.ts index 6ddd424348..3ea82a68be 100644 --- a/lib/routes/cw/sub.ts +++ b/lib/routes/cw/sub.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import { baseUrl, parsePage } from './utils'; +import type { Route } from '@/types'; import puppeteer from '@/utils/puppeteer'; +import { baseUrl, parsePage } from './utils'; + export const route: Route = { path: '/sub/:channel', categories: ['traditional-media'], diff --git a/lib/routes/cw/today.ts b/lib/routes/cw/today.ts index f4cd8e1fb9..118fc237c5 100644 --- a/lib/routes/cw/today.ts +++ b/lib/routes/cw/today.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import { baseUrl, parsePage } from './utils'; +import type { Route } from '@/types'; import puppeteer from '@/utils/puppeteer'; +import { baseUrl, parsePage } from './utils'; + export const route: Route = { path: '/today', categories: ['traditional-media'], diff --git a/lib/routes/cw/utils.ts b/lib/routes/cw/utils.ts index 2ca5b2cb30..2093f3322d 100644 --- a/lib/routes/cw/utils.ts +++ b/lib/routes/cw/utils.ts @@ -1,10 +1,12 @@ -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import cache from '@/utils/cache'; +import logger from '@/utils/logger'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { getCookies, setCookies } from '@/utils/puppeteer-utils'; -import logger from '@/utils/logger'; + let cookie; -import ofetch from '@/utils/ofetch'; const baseUrl = 'https://www.cw.com.tw'; @@ -118,6 +120,6 @@ const parseItems = (list, browser, tryGet) => ) ); -export { baseUrl, pathMap, getCookie, parsePage, parseList, parseItems }; +export { baseUrl, getCookie, parseItems, parseList, parsePage, pathMap }; export { setCookies } from '@/utils/puppeteer-utils'; diff --git a/lib/routes/cybersecurityventures/news.ts b/lib/routes/cybersecurityventures/news.ts index 5eeaaed9bb..b4f258c305 100644 --- a/lib/routes/cybersecurityventures/news.ts +++ b/lib/routes/cybersecurityventures/news.ts @@ -1,9 +1,11 @@ +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; import { type Data, type DataItem, type Route, ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; -import type { Context } from 'hono'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; + import type { RawRecord } from './types'; const categories: Record< diff --git a/lib/routes/cyzone/author.ts b/lib/routes/cyzone/author.ts index 1c75e31bfd..995f3c128f 100644 --- a/lib/routes/cyzone/author.ts +++ b/lib/routes/cyzone/author.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { rootUrl, apiRootUrl, processItems, getInfo } from './util'; + +import { apiRootUrl, getInfo, processItems, rootUrl } from './util'; export const route: Route = { path: '/author/:id', diff --git a/lib/routes/cyzone/index.ts b/lib/routes/cyzone/index.ts index 92683285ae..5cde9e9751 100644 --- a/lib/routes/cyzone/index.ts +++ b/lib/routes/cyzone/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { rootUrl, apiRootUrl, processItems, getInfo } from './util'; + +import { apiRootUrl, getInfo, processItems, rootUrl } from './util'; export const route: Route = { path: ['/channel/:id?', '/:id?'], diff --git a/lib/routes/cyzone/label.ts b/lib/routes/cyzone/label.ts index 9defe810e8..47f4541205 100644 --- a/lib/routes/cyzone/label.ts +++ b/lib/routes/cyzone/label.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { rootUrl, apiRootUrl, processItems, getInfo } from './util'; + +import { apiRootUrl, getInfo, processItems, rootUrl } from './util'; export const route: Route = { path: '/label/:name', diff --git a/lib/routes/cyzone/util.ts b/lib/routes/cyzone/util.ts index b399c6303c..6f1cc8f9e9 100644 --- a/lib/routes/cyzone/util.ts +++ b/lib/routes/cyzone/util.ts @@ -1,5 +1,6 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const rootUrl = 'https://www.cyzone.cn'; @@ -114,4 +115,4 @@ const processItems = async (apiUrl, limit, tryGet, ...params) => { return items; }; -export { rootUrl, apiRootUrl, getInfo, processItems }; +export { apiRootUrl, getInfo, processItems, rootUrl }; diff --git a/lib/routes/cztv/daily.ts b/lib/routes/cztv/daily.ts index 1ab73037ce..052d27f21f 100644 --- a/lib/routes/cztv/daily.ts +++ b/lib/routes/cztv/daily.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; -import path from 'node:path'; import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; const renderDesc = (item) => art(path.join(__dirname, 'templates/daily.art'), item); diff --git a/lib/routes/cztv/zjxwlb.ts b/lib/routes/cztv/zjxwlb.ts index 3929a9649e..1f9247f1b7 100644 --- a/lib/routes/cztv/zjxwlb.ts +++ b/lib/routes/cztv/zjxwlb.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; -import path from 'node:path'; import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; const renderDesc = (item) => art(path.join(__dirname, 'templates/zjxwlb.art'), item); diff --git a/lib/routes/dahecube/index.ts b/lib/routes/dahecube/index.ts index 16d5a8bcfe..b0811d01e7 100644 --- a/lib/routes/dahecube/index.ts +++ b/lib/routes/dahecube/index.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import utils from './utils'; + const { TYPE, parseUrl } = utils; export const route: Route = { diff --git a/lib/routes/daily/discussed.ts b/lib/routes/daily/discussed.ts index cdc7027bf7..a4266157d8 100644 --- a/lib/routes/daily/discussed.ts +++ b/lib/routes/daily/discussed.ts @@ -1,4 +1,6 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; + import { baseUrl, getData, getList, variables } from './utils.js'; const query = ` diff --git a/lib/routes/daily/popular.ts b/lib/routes/daily/popular.ts index 32e654ec7f..8e2e92fd8e 100644 --- a/lib/routes/daily/popular.ts +++ b/lib/routes/daily/popular.ts @@ -1,4 +1,6 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; + import { baseUrl, getData, getList, variables } from './utils.js'; const query = ` diff --git a/lib/routes/daily/source.ts b/lib/routes/daily/source.ts index 34bfec4e68..b764d55274 100644 --- a/lib/routes/daily/source.ts +++ b/lib/routes/daily/source.ts @@ -1,8 +1,9 @@ -import { DataItem, Route } from '@/types'; -import { baseUrl, getBuildId, getData, getList } from './utils'; -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; import { config } from '@/config'; +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + +import { baseUrl, getBuildId, getData, getList } from './utils'; interface Source { id: string; diff --git a/lib/routes/daily/squads.ts b/lib/routes/daily/squads.ts index 1aabbd2d93..72d25a9ce4 100644 --- a/lib/routes/daily/squads.ts +++ b/lib/routes/daily/squads.ts @@ -1,4 +1,6 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; + import { baseUrl, getData, getList, variables } from './utils.js'; const sourceQuery = ` diff --git a/lib/routes/daily/upvoted.ts b/lib/routes/daily/upvoted.ts index 0633880f6e..7278cfb92d 100644 --- a/lib/routes/daily/upvoted.ts +++ b/lib/routes/daily/upvoted.ts @@ -1,4 +1,6 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; + import { baseUrl, getData, getList, variables } from './utils.js'; const query = ` diff --git a/lib/routes/daily/user.ts b/lib/routes/daily/user.ts index 579ea0bcbb..387702372c 100644 --- a/lib/routes/daily/user.ts +++ b/lib/routes/daily/user.ts @@ -1,8 +1,9 @@ -import { DataItem, Route } from '@/types'; -import { baseUrl, getBuildId, getData, getList } from './utils'; -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; import { config } from '@/config'; +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + +import { baseUrl, getBuildId, getData, getList } from './utils'; const userPostQuery = ` query AuthorFeed( diff --git a/lib/routes/daily/utils.ts b/lib/routes/daily/utils.ts index 548adcca60..5205f6f240 100644 --- a/lib/routes/daily/utils.ts +++ b/lib/routes/daily/utils.ts @@ -1,10 +1,11 @@ -import { parseDate } from '@/utils/parse-date'; -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; -import { config } from '@/config'; -import { art } from '@/utils/render'; import path from 'node:path'; -import { DataItem } from '@/types'; + +import { config } from '@/config'; +import type { DataItem } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; export const baseUrl = 'https://app.daily.dev'; const gqlUrl = `https://api.daily.dev/graphql`; diff --git a/lib/routes/damai/activity.ts b/lib/routes/damai/activity.ts index 16036a77b2..b6113cb27e 100644 --- a/lib/routes/damai/activity.ts +++ b/lib/routes/damai/activity.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + export const route: Route = { path: '/activity/:city/:category/:subcategory/:keyword?', categories: ['shopping'], diff --git a/lib/routes/dangdang/notice.ts b/lib/routes/dangdang/notice.ts index d21414facd..014290fbd5 100644 --- a/lib/routes/dangdang/notice.ts +++ b/lib/routes/dangdang/notice.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/daoxuan/rss.ts b/lib/routes/daoxuan/rss.ts index 46b847728d..d11710e1aa 100644 --- a/lib/routes/daoxuan/rss.ts +++ b/lib/routes/daoxuan/rss.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/dapenti/subject.ts b/lib/routes/dapenti/subject.ts index 875ded5c7b..55617c720b 100644 --- a/lib/routes/dapenti/subject.ts +++ b/lib/routes/dapenti/subject.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/dapenti/tugua.ts b/lib/routes/dapenti/tugua.ts index ce11d934d2..3e18827eed 100644 --- a/lib/routes/dapenti/tugua.ts +++ b/lib/routes/dapenti/tugua.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/dapenti/utils.ts b/lib/routes/dapenti/utils.ts index b53be5a968..0b69eefb13 100644 --- a/lib/routes/dapenti/utils.ts +++ b/lib/routes/dapenti/utils.ts @@ -1,7 +1,8 @@ -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; + +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/darwinawards/index.ts b/lib/routes/darwinawards/index.ts index ee5567d7db..5b737ddfb3 100644 --- a/lib/routes/darwinawards/index.ts +++ b/lib/routes/darwinawards/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { name: 'Award Winners', diff --git a/lib/routes/dataguidance/index.ts b/lib/routes/dataguidance/index.ts index d44b4b4c5b..a5d3517f4c 100644 --- a/lib/routes/dataguidance/index.ts +++ b/lib/routes/dataguidance/index.ts @@ -1,7 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; - import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/daum/potplayer.ts b/lib/routes/daum/potplayer.ts index 0fbe6a4f6d..0b4bf90fb5 100644 --- a/lib/routes/daum/potplayer.ts +++ b/lib/routes/daum/potplayer.ts @@ -1,8 +1,8 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { type Context } from 'hono'; export const handler = async (ctx: Context): Promise => { const { lang } = ctx.req.param(); diff --git a/lib/routes/dayanzai/index.ts b/lib/routes/dayanzai/index.ts index 43039cfa3b..abb37cb3ab 100644 --- a/lib/routes/dayanzai/index.ts +++ b/lib/routes/dayanzai/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/dbaplus/new.ts b/lib/routes/dbaplus/new.ts index 5e7e4a708a..45ee23cf4d 100644 --- a/lib/routes/dbaplus/new.ts +++ b/lib/routes/dbaplus/new.ts @@ -1,16 +1,16 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; - export const handler = async (ctx: Context): Promise => { const { id = '9' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/dbaplus/rss.ts b/lib/routes/dbaplus/rss.ts index 81922af6b7..a7aca514d8 100644 --- a/lib/routes/dbaplus/rss.ts +++ b/lib/routes/dbaplus/rss.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + export const route: Route = { path: '/', categories: ['programming'], diff --git a/lib/routes/dblp/publication.ts b/lib/routes/dblp/publication.ts index e430c9e787..fd2112ac05 100644 --- a/lib/routes/dblp/publication.ts +++ b/lib/routes/dblp/publication.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; // 导入所需模组 import ofetch from '@/utils/ofetch'; // import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/dcard/section.ts b/lib/routes/dcard/section.ts index 9a92f53b55..64337340fd 100644 --- a/lib/routes/dcard/section.ts +++ b/lib/routes/dcard/section.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; -import utils from './utils'; import puppeteer from '@/utils/puppeteer'; +import utils from './utils'; + export const route: Route = { path: '/:section/:type?', categories: ['bbs'], diff --git a/lib/routes/dcfever/news.ts b/lib/routes/dcfever/news.ts index d19c37485b..4d18c8203a 100644 --- a/lib/routes/dcfever/news.ts +++ b/lib/routes/dcfever/news.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + import { baseUrl, parseItem } from './utils'; export const route: Route = { diff --git a/lib/routes/dcfever/reviews.ts b/lib/routes/dcfever/reviews.ts index ce4d997d6c..84e49498fd 100644 --- a/lib/routes/dcfever/reviews.ts +++ b/lib/routes/dcfever/reviews.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + import { baseUrl, parseItem } from './utils'; export const route: Route = { diff --git a/lib/routes/dcfever/trading-search.ts b/lib/routes/dcfever/trading-search.ts index b5d85a60a4..dcc7878206 100644 --- a/lib/routes/dcfever/trading-search.ts +++ b/lib/routes/dcfever/trading-search.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + // import { parseRelativeDate } from '@/utils/parse-date'; import { baseUrl, parseTradeItem } from './utils'; diff --git a/lib/routes/dcfever/trading.ts b/lib/routes/dcfever/trading.ts index 7b32fad24a..95a218f1fd 100644 --- a/lib/routes/dcfever/trading.ts +++ b/lib/routes/dcfever/trading.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + // import { parseRelativeDate } from '@/utils/parse-date'; import { baseUrl, parseTradeItem } from './utils'; diff --git a/lib/routes/dcfever/utils.ts b/lib/routes/dcfever/utils.ts index 14fc30582b..fc532dd3eb 100644 --- a/lib/routes/dcfever/utils.ts +++ b/lib/routes/dcfever/utils.ts @@ -1,9 +1,11 @@ -import ofetch from '@/utils/ofetch'; +import path from 'node:path'; + import { load } from 'cheerio'; + +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import cache from '@/utils/cache'; const baseUrl = 'https://www.dcfever.com'; diff --git a/lib/routes/ddosi/category.ts b/lib/routes/ddosi/category.ts index fd333d3942..5c8ee1a93c 100644 --- a/lib/routes/ddosi/category.ts +++ b/lib/routes/ddosi/category.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import { config } from '@/config'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ddosi/index.ts b/lib/routes/ddosi/index.ts index 9ea014e158..c93a8db9fb 100644 --- a/lib/routes/ddosi/index.ts +++ b/lib/routes/ddosi/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import { config } from '@/config'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/deadbydaylight/index.ts b/lib/routes/deadbydaylight/index.ts index e32a7bc507..acc689c0ba 100644 --- a/lib/routes/deadbydaylight/index.ts +++ b/lib/routes/deadbydaylight/index.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import MarkdownIt from 'markdown-it'; + const md = MarkdownIt({ html: true, linkify: true, diff --git a/lib/routes/deadline/posts.ts b/lib/routes/deadline/posts.ts index 71dc880b20..6991508cc3 100644 --- a/lib/routes/deadline/posts.ts +++ b/lib/routes/deadline/posts.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/', diff --git a/lib/routes/dealstreetasia/home.ts b/lib/routes/dealstreetasia/home.ts index e1e740c971..5d732c18fa 100644 --- a/lib/routes/dealstreetasia/home.ts +++ b/lib/routes/dealstreetasia/home.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; // An HTML parser with an API similar to jQuery + +import type { Route } from '@/types'; // import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; // Unified request library used -import { load } from 'cheerio'; // An HTML parser with an API similar to jQuery // import puppeteer from '@/utils/puppeteer'; // import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/dealstreetasia/section.ts b/lib/routes/dealstreetasia/section.ts index d8fc0d7dbc..876e68a72f 100644 --- a/lib/routes/dealstreetasia/section.ts +++ b/lib/routes/dealstreetasia/section.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; // An HTML parser with an API similar to jQuery + +import type { Route } from '@/types'; // import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; // Unified request library used -import { load } from 'cheerio'; // An HTML parser with an API similar to jQuery // import puppeteer from '@/utils/puppeteer'; // import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/decrypt/index.ts b/lib/routes/decrypt/index.ts index 31748e7768..6d9896371d 100644 --- a/lib/routes/decrypt/index.ts +++ b/lib/routes/decrypt/index.ts @@ -1,9 +1,10 @@ -import { Route, Data } from '@/types'; +import { load } from 'cheerio'; + +import type { Data, Route } from '@/types'; import cache from '@/utils/cache'; +import logger from '@/utils/logger'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; -import logger from '@/utils/logger'; import parser from '@/utils/rss-parser'; export const route: Route = { diff --git a/lib/routes/dedao/articles.ts b/lib/routes/dedao/articles.ts index 58e4a9b0f9..c0be9f8711 100644 --- a/lib/routes/dedao/articles.ts +++ b/lib/routes/dedao/articles.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/articles/:id?', diff --git a/lib/routes/dedao/index.ts b/lib/routes/dedao/index.ts index dfbc69a3b1..42d1c1546e 100644 --- a/lib/routes/dedao/index.ts +++ b/lib/routes/dedao/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/dedao/knowledge.ts b/lib/routes/dedao/knowledge.ts index e754f7d265..9d2ccc81ae 100644 --- a/lib/routes/dedao/knowledge.ts +++ b/lib/routes/dedao/knowledge.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/knowledge/:topic?/:type?', diff --git a/lib/routes/dedao/list.ts b/lib/routes/dedao/list.ts index 28e11dd69f..ae6c6ad2da 100644 --- a/lib/routes/dedao/list.ts +++ b/lib/routes/dedao/list.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/list/:category?', diff --git a/lib/routes/dedao/user.ts b/lib/routes/dedao/user.ts index a51c6afd52..ede8cde81f 100644 --- a/lib/routes/dedao/user.ts +++ b/lib/routes/dedao/user.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const types = { 0: '动态', diff --git a/lib/routes/deepin/homepage.ts b/lib/routes/deepin/homepage.ts index 19add2eee4..ffec7dc80c 100644 --- a/lib/routes/deepin/homepage.ts +++ b/lib/routes/deepin/homepage.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/deepin/thread.ts b/lib/routes/deepin/thread.ts index 99c30b9ec0..5c7ec62756 100644 --- a/lib/routes/deepin/thread.ts +++ b/lib/routes/deepin/thread.ts @@ -1,6 +1,6 @@ -import { Route, DataItem } from '@/types'; -import ofetch from '@/utils/ofetch'; +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/deepl/blog.ts b/lib/routes/deepl/blog.ts index c28b9cc5ea..65385238ca 100644 --- a/lib/routes/deepl/blog.ts +++ b/lib/routes/deepl/blog.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { lang = 'en' } = ctx.req.param(); diff --git a/lib/routes/deeplearning/the-batch.ts b/lib/routes/deeplearning/the-batch.ts index 27a36e496d..bc822317d6 100644 --- a/lib/routes/deeplearning/the-batch.ts +++ b/lib/routes/deeplearning/the-batch.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const handler = async (ctx) => { const { tag } = ctx.req.param(); diff --git a/lib/routes/deepmind/blog.ts b/lib/routes/deepmind/blog.ts index 3697e645e4..9ebebde924 100644 --- a/lib/routes/deepmind/blog.ts +++ b/lib/routes/deepmind/blog.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import parser from '@/utils/rss-parser'; export const route: Route = { diff --git a/lib/routes/deepseek/news.ts b/lib/routes/deepseek/news.ts index ebfc9a63ab..0f6de7af3e 100644 --- a/lib/routes/deepseek/news.ts +++ b/lib/routes/deepseek/news.ts @@ -1,7 +1,8 @@ -import { Route, Data, DataItem } from '@/types'; -import ofetch from '@/utils/ofetch'; import * as cheerio from 'cheerio'; + +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; const ROOT_URL = 'https://api-docs.deepseek.com/zh-cn'; diff --git a/lib/routes/dehenglaw/index.ts b/lib/routes/dehenglaw/index.ts index 16289792a3..5a2902acc8 100644 --- a/lib/routes/dehenglaw/index.ts +++ b/lib/routes/dehenglaw/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const handler = async (ctx) => { const { language = 'CN', category = 'paper' } = ctx.req.param(); diff --git a/lib/routes/deltaio/blog.ts b/lib/routes/deltaio/blog.ts index 8554df6f80..349262769b 100644 --- a/lib/routes/deltaio/blog.ts +++ b/lib/routes/deltaio/blog.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; export const route: Route = { path: '/blog', diff --git a/lib/routes/dev.to/guides.ts b/lib/routes/dev.to/guides.ts index 300c367ae8..19a5dbcac6 100644 --- a/lib/routes/dev.to/guides.ts +++ b/lib/routes/dev.to/guides.ts @@ -1,8 +1,9 @@ -import { Data, DataItem, Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/guides', diff --git a/lib/routes/dev.to/top.ts b/lib/routes/dev.to/top.ts index e8ca2bb5a6..1542d57e0d 100644 --- a/lib/routes/dev.to/top.ts +++ b/lib/routes/dev.to/top.ts @@ -1,8 +1,9 @@ -import { Data, DataItem, Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Data, DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; -import cache from '@/utils/cache'; export const route: Route = { path: '/top/:period', diff --git a/lib/routes/devolverdigital/blog.ts b/lib/routes/devolverdigital/blog.ts index 77c4f70459..a601649eee 100644 --- a/lib/routes/devolverdigital/blog.ts +++ b/lib/routes/devolverdigital/blog.ts @@ -1,5 +1,6 @@ -import { DataItem, Route } from '@/types'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/devtrium/posts.ts b/lib/routes/devtrium/posts.ts index f70c1d4265..a87f9a8ebb 100644 --- a/lib/routes/devtrium/posts.ts +++ b/lib/routes/devtrium/posts.ts @@ -1,5 +1,6 @@ -import { DataItem, Route } from '@/types'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/dewu/declaration.ts b/lib/routes/dewu/declaration.ts index 0e6e8f4c56..0ab73bc254 100644 --- a/lib/routes/dewu/declaration.ts +++ b/lib/routes/dewu/declaration.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/dgjyw/index.ts b/lib/routes/dgjyw/index.ts index 7572671474..457ceef7fc 100644 --- a/lib/routes/dgjyw/index.ts +++ b/lib/routes/dgjyw/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -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 type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '*', diff --git a/lib/routes/dgtle/article.ts b/lib/routes/dgtle/article.ts index 2a06d367f8..fb1b9289c2 100644 --- a/lib/routes/dgtle/article.ts +++ b/lib/routes/dgtle/article.ts @@ -1,10 +1,9 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; - import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; + import { baseUrl, ProcessItems } from './util'; export const handler = async (ctx: Context): Promise => { diff --git a/lib/routes/dgtle/news.ts b/lib/routes/dgtle/news.ts index 6c7f1bc0ab..b6df72a4e6 100644 --- a/lib/routes/dgtle/news.ts +++ b/lib/routes/dgtle/news.ts @@ -1,10 +1,9 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; - import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; + import { baseUrl, ProcessItems } from './util'; export const handler = async (ctx: Context): Promise => { diff --git a/lib/routes/dgtle/util.ts b/lib/routes/dgtle/util.ts index e68680ccc8..f2389f38bd 100644 --- a/lib/routes/dgtle/util.ts +++ b/lib/routes/dgtle/util.ts @@ -1,12 +1,12 @@ -import { type DataItem } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type CheerioAPI, load } from 'cheerio'; + +import { type DataItem } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, load } from 'cheerio'; -import path from 'node:path'; +import { art } from '@/utils/render'; const baseUrl: string = 'https://www.dgtle.com'; diff --git a/lib/routes/dgtle/video.ts b/lib/routes/dgtle/video.ts index 9b61477228..a0fd5071c0 100644 --- a/lib/routes/dgtle/video.ts +++ b/lib/routes/dgtle/video.ts @@ -1,16 +1,16 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseRelativeDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; - export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '18', 10); diff --git a/lib/routes/dgut/jwb.ts b/lib/routes/dgut/jwb.ts index 336c3ed6f8..dedbc368f6 100644 --- a/lib/routes/dgut/jwb.ts +++ b/lib/routes/dgut/jwb.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/dhu/jiaowu/news.ts b/lib/routes/dhu/jiaowu/news.ts index 2589b5964f..14b1efe76d 100644 --- a/lib/routes/dhu/jiaowu/news.ts +++ b/lib/routes/dhu/jiaowu/news.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://jw.dhu.edu.cn'; diff --git a/lib/routes/dhu/news/xsxx.ts b/lib/routes/dhu/news/xsxx.ts index 31ad2eea85..4db0e2f794 100644 --- a/lib/routes/dhu/news/xsxx.ts +++ b/lib/routes/dhu/news/xsxx.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://news.dhu.edu.cn/_wp3services/generalQuery?queryObj=articles&siteId=14&columnId=6410&pageIndex=1&rows=20'; diff --git a/lib/routes/dhu/xxgk/news.ts b/lib/routes/dhu/xxgk/news.ts index d911c41f5d..36c52a9319 100644 --- a/lib/routes/dhu/xxgk/news.ts +++ b/lib/routes/dhu/xxgk/news.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; const siteUrl = 'https://xxgk.dhu.edu.cn'; const baseUrl = 'https://xxgk.dhu.edu.cn/1737/list.htm'; diff --git a/lib/routes/dhu/yjs/news.ts b/lib/routes/dhu/yjs/news.ts index 9e8f9e0e23..ef1eae126b 100644 --- a/lib/routes/dhu/yjs/news.ts +++ b/lib/routes/dhu/yjs/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://gs.dhu.edu.cn'; diff --git a/lib/routes/dhu/yjs/zs.ts b/lib/routes/dhu/yjs/zs.ts index a098619fb0..c76d4750fe 100644 --- a/lib/routes/dhu/yjs/zs.ts +++ b/lib/routes/dhu/yjs/zs.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://yjszs.dhu.edu.cn'; diff --git a/lib/routes/diandong/news.ts b/lib/routes/diandong/news.ts index 616d621da2..2d148136cc 100644 --- a/lib/routes/diandong/news.ts +++ b/lib/routes/diandong/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootUrl = 'https://webapi.diandong.com'; diff --git a/lib/routes/dianping/user.ts b/lib/routes/dianping/user.ts index 09cbf1b8fc..f0b7743221 100644 --- a/lib/routes/dianping/user.ts +++ b/lib/routes/dianping/user.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { config } from '@/config'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; export const route: Route = { path: '/user/:id', diff --git a/lib/routes/diariofruticola/filtro.ts b/lib/routes/diariofruticola/filtro.ts index 9f7423501a..ee5e0eefcf 100644 --- a/lib/routes/diariofruticola/filtro.ts +++ b/lib/routes/diariofruticola/filtro.ts @@ -1,14 +1,13 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const { filter } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/diershoubing/news.ts b/lib/routes/diershoubing/news.ts index 855f9644f0..11e1daa449 100644 --- a/lib/routes/diershoubing/news.ts +++ b/lib/routes/diershoubing/news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; + const renderDesc = (data) => art(path.join(__dirname, 'templates/news.art'), data); export const route: Route = { diff --git a/lib/routes/digitalcameraworld/news.ts b/lib/routes/digitalcameraworld/news.ts index df2d557861..7955857e43 100644 --- a/lib/routes/digitalcameraworld/news.ts +++ b/lib/routes/digitalcameraworld/news.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; + const host = 'https://www.digitalcameraworld.com'; export const route: Route = { path: '/news', diff --git a/lib/routes/digitalpolicyalert/activity-tracker.ts b/lib/routes/digitalpolicyalert/activity-tracker.ts index b72fa50d7d..349e3a9485 100644 --- a/lib/routes/digitalpolicyalert/activity-tracker.ts +++ b/lib/routes/digitalpolicyalert/activity-tracker.ts @@ -1,11 +1,10 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; - import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + const createSearchParams = (queryString: string, limit: number = 30): URLSearchParams => { const params = new URLSearchParams(queryString); params.set('offset', '0'); diff --git a/lib/routes/dingshao/share.ts b/lib/routes/dingshao/share.ts index 371edb20c9..b234012bc0 100644 --- a/lib/routes/dingshao/share.ts +++ b/lib/routes/dingshao/share.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import type { Context } from 'hono'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import type { Context } from 'hono'; -import { Value } from './types'; + +import type { Value } from './types'; export const route: Route = { path: '/share/:shortId', diff --git a/lib/routes/discord/channel.ts b/lib/routes/discord/channel.ts index 133e90fc20..2b1e3139d9 100644 --- a/lib/routes/discord/channel.ts +++ b/lib/routes/discord/channel.ts @@ -1,11 +1,12 @@ -import { DataItem, Route } from '@/types'; +import path from 'node:path'; import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { DataItem, Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; + import { baseUrl, getChannel, getChannelMessages, getGuild } from './discord-api'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; export const route: Route = { path: '/channel/:channelId', diff --git a/lib/routes/discord/discord-api.ts b/lib/routes/discord/discord-api.ts index 9cf85e3ec2..d94c5508a3 100644 --- a/lib/routes/discord/discord-api.ts +++ b/lib/routes/discord/discord-api.ts @@ -1,5 +1,5 @@ -import { APIMessage } from 'discord-api-types/v10'; -import { RESTGetAPIGuildResult, RESTGetAPIGuildChannelsResult, RESTGetAPIChannelResult, RESTGetAPIChannelMessagesQuery, RESTGetAPIChannelMessagesResult } from 'discord-api-types/rest/v10'; +import type { RESTGetAPIChannelMessagesQuery, RESTGetAPIChannelMessagesResult, RESTGetAPIChannelResult, RESTGetAPIGuildChannelsResult, RESTGetAPIGuildResult } from 'discord-api-types/rest/v10'; +import type { APIMessage } from 'discord-api-types/v10'; import { config } from '@/config'; import cache from '@/utils/cache'; diff --git a/lib/routes/discord/search.ts b/lib/routes/discord/search.ts index 633539f7d0..aa7c3951ff 100644 --- a/lib/routes/discord/search.ts +++ b/lib/routes/discord/search.ts @@ -1,14 +1,15 @@ import path from 'node:path'; import { config } from '@/config'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import { art } from '@/utils/render'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import { parseDate } from '@/utils/parse-date'; import { queryToBoolean } from '@/utils/readable-social'; +import { art } from '@/utils/render'; -import { baseUrl, getGuild, searchGuildMessages, SearchGuildMessagesParams, HasType, VALID_HAS_TYPES } from './discord-api'; +import type { HasType, SearchGuildMessagesParams} from './discord-api'; +import { baseUrl, getGuild, searchGuildMessages, VALID_HAS_TYPES } from './discord-api'; export const route: Route = { path: '/search/:guildId/:routeParams', diff --git a/lib/routes/discourse/notifications.ts b/lib/routes/discourse/notifications.ts index 3d21131c49..54271bc30d 100644 --- a/lib/routes/discourse/notifications.ts +++ b/lib/routes/discourse/notifications.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import { getConfig } from './utils'; -import ofetch from '@/utils/ofetch'; import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + +import { getConfig } from './utils'; export const route: Route = { path: '/:configId/notifications/:fulltext?', diff --git a/lib/routes/discourse/official.ts b/lib/routes/discourse/official.ts index 333dc2e843..4df45e28f3 100644 --- a/lib/routes/discourse/official.ts +++ b/lib/routes/discourse/official.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import { getConfig } from './utils'; +import type { Route } from '@/types'; import got from '@/utils/got'; import RSSParser from '@/utils/rss-parser'; +import { getConfig } from './utils'; + export const route: Route = { path: '/:configId/official/:path{.+}', categories: ['bbs'], diff --git a/lib/routes/discourse/posts.ts b/lib/routes/discourse/posts.ts index 9e4f4e66ff..f39ef12530 100644 --- a/lib/routes/discourse/posts.ts +++ b/lib/routes/discourse/posts.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import { getConfig } from './utils'; +import type { Route } from '@/types'; import got from '@/utils/got'; import RSSParser from '@/utils/rss-parser'; +import { getConfig } from './utils'; + export const route: Route = { path: '/:configId/posts', categories: ['bbs'], diff --git a/lib/routes/discuz/discuz.ts b/lib/routes/discuz/discuz.ts index 217590169b..b3eedadc47 100644 --- a/lib/routes/discuz/discuz.ts +++ b/lib/routes/discuz/discuz.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; -import { parseDate } from '@/utils/parse-date'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; function fixUrl(itemLink, baseUrl) { // 处理相对链接 diff --git a/lib/routes/disinfo/publications.ts b/lib/routes/disinfo/publications.ts index d20ef56dd4..4468077903 100644 --- a/lib/routes/disinfo/publications.ts +++ b/lib/routes/disinfo/publications.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/diskanalyzer/whats-new.ts b/lib/routes/diskanalyzer/whats-new.ts index 6c00fda582..ebdb7bece3 100644 --- a/lib/routes/diskanalyzer/whats-new.ts +++ b/lib/routes/diskanalyzer/whats-new.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/distill/index.ts b/lib/routes/distill/index.ts index aea659c95c..96a02766fc 100644 --- a/lib/routes/distill/index.ts +++ b/lib/routes/distill/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/dlnews/category.ts b/lib/routes/dlnews/category.ts index 3ec34bedc5..d06b15debd 100644 --- a/lib/routes/dlnews/category.ts +++ b/lib/routes/dlnews/category.ts @@ -1,13 +1,15 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; -import { load } from 'cheerio'; -import got from '@/utils/got'; -import { getData, getList } from './utils'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; import pMap from 'p-map'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + +import { getData, getList } from './utils'; + const _website = 'dlnews'; const topics = { defi: 'DeFi', diff --git a/lib/routes/dlsite/campaign.ts b/lib/routes/dlsite/campaign.ts index ff06faa5cf..8893504a4a 100644 --- a/lib/routes/dlsite/campaign.ts +++ b/lib/routes/dlsite/campaign.ts @@ -1,8 +1,9 @@ -import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + const host = 'https://www.dlsite.com'; const infos = { // 全年齢向け diff --git a/lib/routes/dlsite/ci-en/article.ts b/lib/routes/dlsite/ci-en/article.ts index a5a513f068..446fa3b455 100644 --- a/lib/routes/dlsite/ci-en/article.ts +++ b/lib/routes/dlsite/ci-en/article.ts @@ -1,9 +1,11 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/ci-en/:id/article', diff --git a/lib/routes/dlsite/new.ts b/lib/routes/dlsite/new.ts index 1a426ce1dd..783891b557 100644 --- a/lib/routes/dlsite/new.ts +++ b/lib/routes/dlsite/new.ts @@ -1,8 +1,10 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; const host = 'https://www.dlsite.com'; const infos = { diff --git a/lib/routes/dlsite/utils.ts b/lib/routes/dlsite/utils.ts index 8b63c01f27..1ee4e405a7 100644 --- a/lib/routes/dlsite/utils.ts +++ b/lib/routes/dlsite/utils.ts @@ -1,11 +1,13 @@ +import path from 'node:path'; + +import { load } from 'cheerio'; +import dayjs from 'dayjs'; + 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 dayjs from 'dayjs'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; const rootUrl = 'https://www.dlsite.com'; diff --git a/lib/routes/dlsite/z-index/index.ts b/lib/routes/dlsite/z-index/index.ts index dc17b3e0ce..7f0fb90b8a 100644 --- a/lib/routes/dlsite/z-index/index.ts +++ b/lib/routes/dlsite/z-index/index.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { ProcessItems } from '../utils'; export const route: Route = { diff --git a/lib/routes/dmzj/news.ts b/lib/routes/dmzj/news.ts index 84d2b000a3..4a4cdfb1f1 100644 --- a/lib/routes/dmzj/news.ts +++ b/lib/routes/dmzj/news.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/dn/news.ts b/lib/routes/dn/news.ts index 09f7239f9d..a96ba8729d 100644 --- a/lib/routes/dn/news.ts +++ b/lib/routes/dn/news.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:language/news/:category?', diff --git a/lib/routes/dnaindia/common.ts b/lib/routes/dnaindia/common.ts index 46c27b2b72..e501d9b503 100644 --- a/lib/routes/dnaindia/common.ts +++ b/lib/routes/dnaindia/common.ts @@ -1,9 +1,10 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; +import logger from '@/utils/logger'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import logger from '@/utils/logger'; export async function handler(ctx) { const { category, topic } = ctx.req.param(); diff --git a/lib/routes/dnaindia/news.ts b/lib/routes/dnaindia/news.ts index fc75655cdb..51191db282 100644 --- a/lib/routes/dnaindia/news.ts +++ b/lib/routes/dnaindia/news.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { handler } from './common'; export const route: Route = { diff --git a/lib/routes/dnaindia/topic.ts b/lib/routes/dnaindia/topic.ts index b38dea7f66..0a20bee670 100644 --- a/lib/routes/dnaindia/topic.ts +++ b/lib/routes/dnaindia/topic.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { handler } from './common'; export const route: Route = { diff --git a/lib/routes/dockerhub/build.ts b/lib/routes/dockerhub/build.ts index f067982e06..d7b74a65c5 100644 --- a/lib/routes/dockerhub/build.ts +++ b/lib/routes/dockerhub/build.ts @@ -1,5 +1,7 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; + import { hash } from './utils'; export const route: Route = { diff --git a/lib/routes/dockerhub/repositories.ts b/lib/routes/dockerhub/repositories.ts index dbdf3093c6..7eb2067afb 100644 --- a/lib/routes/dockerhub/repositories.ts +++ b/lib/routes/dockerhub/repositories.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; +import type { Context } from 'hono'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { Context } from 'hono'; export const route: Route = { name: 'Owner Repositories', diff --git a/lib/routes/dockerhub/tag.ts b/lib/routes/dockerhub/tag.ts index a47c824687..44325f3ed7 100644 --- a/lib/routes/dockerhub/tag.ts +++ b/lib/routes/dockerhub/tag.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { hash } from './utils'; export const route: Route = { diff --git a/lib/routes/docschina/weekly.ts b/lib/routes/docschina/weekly.ts index 421bd84fa5..0b76531c39 100644 --- a/lib/routes/docschina/weekly.ts +++ b/lib/routes/docschina/weekly.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import cache from '@/utils/cache'; import markdownit from 'markdown-it'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + const md = markdownit({ html: true, breaks: true, diff --git a/lib/routes/dol/announce.ts b/lib/routes/dol/announce.ts index 19c123f71d..d0e6863a4c 100644 --- a/lib/routes/dol/announce.ts +++ b/lib/routes/dol/announce.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/domp4/detail.ts b/lib/routes/domp4/detail.ts index a67c21bb1e..c2c0949301 100644 --- a/lib/routes/domp4/detail.ts +++ b/lib/routes/domp4/detail.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; -import { decodeCipherText, composeMagnetUrl, getUrlType, ensureDomain } from './utils'; +import { composeMagnetUrl, decodeCipherText, ensureDomain, getUrlType } from './utils'; // 兼容没有 script 标签的情况,直接解析 dom function getDomList($, detailUrl) { diff --git a/lib/routes/domp4/latest-movie-bt.ts b/lib/routes/domp4/latest-movie-bt.ts index ad75b11f1b..70e9b9268a 100644 --- a/lib/routes/domp4/latest-movie-bt.ts +++ b/lib/routes/domp4/latest-movie-bt.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { getItemList as detailItemList } from './detail'; -import { ensureDomain } from './utils'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + +import { getItemList as detailItemList } from './detail'; +import { ensureDomain } from './utils'; function getItemList($) { const list = $(`#vod .list-group-item`) diff --git a/lib/routes/domp4/latest.ts b/lib/routes/domp4/latest.ts index 190798333f..1409ca634d 100644 --- a/lib/routes/domp4/latest.ts +++ b/lib/routes/domp4/latest.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + import { ensureDomain } from './utils'; function getItemList($, type) { diff --git a/lib/routes/domp4/utils.ts b/lib/routes/domp4/utils.ts index 517fb88e29..06f5d2dace 100644 --- a/lib/routes/domp4/utils.ts +++ b/lib/routes/domp4/utils.ts @@ -93,4 +93,4 @@ function ensureDomain(ctx, domain = defaultDomain) { return origin; } -export { defaultDomain, magnetTrackers, getUrlType, composeMagnetUrl, decodeCipherText, ensureDomain }; +export { composeMagnetUrl, decodeCipherText, defaultDomain, ensureDomain, getUrlType, magnetTrackers }; diff --git a/lib/routes/dongqiudi/daily.ts b/lib/routes/dongqiudi/daily.ts index 89184f09e6..0b83dc5b45 100644 --- a/lib/routes/dongqiudi/daily.ts +++ b/lib/routes/dongqiudi/daily.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + export const route: Route = { path: '/daily', categories: ['new-media'], diff --git a/lib/routes/dongqiudi/player-news.ts b/lib/routes/dongqiudi/player-news.ts index a3f8038c9a..da2ae5d5a3 100644 --- a/lib/routes/dongqiudi/player-news.ts +++ b/lib/routes/dongqiudi/player-news.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/dongqiudi/result.ts b/lib/routes/dongqiudi/result.ts index ca3855e03d..13b8b91250 100644 --- a/lib/routes/dongqiudi/result.ts +++ b/lib/routes/dongqiudi/result.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { JSDOM } from 'jsdom'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/dongqiudi/special.ts b/lib/routes/dongqiudi/special.ts index 99f691bc2b..fa570669f7 100644 --- a/lib/routes/dongqiudi/special.ts +++ b/lib/routes/dongqiudi/special.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import utils from './utils'; import { parseDate } from '@/utils/parse-date'; +import utils from './utils'; + export const route: Route = { path: '/special/:id', categories: ['new-media'], diff --git a/lib/routes/dongqiudi/team-news.ts b/lib/routes/dongqiudi/team-news.ts index aad780a642..a0853f9a41 100644 --- a/lib/routes/dongqiudi/team-news.ts +++ b/lib/routes/dongqiudi/team-news.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/dongqiudi/top-news.ts b/lib/routes/dongqiudi/top-news.ts index a3166f248d..4df9f90920 100644 --- a/lib/routes/dongqiudi/top-news.ts +++ b/lib/routes/dongqiudi/top-news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import utils from './utils'; import { parseDate } from '@/utils/parse-date'; +import utils from './utils'; + export const route: Route = { path: '/top_news/:id?', categories: ['new-media'], diff --git a/lib/routes/dongqiudi/utils.ts b/lib/routes/dongqiudi/utils.ts index d41fb78bf8..6294b06b8f 100644 --- a/lib/routes/dongqiudi/utils.ts +++ b/lib/routes/dongqiudi/utils.ts @@ -1,7 +1,8 @@ -import cache from '@/utils/cache'; import { load } from 'cheerio'; -import got from '@/utils/got'; import { JSDOM } from 'jsdom'; + +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const ProcessVideo = (content) => { diff --git a/lib/routes/dora-world/article.ts b/lib/routes/dora-world/article.ts index 561c4955fc..bdf4d8a0a6 100644 --- a/lib/routes/dora-world/article.ts +++ b/lib/routes/dora-world/article.ts @@ -1,7 +1,9 @@ -import { Route, Data, DataItem, ViewType } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Data, DataItem, Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/dorohedoro/news.ts b/lib/routes/dorohedoro/news.ts index fb63712b77..4dd5bfaeb1 100644 --- a/lib/routes/dorohedoro/news.ts +++ b/lib/routes/dorohedoro/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/douban/book/latest.ts b/lib/routes/douban/book/latest.ts index e9da797841..8a2264d22c 100644 --- a/lib/routes/douban/book/latest.ts +++ b/lib/routes/douban/book/latest.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; const linkUrl = 'https://book.douban.com/latest'; diff --git a/lib/routes/douban/book/rank.ts b/lib/routes/douban/book/rank.ts index 132fd52cc7..b17915659b 100644 --- a/lib/routes/douban/book/rank.ts +++ b/lib/routes/douban/book/rank.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/douban/channel/subject.ts b/lib/routes/douban/channel/subject.ts index b90e2ac216..2575783ada 100644 --- a/lib/routes/douban/channel/subject.ts +++ b/lib/routes/douban/channel/subject.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/douban/channel/topic.ts b/lib/routes/douban/channel/topic.ts index 5d2734e57a..3b285f6cac 100644 --- a/lib/routes/douban/channel/topic.ts +++ b/lib/routes/douban/channel/topic.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/douban/commercialpress/latest.ts b/lib/routes/douban/commercialpress/latest.ts index 2bfbdc5168..06b39fda47 100644 --- a/lib/routes/douban/commercialpress/latest.ts +++ b/lib/routes/douban/commercialpress/latest.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/commercialpress/latest', categories: ['social-media'], diff --git a/lib/routes/douban/event/hot.ts b/lib/routes/douban/event/hot.ts index c66337ce6f..cf24494753 100644 --- a/lib/routes/douban/event/hot.ts +++ b/lib/routes/douban/event/hot.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/douban/movie/coming.ts b/lib/routes/douban/movie/coming.ts index f421082800..0a24716f1f 100644 --- a/lib/routes/douban/movie/coming.ts +++ b/lib/routes/douban/movie/coming.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/movie/coming', diff --git a/lib/routes/douban/other/bookstore.ts b/lib/routes/douban/other/bookstore.ts index 848cf401ff..6c86216190 100644 --- a/lib/routes/douban/other/bookstore.ts +++ b/lib/routes/douban/other/bookstore.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/douban/other/celebrity.ts b/lib/routes/douban/other/celebrity.ts index 8edad45e30..d059b41433 100644 --- a/lib/routes/douban/other/celebrity.ts +++ b/lib/routes/douban/other/celebrity.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/celebrity/:id/:sort?', categories: ['social-media'], diff --git a/lib/routes/douban/other/classification.ts b/lib/routes/douban/other/classification.ts index ea08516511..4723fd732e 100644 --- a/lib/routes/douban/other/classification.ts +++ b/lib/routes/douban/other/classification.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/douban/other/discussion.ts b/lib/routes/douban/other/discussion.ts index 741408abbe..f78227d95a 100644 --- a/lib/routes/douban/other/discussion.ts +++ b/lib/routes/douban/other/discussion.ts @@ -1,4 +1,6 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; /* * @Author: nightmare-mio wanglongwei2009@qq.com @@ -7,7 +9,6 @@ import cache from '@/utils/cache'; * @Description: */ import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/douban/other/doulist.ts b/lib/routes/douban/other/doulist.ts index e01af8a468..77bf929e9f 100644 --- a/lib/routes/douban/other/doulist.ts +++ b/lib/routes/douban/other/doulist.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/doulist/:id', categories: ['social-media'], diff --git a/lib/routes/douban/other/explore-column.ts b/lib/routes/douban/other/explore-column.ts index b76e27ad2d..c5a502da7f 100644 --- a/lib/routes/douban/other/explore-column.ts +++ b/lib/routes/douban/other/explore-column.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import { load } from 'cheerio'; import * as url from 'node:url'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; + const host = 'https://www.douban.com/explore/column/'; export const route: Route = { path: '/explore/column/:id', diff --git a/lib/routes/douban/other/explore.ts b/lib/routes/douban/other/explore.ts index 10dba7bda8..e0f2d05778 100644 --- a/lib/routes/douban/other/explore.ts +++ b/lib/routes/douban/other/explore.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + export const route: Route = { path: '/explore', categories: ['social-media'], diff --git a/lib/routes/douban/other/group.ts b/lib/routes/douban/other/group.ts index c4b93a12d7..21c05025b1 100644 --- a/lib/routes/douban/other/group.ts +++ b/lib/routes/douban/other/group.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/group/:groupid/:type?', diff --git a/lib/routes/douban/other/jobs.ts b/lib/routes/douban/other/jobs.ts index 0bb203a45f..6503090aa3 100644 --- a/lib/routes/douban/other/jobs.ts +++ b/lib/routes/douban/other/jobs.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + const rootUrl = 'https://jobs.douban.com'; const titleMap = { diff --git a/lib/routes/douban/other/later.ts b/lib/routes/douban/other/later.ts index 1fe3cbb5d7..f097ac2d97 100644 --- a/lib/routes/douban/other/later.ts +++ b/lib/routes/douban/other/later.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/movie/later', categories: ['social-media'], diff --git a/lib/routes/douban/other/latest-music.ts b/lib/routes/douban/other/latest-music.ts index 06489ad979..a5d1e21843 100644 --- a/lib/routes/douban/other/latest-music.ts +++ b/lib/routes/douban/other/latest-music.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/music/latest/:area?', categories: ['social-media'], diff --git a/lib/routes/douban/other/list.ts b/lib/routes/douban/other/list.ts index 47fbc78863..e4e36eb30c 100644 --- a/lib/routes/douban/other/list.ts +++ b/lib/routes/douban/other/list.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; import path from 'node:path'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { fallback, queryToFloat, queryToInteger } from '@/utils/readable-social'; import { art } from '@/utils/render'; -import { fallback, queryToInteger, queryToFloat } from '@/utils/readable-social'; export const route: Route = { path: '/list/:type?/:routeParams?', diff --git a/lib/routes/douban/other/playing.ts b/lib/routes/douban/other/playing.ts index 13f5434dab..779a40b8cf 100644 --- a/lib/routes/douban/other/playing.ts +++ b/lib/routes/douban/other/playing.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: ['/movie/playing', '/movie/playing/:score'], categories: ['social-media'], diff --git a/lib/routes/douban/other/recommended.ts b/lib/routes/douban/other/recommended.ts index b2f534e942..34965de888 100644 --- a/lib/routes/douban/other/recommended.ts +++ b/lib/routes/douban/other/recommended.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; import path from 'node:path'; -import { art } from '@/utils/render'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { fallback, queryToInteger } from '@/utils/readable-social'; +import { art } from '@/utils/render'; export const route: Route = { path: '/recommended/:type?/:routeParams?', diff --git a/lib/routes/douban/other/replied.ts b/lib/routes/douban/other/replied.ts index 836ecb5c86..23767e6ce8 100644 --- a/lib/routes/douban/other/replied.ts +++ b/lib/routes/douban/other/replied.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/replied/:uid', diff --git a/lib/routes/douban/other/replies.ts b/lib/routes/douban/other/replies.ts index 63582f6582..7d2515a613 100644 --- a/lib/routes/douban/other/replies.ts +++ b/lib/routes/douban/other/replies.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/replies/:uid', diff --git a/lib/routes/douban/other/topic.ts b/lib/routes/douban/other/topic.ts index 3a4b17ce61..e5c56ea4b3 100644 --- a/lib/routes/douban/other/topic.ts +++ b/lib/routes/douban/other/topic.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; diff --git a/lib/routes/douban/other/ustop.ts b/lib/routes/douban/other/ustop.ts index 8d9c548475..871f84242f 100644 --- a/lib/routes/douban/other/ustop.ts +++ b/lib/routes/douban/other/ustop.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/douban/other/weekly-best.ts b/lib/routes/douban/other/weekly-best.ts index 04b47f9838..00120e022d 100644 --- a/lib/routes/douban/other/weekly-best.ts +++ b/lib/routes/douban/other/weekly-best.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/movie/weekly/:type?', diff --git a/lib/routes/douban/people/status.ts b/lib/routes/douban/people/status.ts index 9a2eb06fe8..dff0f91a09 100644 --- a/lib/routes/douban/people/status.ts +++ b/lib/routes/douban/people/status.ts @@ -1,9 +1,12 @@ -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; import querystring from 'node:querystring'; + +import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { fallback, queryToBoolean, queryToInteger } from '@/utils/readable-social'; -import { config } from '@/config'; + export const route: Route = { path: '/people/:userid/status/:routeParams?', categories: ['social-media'], diff --git a/lib/routes/douban/people/wish.ts b/lib/routes/douban/people/wish.ts index 6facc1f1b7..bd676988bb 100644 --- a/lib/routes/douban/people/wish.ts +++ b/lib/routes/douban/people/wish.ts @@ -1,9 +1,12 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import querystring from 'node:querystring'; + import { load } from 'cheerio'; -import got from '@/utils/got'; + import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + export const route: Route = { path: '/people/:userid/wish/:routeParams?', categories: ['social-media'], diff --git a/lib/routes/douyin/hashtag.ts b/lib/routes/douyin/hashtag.ts index 3edfec85c6..b88b79ce55 100644 --- a/lib/routes/douyin/hashtag.ts +++ b/lib/routes/douyin/hashtag.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import { config } from '@/config'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; -import { art } from '@/utils/render'; -import { config } from '@/config'; -import { fallback, queryToBoolean } from '@/utils/readable-social'; -import { templates, resolveUrl, proxyVideo, getOriginAvatar } from './utils'; import puppeteer from '@/utils/puppeteer'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; +import { fallback, queryToBoolean } from '@/utils/readable-social'; +import { art } from '@/utils/render'; + +import { getOriginAvatar, proxyVideo, resolveUrl, templates } from './utils'; export const route: Route = { path: '/hashtag/:cid/:routeParams?', diff --git a/lib/routes/douyin/live.ts b/lib/routes/douyin/live.ts index 3159461b1f..014192f774 100644 --- a/lib/routes/douyin/live.ts +++ b/lib/routes/douyin/live.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { config } from '@/config'; -import { getOriginAvatar } from './utils'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import logger from '@/utils/logger'; import puppeteer from '@/utils/puppeteer'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; + +import { getOriginAvatar } from './utils'; export const route: Route = { path: '/live/:rid', diff --git a/lib/routes/douyin/user.ts b/lib/routes/douyin/user.ts index 86d6284f21..2ac99cfec5 100644 --- a/lib/routes/douyin/user.ts +++ b/lib/routes/douyin/user.ts @@ -1,14 +1,15 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; -import { art } from '@/utils/render'; import { config } from '@/config'; -import { fallback, queryToBoolean } from '@/utils/readable-social'; -import { templates, resolveUrl, proxyVideo, getOriginAvatar } from './utils'; import InvalidParameterError from '@/errors/types/invalid-parameter'; -import puppeteer from '@/utils/puppeteer'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import logger from '@/utils/logger'; -import { PostData } from './types'; +import { parseDate } from '@/utils/parse-date'; +import puppeteer from '@/utils/puppeteer'; +import { fallback, queryToBoolean } from '@/utils/readable-social'; +import { art } from '@/utils/render'; + +import type { PostData } from './types'; +import { getOriginAvatar, proxyVideo, resolveUrl, templates } from './utils'; export const route: Route = { path: '/user/:uid/:routeParams?', diff --git a/lib/routes/douyin/utils.ts b/lib/routes/douyin/utils.ts index 8a5d6e72f4..95bce56c50 100644 --- a/lib/routes/douyin/utils.ts +++ b/lib/routes/douyin/utils.ts @@ -42,4 +42,4 @@ const getOriginAvatar = (url) => .replace(/^(.*\.douyinpic\.com\/).*(\/aweme-avatar\/)([^?]*)(\?.*)?$/, '$1origin$2$3') .replaceAll(/~\w+_\d+x\d+/g, ''); -export { templates, resolveUrl, proxyVideo, getOriginAvatar }; +export { getOriginAvatar, proxyVideo, resolveUrl, templates }; diff --git a/lib/routes/douyu/group.ts b/lib/routes/douyu/group.ts index 8271054d7b..3a4f26f6ab 100644 --- a/lib/routes/douyu/group.ts +++ b/lib/routes/douyu/group.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/group/:id/:sort?', diff --git a/lib/routes/douyu/post.ts b/lib/routes/douyu/post.ts index b54b0dc30b..153690ba25 100644 --- a/lib/routes/douyu/post.ts +++ b/lib/routes/douyu/post.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/post/:id', diff --git a/lib/routes/douyu/room.ts b/lib/routes/douyu/room.ts index bd0a36c6cd..540ad628dc 100644 --- a/lib/routes/douyu/room.ts +++ b/lib/routes/douyu/room.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/dribbble/keyword.ts b/lib/routes/dribbble/keyword.ts index b40f939c3b..fd51c58ae2 100644 --- a/lib/routes/dribbble/keyword.ts +++ b/lib/routes/dribbble/keyword.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/dribbble/popular.ts b/lib/routes/dribbble/popular.ts index 628394e818..0b2ed50bc7 100644 --- a/lib/routes/dribbble/popular.ts +++ b/lib/routes/dribbble/popular.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/dribbble/user.ts b/lib/routes/dribbble/user.ts index 5dedf78c41..17f716ad99 100644 --- a/lib/routes/dribbble/user.ts +++ b/lib/routes/dribbble/user.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/dribbble/utils.ts b/lib/routes/dribbble/utils.ts index 2e9fca4ec3..274a20f874 100644 --- a/lib/routes/dribbble/utils.ts +++ b/lib/routes/dribbble/utils.ts @@ -1,9 +1,11 @@ +import path from 'node:path'; + +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const host = 'https://dribbble.com'; diff --git a/lib/routes/dtcj/datahero.ts b/lib/routes/dtcj/datahero.ts index 022dbc50d3..3cb71fc669 100644 --- a/lib/routes/dtcj/datahero.ts +++ b/lib/routes/dtcj/datahero.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const titles = { diff --git a/lib/routes/dtcj/datainsight.ts b/lib/routes/dtcj/datainsight.ts index a003171b3a..8cbb8d78de 100644 --- a/lib/routes/dtcj/datainsight.ts +++ b/lib/routes/dtcj/datainsight.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/duckdb/news.ts b/lib/routes/duckdb/news.ts index eece112c56..1e0621f96b 100644 --- a/lib/routes/duckdb/news.ts +++ b/lib/routes/duckdb/news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import cache from '@/utils/cache'; export const route: Route = { path: '/news', diff --git a/lib/routes/duozhuayu/search.ts b/lib/routes/duozhuayu/search.ts index 9f7267039f..e61b89d29f 100644 --- a/lib/routes/duozhuayu/search.ts +++ b/lib/routes/duozhuayu/search.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import aesjs from 'aes-js'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import aesjs from 'aes-js'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; export const route: Route = { path: '/search/:wd', diff --git a/lib/routes/dushu/fuzhou/index.ts b/lib/routes/dushu/fuzhou/index.ts index 1124d1caa0..f66d27f491 100644 --- a/lib/routes/dushu/fuzhou/index.ts +++ b/lib/routes/dushu/fuzhou/index.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { art } from '@/utils/render'; -import path from 'node:path'; const host = 'https://gateway-api-ipv4.dushu365.com/compose-orch/offlineActivity/v100/activity/list'; const itemLink = 'https://card.dushu.io/requirement/offline-activity/activity-detail/v/index.html'; diff --git a/lib/routes/dut/index.ts b/lib/routes/dut/index.ts index dbee2d986b..117bf63e66 100644 --- a/lib/routes/dut/index.ts +++ b/lib/routes/dut/index.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; +import { isValidHost } from '@/utils/valid-host'; + import defaults from './defaults'; import shortcuts from './shortcuts'; -import { isValidHost } from '@/utils/valid-host'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; export const route: Route = { path: ['/*/*', '/:0?'], diff --git a/lib/routes/dw/news.ts b/lib/routes/dw/news.ts index 806f745b9c..5777d82d23 100644 --- a/lib/routes/dw/news.ts +++ b/lib/routes/dw/news.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import { processItems } from './utils'; -import got from '@/utils/got'; -import cache from '@/utils/cache'; import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + +import { processItems } from './utils'; export const route: Route = { path: '/news/:lang?/:id?', diff --git a/lib/routes/dw/rss.ts b/lib/routes/dw/rss.ts index 54bd497f1c..66dba4ed24 100644 --- a/lib/routes/dw/rss.ts +++ b/lib/routes/dw/rss.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; -import { config } from '@/config'; import Parser from 'rss-parser'; + +import { config } from '@/config'; +import type { Route } from '@/types'; + import { processItems } from './utils'; export const route: Route = { diff --git a/lib/routes/dw/utils.ts b/lib/routes/dw/utils.ts index 83a746dbae..ea36656f68 100644 --- a/lib/routes/dw/utils.ts +++ b/lib/routes/dw/utils.ts @@ -1,8 +1,10 @@ +import path from 'node:path'; + +import { type CheerioAPI, load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load, type CheerioAPI } from 'cheerio'; import { art } from '@/utils/render'; -import path from 'node:path'; const formatId = '605'; diff --git a/lib/routes/dx2025/index.ts b/lib/routes/dx2025/index.ts index 8381eb2f3e..d0ce740f97 100644 --- a/lib/routes/dx2025/index.ts +++ b/lib/routes/dx2025/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/:type?/:category?', diff --git a/lib/routes/dxy/board.ts b/lib/routes/dxy/board.ts index 35b55bba66..11552325bf 100644 --- a/lib/routes/dxy/board.ts +++ b/lib/routes/dxy/board.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { phoneBaseUrl, webBaseUrl, generateNonce, sign, getPost } from './utils'; -import { config } from '@/config'; -import { BoardInfo, PostListData } from './types'; + +import type { BoardInfo, PostListData } from './types'; +import { generateNonce, getPost, phoneBaseUrl, sign, webBaseUrl } from './utils'; export const route: Route = { path: '/bbs/board/:boardId', diff --git a/lib/routes/dxy/profile/thread.ts b/lib/routes/dxy/profile/thread.ts index a34b6fb912..3aae46ea1b 100644 --- a/lib/routes/dxy/profile/thread.ts +++ b/lib/routes/dxy/profile/thread.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { webBaseUrl, generateNonce, sign, getPost } from '../utils'; -import { config } from '@/config'; + +import { generateNonce, getPost, sign, webBaseUrl } from '../utils'; export const route: Route = { path: '/bbs/profile/thread/:userId', diff --git a/lib/routes/dxy/special.ts b/lib/routes/dxy/special.ts index 3d41e6e656..dbe27a8ba8 100644 --- a/lib/routes/dxy/special.ts +++ b/lib/routes/dxy/special.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { phoneBaseUrl, webBaseUrl, generateNonce, sign, getPost } from './utils'; -import { config } from '@/config'; -import { RecommendListData, SpecialBoardDetail } from './types'; + +import type { RecommendListData, SpecialBoardDetail } from './types'; +import { generateNonce, getPost, phoneBaseUrl, sign, webBaseUrl } from './utils'; export const route: Route = { path: '/bbs/special/:specialId', diff --git a/lib/routes/dxy/utils.ts b/lib/routes/dxy/utils.ts index b404e3920f..49f788ff9b 100644 --- a/lib/routes/dxy/utils.ts +++ b/lib/routes/dxy/utils.ts @@ -1,8 +1,10 @@ -import CryptoJS from 'crypto-js'; -import ofetch from '@/utils/ofetch'; import * as cheerio from 'cheerio'; +import CryptoJS from 'crypto-js'; + +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { PostData } from './types'; + +import type { PostData } from './types'; const APP_SIGN_KEY = '4bTogwpz7RzNO2VTFtW7zcfRkAE97ox6ZSgcQi7FgYdqrHqKB7aGqEZ4o7yssa2aEXoV3bQwh12FFgVNlpyYk2Yjm9d2EZGeGu3'; const phoneBaseUrl = 'https://3g.dxy.cn'; @@ -72,4 +74,4 @@ const getPost = (item, tryGet) => return item; }); -export { phoneBaseUrl, webBaseUrl, generateNonce, sign, getPost }; +export { generateNonce, getPost, phoneBaseUrl, sign, webBaseUrl }; diff --git a/lib/routes/dykszx/news.ts b/lib/routes/dykszx/news.ts index c6bdf52294..fbe8753fcc 100644 --- a/lib/routes/dykszx/news.ts +++ b/lib/routes/dykszx/news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import got from '@/utils/got'; -import cache from '@/utils/cache'; const HOST = 'https://www.dykszx.com'; diff --git a/lib/routes/dytt/index.ts b/lib/routes/dytt/index.ts index 69c8d4c3a7..879b13287f 100644 --- a/lib/routes/dytt/index.ts +++ b/lib/routes/dytt/index.ts @@ -1,15 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import cache from '@/utils/cache'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; import iconv from 'iconv-lite'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - const domain: string = 'www.dydytt.net'; const baseUrl: string = `https://${domain}`; diff --git a/lib/routes/e-hentai/index.ts b/lib/routes/e-hentai/index.ts index fb7cf60090..de5ec45c86 100644 --- a/lib/routes/e-hentai/index.ts +++ b/lib/routes/e-hentai/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import path from 'node:path'; -import { art } from '@/utils/render'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; export const route: Route = { path: '/:what?/:id?/:needTorrents?/:needImages?', diff --git a/lib/routes/ea/apex-news.ts b/lib/routes/ea/apex-news.ts index c041cb2014..4f75e74ec9 100644 --- a/lib/routes/ea/apex-news.ts +++ b/lib/routes/ea/apex-news.ts @@ -1,9 +1,10 @@ -import { parseDate } from '@/utils/parse-date'; -import { ViewType, type Route, type DataItem } from '@/types'; +import MarkdownIt from 'markdown-it'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import { type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import MarkdownIt from 'markdown-it'; +import { parseDate } from '@/utils/parse-date'; const md = MarkdownIt({ html: true, diff --git a/lib/routes/eagle/blog.ts b/lib/routes/eagle/blog.ts index 08cf75b960..ec897d9b8c 100644 --- a/lib/routes/eagle/blog.ts +++ b/lib/routes/eagle/blog.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { isValidHost } from '@/utils/valid-host'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; + const cateList = new Set(['all', 'design-resources', 'learn-design', 'inside-eagle']); export const route: Route = { diff --git a/lib/routes/eagle/changelog.ts b/lib/routes/eagle/changelog.ts index bcfe5d599e..be577c12c8 100644 --- a/lib/routes/eagle/changelog.ts +++ b/lib/routes/eagle/changelog.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/earthquake/ceic.ts b/lib/routes/earthquake/ceic.ts index 7966962046..b9ad819d35 100644 --- a/lib/routes/earthquake/ceic.ts +++ b/lib/routes/earthquake/ceic.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/earthquake/index.ts b/lib/routes/earthquake/index.ts index 107e9f2887..b9e116de84 100644 --- a/lib/routes/earthquake/index.ts +++ b/lib/routes/earthquake/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/eastday/24.ts b/lib/routes/eastday/24.ts index 297269e05f..6c50ffdabc 100644 --- a/lib/routes/eastday/24.ts +++ b/lib/routes/eastday/24.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; const categories = { 社会: 'shehui', diff --git a/lib/routes/eastday/portrait.ts b/lib/routes/eastday/portrait.ts index b9d1873f71..d68172890f 100644 --- a/lib/routes/eastday/portrait.ts +++ b/lib/routes/eastday/portrait.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/portrait', diff --git a/lib/routes/eastday/sh.ts b/lib/routes/eastday/sh.ts index e79f7a6411..8fdae1aaa9 100644 --- a/lib/routes/eastday/sh.ts +++ b/lib/routes/eastday/sh.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import logger from '@/utils/logger'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/eastmoney/gerenzhongxin/cfh.ts b/lib/routes/eastmoney/gerenzhongxin/cfh.ts index 883f99075f..3fe81e7a92 100644 --- a/lib/routes/eastmoney/gerenzhongxin/cfh.ts +++ b/lib/routes/eastmoney/gerenzhongxin/cfh.ts @@ -1,6 +1,7 @@ -import { Route, ViewType } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/eastmoney/gerenzhongxin/gather.ts b/lib/routes/eastmoney/gerenzhongxin/gather.ts index 79d9505e2a..6bcb5c2b57 100644 --- a/lib/routes/eastmoney/gerenzhongxin/gather.ts +++ b/lib/routes/eastmoney/gerenzhongxin/gather.ts @@ -1,4 +1,5 @@ import { type Route, ViewType } from '@/types'; + import { handler as cfhHandler } from './cfh'; import { handler as gubaHandler } from './guba'; import { handler as trplHandler } from './trpl'; diff --git a/lib/routes/eastmoney/gerenzhongxin/guba.ts b/lib/routes/eastmoney/gerenzhongxin/guba.ts index 082d2d1058..3be927cc84 100644 --- a/lib/routes/eastmoney/gerenzhongxin/guba.ts +++ b/lib/routes/eastmoney/gerenzhongxin/guba.ts @@ -1,6 +1,7 @@ -import { Route, ViewType } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/eastmoney/gerenzhongxin/trpl.ts b/lib/routes/eastmoney/gerenzhongxin/trpl.ts index eadcfe3890..b5e37c73af 100644 --- a/lib/routes/eastmoney/gerenzhongxin/trpl.ts +++ b/lib/routes/eastmoney/gerenzhongxin/trpl.ts @@ -1,8 +1,9 @@ -import { Route, ViewType } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import md5 from '@/utils/md5'; +import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/gerenzhongxin/trpl/:uid', diff --git a/lib/routes/eastmoney/report/index.ts b/lib/routes/eastmoney/report/index.ts index 754a9f056e..b90bce7835 100644 --- a/lib/routes/eastmoney/report/index.ts +++ b/lib/routes/eastmoney/report/index.ts @@ -1,11 +1,15 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { getRatingChangeStr, getEpsOrPeStr } from '../utils'; + +import { getEpsOrPeStr, getRatingChangeStr } from '../utils'; export const route: Route = { path: '/report/:category', diff --git a/lib/routes/eastmoney/search/index.ts b/lib/routes/eastmoney/search/index.ts index 9d0b050098..1b6d122dc3 100644 --- a/lib/routes/eastmoney/search/index.ts +++ b/lib/routes/eastmoney/search/index.ts @@ -1,6 +1,7 @@ -import { Route, ViewType } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/eastmoney/ttjj/user.ts b/lib/routes/eastmoney/ttjj/user.ts index 6d8ce0df35..222c01d5bf 100644 --- a/lib/routes/eastmoney/ttjj/user.ts +++ b/lib/routes/eastmoney/ttjj/user.ts @@ -1,4 +1,5 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/eastmoney/utils.ts b/lib/routes/eastmoney/utils.ts index 008c595fa6..6d040d8e32 100644 --- a/lib/routes/eastmoney/utils.ts +++ b/lib/routes/eastmoney/utils.ts @@ -32,4 +32,4 @@ function getEpsOrPeStr(epsOrPe, keepDecimal) { return EpsOrPeStr; } -export { getRatingChangeStr, getEpsOrPeStr }; +export { getEpsOrPeStr, getRatingChangeStr }; diff --git a/lib/routes/easynomad/joblist.ts b/lib/routes/easynomad/joblist.ts index ddc5549947..51ff8612a6 100644 --- a/lib/routes/easynomad/joblist.ts +++ b/lib/routes/easynomad/joblist.ts @@ -1,11 +1,14 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import MarkdownIt from 'markdown-it'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + const md = MarkdownIt({ html: true, linkify: true, }); -import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/', diff --git a/lib/routes/ebc/realtime.ts b/lib/routes/ebc/realtime.ts index b81aa09a89..0d748f341d 100644 --- a/lib/routes/ebc/realtime.ts +++ b/lib/routes/ebc/realtime.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ecnu/bksy.ts b/lib/routes/ecnu/bksy.ts index 660c310c97..6b31b948bf 100644 --- a/lib/routes/ecnu/bksy.ts +++ b/lib/routes/ecnu/bksy.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ecnu/cee.ts b/lib/routes/ecnu/cee.ts index b6b1d093ec..f32cca255f 100644 --- a/lib/routes/ecnu/cee.ts +++ b/lib/routes/ecnu/cee.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ecnu/contest.ts b/lib/routes/ecnu/contest.ts index 1bf3e211a0..d8b40dc4e7 100644 --- a/lib/routes/ecnu/contest.ts +++ b/lib/routes/ecnu/contest.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + export const route: Route = { path: '/acm/contest/:category?', categories: ['university'], diff --git a/lib/routes/ecnu/cs.ts b/lib/routes/ecnu/cs.ts index 8eae5c9b05..d17599109a 100644 --- a/lib/routes/ecnu/cs.ts +++ b/lib/routes/ecnu/cs.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ecnu/dase.ts b/lib/routes/ecnu/dase.ts index fa212dcdb2..b4db793611 100644 --- a/lib/routes/ecnu/dase.ts +++ b/lib/routes/ecnu/dase.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ecnu/dx.ts b/lib/routes/ecnu/dx.ts index a263f620a0..45ddc286d0 100644 --- a/lib/routes/ecnu/dx.ts +++ b/lib/routes/ecnu/dx.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ecnu/dxb.ts b/lib/routes/ecnu/dxb.ts index c6e8890b11..c7f8c07182 100644 --- a/lib/routes/ecnu/dxb.ts +++ b/lib/routes/ecnu/dxb.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ecnu/ed.ts b/lib/routes/ecnu/ed.ts index c556769fe9..0d420244a4 100644 --- a/lib/routes/ecnu/ed.ts +++ b/lib/routes/ecnu/ed.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ecnu/geoai.ts b/lib/routes/ecnu/geoai.ts index c59d6951f8..e5578ad983 100644 --- a/lib/routes/ecnu/geoai.ts +++ b/lib/routes/ecnu/geoai.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ecnu/ghcollege.ts b/lib/routes/ecnu/ghcollege.ts index 74b3f132ca..3deef4413d 100644 --- a/lib/routes/ecnu/ghcollege.ts +++ b/lib/routes/ecnu/ghcollege.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ecnu/history.ts b/lib/routes/ecnu/history.ts index 9b776c0447..d9eae7a3df 100644 --- a/lib/routes/ecnu/history.ts +++ b/lib/routes/ecnu/history.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ecnu/jwc.ts b/lib/routes/ecnu/jwc.ts index d49e926d49..cc323f252c 100644 --- a/lib/routes/ecnu/jwc.ts +++ b/lib/routes/ecnu/jwc.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ecnu/mxcsy.ts b/lib/routes/ecnu/mxcsy.ts index d51ddf9651..1755a8b040 100644 --- a/lib/routes/ecnu/mxcsy.ts +++ b/lib/routes/ecnu/mxcsy.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ecnu/philo.ts b/lib/routes/ecnu/philo.ts index f9796ee17e..446532cba1 100644 --- a/lib/routes/ecnu/philo.ts +++ b/lib/routes/ecnu/philo.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ecnu/sei.ts b/lib/routes/ecnu/sei.ts index 3f073a985b..2040bd15a0 100644 --- a/lib/routes/ecnu/sei.ts +++ b/lib/routes/ecnu/sei.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ecnu/yjs.ts b/lib/routes/ecnu/yjs.ts index 62078b7fef..d3eb0ca88d 100644 --- a/lib/routes/ecnu/yjs.ts +++ b/lib/routes/ecnu/yjs.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/economist/espresso.ts b/lib/routes/economist/espresso.ts index b80ccdb957..bf1ff7c3e5 100644 --- a/lib/routes/economist/espresso.ts +++ b/lib/routes/economist/espresso.ts @@ -1,11 +1,13 @@ -import { Route, ViewType } from '@/types'; +import * as cheerio from 'cheerio'; +import sanitizeHtml from 'sanitize-html'; +import xxhash from 'xxhash-wasm'; + +import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import * as cheerio from 'cheerio'; -import { config } from '@/config'; import { parseDate } from '@/utils/parse-date'; -import xxhash from 'xxhash-wasm'; -import sanitizeHtml from 'sanitize-html'; const link = 'https://www.economist.com/the-world-in-brief'; diff --git a/lib/routes/economist/full.ts b/lib/routes/economist/full.ts index ee745ec3ad..3e2fd85fb8 100644 --- a/lib/routes/economist/full.ts +++ b/lib/routes/economist/full.ts @@ -1,9 +1,11 @@ -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; -import parser from '@/utils/rss-parser'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import parser from '@/utils/rss-parser'; + const getArticleDetail = (link) => cache.tryGet(link, async () => { const response = await got(link); diff --git a/lib/routes/economist/global-business-review.ts b/lib/routes/economist/global-business-review.ts index dbb37f3df7..8dff9446e7 100644 --- a/lib/routes/economist/global-business-review.ts +++ b/lib/routes/economist/global-business-review.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; diff --git a/lib/routes/ecust/e/news.ts b/lib/routes/ecust/e/news.ts index 285ea71fb4..2b982158f2 100644 --- a/lib/routes/ecust/e/news.ts +++ b/lib/routes/ecust/e/news.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const baseUrl = 'https://e.ecust.edu.cn'; diff --git a/lib/routes/ecust/gschool/yjs.ts b/lib/routes/ecust/gschool/yjs.ts index a67525ba6d..67fef4f094 100644 --- a/lib/routes/ecust/gschool/yjs.ts +++ b/lib/routes/ecust/gschool/yjs.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ecust/jwc/notice.ts b/lib/routes/ecust/jwc/notice.ts index e92a211d04..8aecda512e 100644 --- a/lib/routes/ecust/jwc/notice.ts +++ b/lib/routes/ecust/jwc/notice.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://jwc.ecust.edu.cn'; diff --git a/lib/routes/eeo/kuaixun.ts b/lib/routes/eeo/kuaixun.ts index c404feb314..05da6fefad 100644 --- a/lib/routes/eeo/kuaixun.ts +++ b/lib/routes/eeo/kuaixun.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import { art } from '@/utils/render'; -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; +import path from 'node:path'; import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; -import path from 'node:path'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '50', 10); diff --git a/lib/routes/egsea/flash.ts b/lib/routes/egsea/flash.ts index 09336478fb..8a540461f2 100644 --- a/lib/routes/egsea/flash.ts +++ b/lib/routes/egsea/flash.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/ehentai/ehapi.ts b/lib/routes/ehentai/ehapi.ts index 7753a10bb1..ba9284beaa 100644 --- a/lib/routes/ehentai/ehapi.ts +++ b/lib/routes/ehentai/ehapi.ts @@ -1,9 +1,11 @@ +import path from 'node:path'; + +import { load } from 'cheerio'; + +import { config } from '@/config'; import got from '@/utils/got'; import logger from '@/utils/logger'; import timezone from '@/utils/timezone'; -import { load } from 'cheerio'; -import path from 'node:path'; -import { config } from '@/config'; const headers = {}; const has_cookie = config.ehentai.ipb_member_id && config.ehentai.ipb_pass_hash && config.ehentai.sk; diff --git a/lib/routes/ehentai/favorites.ts b/lib/routes/ehentai/favorites.ts index 14abc9d46d..fe16161c8d 100644 --- a/lib/routes/ehentai/favorites.ts +++ b/lib/routes/ehentai/favorites.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import EhAPI from './ehapi'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; + +import EhAPI from './ehapi'; export const route: Route = { path: '/favorites/:favcat?/:order?/:page?/:routeParams?', diff --git a/lib/routes/ehentai/search.ts b/lib/routes/ehentai/search.ts index f52936925b..81294f6db9 100644 --- a/lib/routes/ehentai/search.ts +++ b/lib/routes/ehentai/search.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; + import EhAPI from './ehapi'; export const route: Route = { diff --git a/lib/routes/ehentai/tag.ts b/lib/routes/ehentai/tag.ts index b5d37229d8..686854cfaf 100644 --- a/lib/routes/ehentai/tag.ts +++ b/lib/routes/ehentai/tag.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; + import EhAPI from './ehapi'; export const route: Route = { diff --git a/lib/routes/ekantipur/issue.ts b/lib/routes/ekantipur/issue.ts index c6797094b0..63181c3f87 100644 --- a/lib/routes/ekantipur/issue.ts +++ b/lib/routes/ekantipur/issue.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; // an HTML parser with a jQuery-like API + +import type { Route } from '@/types'; import cache from '@/utils/cache'; // Require necessary modules import got from '@/utils/got'; // a customised got -import { load } from 'cheerio'; // an HTML parser with a jQuery-like API export const route: Route = { path: '/:channel?', diff --git a/lib/routes/elasticsearch-cn/index.ts b/lib/routes/elasticsearch-cn/index.ts index c95a33c656..4a23f11502 100644 --- a/lib/routes/elasticsearch-cn/index.ts +++ b/lib/routes/elasticsearch-cn/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:params?', diff --git a/lib/routes/elecfans/article.ts b/lib/routes/elecfans/article.ts index 669b34c2c6..b9247e8676 100644 --- a/lib/routes/elecfans/article.ts +++ b/lib/routes/elecfans/article.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/article/:atype', diff --git a/lib/routes/elecfans/soft.ts b/lib/routes/elecfans/soft.ts index 70b38a1ca6..77c0249f82 100644 --- a/lib/routes/elecfans/soft.ts +++ b/lib/routes/elecfans/soft.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/soft/:atype', diff --git a/lib/routes/eleduck/jobs.ts b/lib/routes/eleduck/jobs.ts index f3188bd0fa..fc4d2ee965 100644 --- a/lib/routes/eleduck/jobs.ts +++ b/lib/routes/eleduck/jobs.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/eleduck/posts.ts b/lib/routes/eleduck/posts.ts index df1d94c3c8..2f992e8bc5 100644 --- a/lib/routes/eleduck/posts.ts +++ b/lib/routes/eleduck/posts.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; diff --git a/lib/routes/elsevier/issue.ts b/lib/routes/elsevier/issue.ts index 9a9ee1b3dc..5d7d992c64 100644 --- a/lib/routes/elsevier/issue.ts +++ b/lib/routes/elsevier/issue.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; +import { CookieJar } from 'tough-cookie'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import path from 'node:path'; import { art } from '@/utils/render'; -import { CookieJar } from 'tough-cookie'; const cookieJar = new CookieJar(); export const route: Route = { diff --git a/lib/routes/elsevier/journal.ts b/lib/routes/elsevier/journal.ts index 2784a40c5b..63517fd88b 100644 --- a/lib/routes/elsevier/journal.ts +++ b/lib/routes/elsevier/journal.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; +import { CookieJar } from 'tough-cookie'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import path from 'node:path'; import { art } from '@/utils/render'; -import { CookieJar } from 'tough-cookie'; const cookieJar = new CookieJar(); export const route: Route = { diff --git a/lib/routes/embassy/index.ts b/lib/routes/embassy/index.ts index 8c504f8455..e881792ec2 100644 --- a/lib/routes/embassy/index.ts +++ b/lib/routes/embassy/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import supportedList from './supported-list'; diff --git a/lib/routes/engineering/tag.ts b/lib/routes/engineering/tag.ts index 58b6baa479..cf23dc6e12 100644 --- a/lib/routes/engineering/tag.ts +++ b/lib/routes/engineering/tag.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/tag/:tag', categories: ['programming'], diff --git a/lib/routes/englishhome/index.ts b/lib/routes/englishhome/index.ts index d3f0a09683..6376fc793b 100644 --- a/lib/routes/englishhome/index.ts +++ b/lib/routes/englishhome/index.ts @@ -1,4 +1,4 @@ -import { Route, type Data } from '@/types'; +import type { type Data, Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/enterprisecraftsmanship/index.ts b/lib/routes/enterprisecraftsmanship/index.ts index 135585483f..6774cf3b1f 100644 --- a/lib/routes/enterprisecraftsmanship/index.ts +++ b/lib/routes/enterprisecraftsmanship/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import logger from '@/utils/logger'; import { parseDate } from '@/utils/parse-date'; -import cache from '@/utils/cache'; export const route: Route = { path: '/archives', diff --git a/lib/routes/epicgames/index.ts b/lib/routes/epicgames/index.ts index af9035631a..eb00ad08f4 100644 --- a/lib/routes/epicgames/index.ts +++ b/lib/routes/epicgames/index.ts @@ -1,10 +1,12 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import dayjs from 'dayjs'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import dayjs from 'dayjs'; export const route: Route = { path: '/freegames/:locale?/:country?', diff --git a/lib/routes/eprice/rss.ts b/lib/routes/eprice/rss.ts index cc648f1bda..2d65fc05b9 100644 --- a/lib/routes/eprice/rss.ts +++ b/lib/routes/eprice/rss.ts @@ -1,13 +1,15 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import parser from '@/utils/rss-parser'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; +import parser from '@/utils/rss-parser'; + const allowRegion = new Set(['tw', 'hk']); export const route: Route = { diff --git a/lib/routes/eshukan/academic.ts b/lib/routes/eshukan/academic.ts index 9214a68381..a8493107e5 100644 --- a/lib/routes/eshukan/academic.ts +++ b/lib/routes/eshukan/academic.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 path from 'node:path'; +import timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { id = '1' } = ctx.req.param(); diff --git a/lib/routes/espn/news.ts b/lib/routes/espn/news.ts index 7cdf2840cd..9abe4a9210 100644 --- a/lib/routes/espn/news.ts +++ b/lib/routes/espn/news.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import path from 'node:path'; + +import * as cheerio from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import * as cheerio from 'cheerio'; -import path from 'node:path'; import { art } from '@/utils/render'; const renderMedia = (media) => diff --git a/lib/routes/esquirehk/tag.ts b/lib/routes/esquirehk/tag.ts index f47300b116..05993c8b49 100644 --- a/lib/routes/esquirehk/tag.ts +++ b/lib/routes/esquirehk/tag.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import ofetch from '@/utils/ofetch'; import * as cheerio from 'cheerio'; +import { destr } from 'destr'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { destr } from 'destr'; const topics = new Set(['style', 'watches', 'lifestyle', 'health', 'money-investment', 'gear', 'people', 'watch', 'mens-talk']); diff --git a/lib/routes/europechinese/latest.ts b/lib/routes/europechinese/latest.ts index abb8df4a85..4ac16222a1 100644 --- a/lib/routes/europechinese/latest.ts +++ b/lib/routes/europechinese/latest.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; diff --git a/lib/routes/eventbrite/events.ts b/lib/routes/eventbrite/events.ts index bedc5a6807..f9c99ef7c7 100644 --- a/lib/routes/eventbrite/events.ts +++ b/lib/routes/eventbrite/events.ts @@ -1,9 +1,10 @@ +import { load } from 'cheerio'; +import type { Context } from 'hono'; + import type { Data, DataItem, Route } from '@/types'; import { toTitleCase } from '@/utils/common-utils'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; -import type { Context } from 'hono'; export const route: Route = { path: '/:region/:eventType?/:includePromoted?', diff --git a/lib/routes/eventernote/actors.ts b/lib/routes/eventernote/actors.ts index b44739e63c..d7178d9639 100644 --- a/lib/routes/eventernote/actors.ts +++ b/lib/routes/eventernote/actors.ts @@ -1,7 +1,8 @@ -import { type DataItem, type Route, ViewType } from '@/types'; -import type { Context } from 'hono'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import { type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; const dateStringRegex = /(?\d{4})-(?\d{2})-(?\d{2})/; const timeStringRegexes = [ diff --git a/lib/routes/everia/article.ts b/lib/routes/everia/article.ts index 0d3fb20643..eab88176f9 100644 --- a/lib/routes/everia/article.ts +++ b/lib/routes/everia/article.ts @@ -1,4 +1,5 @@ import { load } from 'cheerio'; + import got from '@/utils/got'; async function loadArticle(link) { diff --git a/lib/routes/everia/category.ts b/lib/routes/everia/category.ts index d3e2e7f3fa..f4e6182e42 100644 --- a/lib/routes/everia/category.ts +++ b/lib/routes/everia/category.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + import loadArticle from './article'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; export const route: Route = { path: '/category/:category', diff --git a/lib/routes/everia/latest.ts b/lib/routes/everia/latest.ts index 9cb958335d..48c8898ab0 100644 --- a/lib/routes/everia/latest.ts +++ b/lib/routes/everia/latest.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + import loadArticle from './article'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; export const route: Route = { path: '/', diff --git a/lib/routes/everia/search.ts b/lib/routes/everia/search.ts index 95655a4cea..5e8750031f 100644 --- a/lib/routes/everia/search.ts +++ b/lib/routes/everia/search.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + import loadArticle from './article'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; export const route: Route = { path: '/search/:keyword', diff --git a/lib/routes/everia/tag.ts b/lib/routes/everia/tag.ts index e14585ecf1..a3d008b5bd 100644 --- a/lib/routes/everia/tag.ts +++ b/lib/routes/everia/tag.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { SUB_NAME_PREFIX, SUB_URL } from './const'; + import loadArticle from './article'; +import { SUB_NAME_PREFIX, SUB_URL } from './const'; export const route: Route = { path: '/tag/:tag', diff --git a/lib/routes/expats/czech-news.ts b/lib/routes/expats/czech-news.ts index 4f39637bc5..b4a9146ff4 100644 --- a/lib/routes/expats/czech-news.ts +++ b/lib/routes/expats/czech-news.ts @@ -1,13 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const { category = 'daily-news' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/f-droid/apprelease.ts b/lib/routes/f-droid/apprelease.ts index 070e2f97a9..227a28eab9 100644 --- a/lib/routes/f-droid/apprelease.ts +++ b/lib/routes/f-droid/apprelease.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import * as cheerio from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/famitsu/category.ts b/lib/routes/famitsu/category.ts index 4cb7ac525f..aea7bfe936 100644 --- a/lib/routes/famitsu/category.ts +++ b/lib/routes/famitsu/category.ts @@ -1,12 +1,15 @@ -import { Route } from '@/types'; +import path from 'node:path'; + +import * as cheerio from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import * as cheerio from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { config } from '@/config'; -import { ArticleDetail, Category, CategoryArticle } from './types'; + +import type { ArticleDetail, Category, CategoryArticle } from './types'; const baseUrl = 'https://www.famitsu.com'; diff --git a/lib/routes/fanbox/index.ts b/lib/routes/fanbox/index.ts index 89a1a19fae..e4cbeec3b9 100644 --- a/lib/routes/fanbox/index.ts +++ b/lib/routes/fanbox/index.ts @@ -1,10 +1,12 @@ +import type { Context } from 'hono'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; import type { Data, Route } from '@/types'; -import { isValidHost } from '@/utils/valid-host'; -import type { Context } from 'hono'; -import { getHeaders, parseItem } from './utils'; -import type { PostListResponse, UserInfoResponse } from './types'; import ofetch from '@/utils/ofetch'; +import { isValidHost } from '@/utils/valid-host'; + +import type { PostListResponse, UserInfoResponse } from './types'; +import { getHeaders, parseItem } from './utils'; export const route: Route = { path: '/:creator', diff --git a/lib/routes/fanbox/utils.ts b/lib/routes/fanbox/utils.ts index 5600b11c20..b346d6b865 100644 --- a/lib/routes/fanbox/utils.ts +++ b/lib/routes/fanbox/utils.ts @@ -1,11 +1,13 @@ +import path from 'node:path'; + import { config } from '@/config'; import type { DataItem } from '@/types'; -import ofetch from '@/utils/ofetch'; -import type { ArticlePost, FilePost, ImagePost, PostDetailResponse, PostItem, TextPost, VideoPost } from './types'; -import { parseDate } from '@/utils/parse-date'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; + +import type { ArticlePost, FilePost, ImagePost, PostDetailResponse, PostItem, TextPost, VideoPost } from './types'; export function getHeaders() { const sessionid = config.fanbox.session; diff --git a/lib/routes/fangchan/list.ts b/lib/routes/fangchan/list.ts index f5bc6325d4..cfded31d3e 100644 --- a/lib/routes/fangchan/list.ts +++ b/lib/routes/fangchan/list.ts @@ -1,16 +1,16 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; - export const handler = async (ctx: Context): Promise => { const { id = 'datalist' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/fanqienovel/page.ts b/lib/routes/fanqienovel/page.ts index 91c63326e2..58bc7e73e4 100644 --- a/lib/routes/fanqienovel/page.ts +++ b/lib/routes/fanqienovel/page.ts @@ -1,7 +1,8 @@ -import type { Data, Route } from '@/types'; -import type { Context } from 'hono'; -import ofetch from '@/utils/ofetch'; import * as cheerio from 'cheerio'; +import type { Context } from 'hono'; + +import type { Data, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; interface Chapter { diff --git a/lib/routes/fansly/post.ts b/lib/routes/fansly/post.ts index a62fb53b6b..bb41701a18 100644 --- a/lib/routes/fansly/post.ts +++ b/lib/routes/fansly/post.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; -import { getAccountByUsername, getTimelineByAccountId, parseDescription, baseUrl } from './utils'; + +import { baseUrl, getAccountByUsername, getTimelineByAccountId, parseDescription } from './utils'; export const route: Route = { path: '/user/:username', diff --git a/lib/routes/fansly/tag.ts b/lib/routes/fansly/tag.ts index 89444c104b..bed607760a 100644 --- a/lib/routes/fansly/tag.ts +++ b/lib/routes/fansly/tag.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; -import { getTagId, getTagSuggestion, findAccountById, parseDescription, baseUrl, icon } from './utils'; + +import { baseUrl, findAccountById, getTagId, getTagSuggestion, icon, parseDescription } from './utils'; export const route: Route = { path: '/tag/:tag', diff --git a/lib/routes/fansly/utils.ts b/lib/routes/fansly/utils.ts index cb58ff59b9..7d35ce46a5 100644 --- a/lib/routes/fansly/utils.ts +++ b/lib/routes/fansly/utils.ts @@ -1,8 +1,9 @@ -import got from '@/utils/got'; import path from 'node:path'; -import { art } from '@/utils/render'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; const apiBaseUrl = 'https://apiv3.fansly.com'; const baseUrl = 'https://fansly.com'; @@ -161,4 +162,4 @@ const renderTipGoal = (tipGoalId, tipGoals) => { }); }; -export { findAccountById, baseUrl, icon, getAccountByUsername, getTimelineByAccountId, getTagId, getTagSuggestion, parseAttachments, parseDescription, parseMedia, renderMedia, renderPoll, renderTipGoal }; +export { baseUrl, findAccountById, getAccountByUsername, getTagId, getTagSuggestion, getTimelineByAccountId, icon, parseAttachments, parseDescription, parseMedia, renderMedia, renderPoll, renderTipGoal }; diff --git a/lib/routes/fantia/search.ts b/lib/routes/fantia/search.ts index 432cca1f43..77d71cc961 100644 --- a/lib/routes/fantia/search.ts +++ b/lib/routes/fantia/search.ts @@ -1,7 +1,8 @@ -import { Route, ViewType } from '@/types'; +import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; export const route: Route = { path: '/search/:type?/:caty?/:period?/:order?/:rating?/:keyword?', diff --git a/lib/routes/fantia/user.ts b/lib/routes/fantia/user.ts index 4f720a9436..f723e18f49 100644 --- a/lib/routes/fantia/user.ts +++ b/lib/routes/fantia/user.ts @@ -1,8 +1,9 @@ -import { Route, ViewType } from '@/types'; +import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; export const route: Route = { path: '/user/:id', diff --git a/lib/routes/fantube/creator.ts b/lib/routes/fantube/creator.ts index 9b457de26e..dc49ec7cee 100644 --- a/lib/routes/fantube/creator.ts +++ b/lib/routes/fantube/creator.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import { getCreatorFragment, getCreatorPostReelList, baseUrl } from './utils'; import path from 'node:path'; + +import type { Route } from '@/types'; +import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; +import { baseUrl, getCreatorFragment, getCreatorPostReelList } from './utils'; + export const route: Route = { path: '/r18/creator/:identifier', categories: ['multimedia'], diff --git a/lib/routes/fantube/utils.ts b/lib/routes/fantube/utils.ts index 5223609c2e..bd303aec82 100644 --- a/lib/routes/fantube/utils.ts +++ b/lib/routes/fantube/utils.ts @@ -1,7 +1,9 @@ -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + import cache from '@/utils/cache'; -import { CreatorFragment, PostReelNode } from './types'; +import ofetch from '@/utils/ofetch'; + +import type { CreatorFragment, PostReelNode } from './types'; export const baseUrl = 'https://www.fantube.tokyo'; diff --git a/lib/routes/fanxinzhui/index.ts b/lib/routes/fanxinzhui/index.ts index 44a77a458c..93b9bad32d 100644 --- a/lib/routes/fanxinzhui/index.ts +++ b/lib/routes/fanxinzhui/index.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/', diff --git a/lib/routes/farcaster/user.ts b/lib/routes/farcaster/user.ts index f5c5a63d78..646edb57e1 100644 --- a/lib/routes/farcaster/user.ts +++ b/lib/routes/farcaster/user.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/farmatters/index.ts b/lib/routes/farmatters/index.ts index c69c947974..3da082383d 100644 --- a/lib/routes/farmatters/index.ts +++ b/lib/routes/farmatters/index.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; +import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import MarkdownIt from 'markdown-it'; +import timezone from '@/utils/timezone'; + const md = MarkdownIt({ html: true, }); diff --git a/lib/routes/fashionnetwork/index.ts b/lib/routes/fashionnetwork/index.ts index 02c9ffc90a..e4d2498467 100644 --- a/lib/routes/fashionnetwork/index.ts +++ b/lib/routes/fashionnetwork/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 path from 'node:path'; +import timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { id = '0' } = ctx.req.param(); diff --git a/lib/routes/fastbull/express-news.ts b/lib/routes/fastbull/express-news.ts index fe101ffede..0cfffe2b57 100644 --- a/lib/routes/fastbull/express-news.ts +++ b/lib/routes/fastbull/express-news.ts @@ -1,6 +1,8 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/fastbull/news.ts b/lib/routes/fastbull/news.ts index 4e7eef638b..99b9d0ecf3 100644 --- a/lib/routes/fastbull/news.ts +++ b/lib/routes/fastbull/news.ts @@ -1,11 +1,13 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/news', diff --git a/lib/routes/fda/cdrh.ts b/lib/routes/fda/cdrh.ts index 680af61739..32c1b4d1d6 100644 --- a/lib/routes/fda/cdrh.ts +++ b/lib/routes/fda/cdrh.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/fediverse/timeline.ts b/lib/routes/fediverse/timeline.ts index 109d24b1bf..9d72a80b36 100644 --- a/lib/routes/fediverse/timeline.ts +++ b/lib/routes/fediverse/timeline.ts @@ -1,10 +1,10 @@ -import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { Route, ViewType } from '@/types'; - -import { parseDate } from '@/utils/parse-date'; -import ofetch from '@/utils/ofetch'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import parser from '@/utils/rss-parser'; export const route: Route = { diff --git a/lib/routes/feng/forum.ts b/lib/routes/feng/forum.ts index 1c516c720b..4e23c9d61f 100644 --- a/lib/routes/feng/forum.ts +++ b/lib/routes/feng/forum.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; - -import { parseDate } from '@/utils/parse-date'; -import { baseUrl, getForumMeta, getThreads, getThread } from './utils'; -import { art } from '@/utils/render'; import path from 'node:path'; +import type { Route } from '@/types'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + +import { baseUrl, getForumMeta, getThread, getThreads } from './utils'; + export const route: Route = { path: '/forum/:id/:type?', categories: ['bbs'], diff --git a/lib/routes/feng/utils.ts b/lib/routes/feng/utils.ts index ff0d26a184..f640e84dcd 100644 --- a/lib/routes/feng/utils.ts +++ b/lib/routes/feng/utils.ts @@ -1,7 +1,9 @@ -import cache from '@/utils/cache'; import CryptoJS from 'crypto-js'; -import got from '@/utils/got'; + import { config } from '@/config'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + const apiUrl = 'https://api.wfdata.club'; const baseUrl = 'https://www.feng.com'; const KEY = '2b7e151628aed2a6'; @@ -73,4 +75,4 @@ const getThread = (tid, topicId) => { }); }; -export { baseUrl, getForumMeta, getThreads, getThread }; +export { baseUrl, getForumMeta, getThread, getThreads }; diff --git a/lib/routes/ff14/ff14-global.ts b/lib/routes/ff14/ff14-global.ts index a75fc37142..c7eb127b6d 100644 --- a/lib/routes/ff14/ff14-global.ts +++ b/lib/routes/ff14/ff14-global.ts @@ -1,11 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; import { isValidHost } from '@/utils/valid-host'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; export const route: Route = { path: ['/global/:lang/:type?', '/ff14_global/:lang/:type?'], diff --git a/lib/routes/ff14/ff14-zh.ts b/lib/routes/ff14/ff14-zh.ts index 26f88cb17b..941c86c291 100644 --- a/lib/routes/ff14/ff14-zh.ts +++ b/lib/routes/ff14/ff14-zh.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: ['/zh/:type?', '/ff14_zh/:type?'], diff --git a/lib/routes/fffdm/manhua/manhua.ts b/lib/routes/fffdm/manhua/manhua.ts index f5a2b0f562..cdd460b0ab 100644 --- a/lib/routes/fffdm/manhua/manhua.ts +++ b/lib/routes/fffdm/manhua/manhua.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + const domain = 'manhua.fffdm.com'; const host = `https://${domain}`; -import { art } from '@/utils/render'; -import path from 'node:path'; -import { parseDate } from '@/utils/parse-date'; const get_pic = async (url) => { const response = await got(url); diff --git a/lib/routes/finology/bullets.ts b/lib/routes/finology/bullets.ts index 5d680005d4..322acd5bfc 100644 --- a/lib/routes/finology/bullets.ts +++ b/lib/routes/finology/bullets.ts @@ -1,7 +1,9 @@ -import { Data, Route, ViewType } from '@/types'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Data, Route} from '@/types'; +import { ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/bullets', diff --git a/lib/routes/finology/category.ts b/lib/routes/finology/category.ts index 5f913d2441..2e50180fb1 100644 --- a/lib/routes/finology/category.ts +++ b/lib/routes/finology/category.ts @@ -1,7 +1,9 @@ -import { Data, Route } from '@/types'; -import { getItems } from './utils'; import type { Context } from 'hono'; +import type { Data, Route } from '@/types'; + +import { getItems } from './utils'; + export const route: Route = { path: '/category/:category', categories: ['finance'], diff --git a/lib/routes/finology/most-viewed.ts b/lib/routes/finology/most-viewed.ts index c66f079fe7..f89b9b4d46 100644 --- a/lib/routes/finology/most-viewed.ts +++ b/lib/routes/finology/most-viewed.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { commonHandler } from './category'; export const route: Route = { diff --git a/lib/routes/finology/tag.ts b/lib/routes/finology/tag.ts index 5c9ce51b72..418cb39943 100644 --- a/lib/routes/finology/tag.ts +++ b/lib/routes/finology/tag.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import { commonHandler } from './category'; import type { Context } from 'hono'; +import type { Route } from '@/types'; + +import { commonHandler } from './category'; + export const route: Route = { path: '/tag/:topic', categories: ['finance'], diff --git a/lib/routes/finology/utils.ts b/lib/routes/finology/utils.ts index d2e64a3d80..746df215f3 100644 --- a/lib/routes/finology/utils.ts +++ b/lib/routes/finology/utils.ts @@ -1,9 +1,10 @@ -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { DataItem } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import ofetch from '@/utils/ofetch'; -import { DataItem } from '@/types'; const getItems = async (url: string, extra: { date: boolean; selector: string }) => { const mainUrl = 'https://insider.finology.in'; diff --git a/lib/routes/finviz/news.ts b/lib/routes/finviz/news.ts index a75311d2de..434dc37316 100644 --- a/lib/routes/finviz/news.ts +++ b/lib/routes/finviz/news.ts @@ -1,9 +1,11 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; -import { parseDate } from '@/utils/parse-date'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const categories = { news: 0, diff --git a/lib/routes/finviz/quote.ts b/lib/routes/finviz/quote.ts index b4edc586e8..6e951e1958 100644 --- a/lib/routes/finviz/quote.ts +++ b/lib/routes/finviz/quote.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/firecore/index.ts b/lib/routes/firecore/index.ts index b1083914ce..5ea112fb73 100644 --- a/lib/routes/firecore/index.ts +++ b/lib/routes/firecore/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/firefox/addons.ts b/lib/routes/firefox/addons.ts index 8f9bcc0218..993cabdd8a 100644 --- a/lib/routes/firefox/addons.ts +++ b/lib/routes/firefox/addons.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/addons/:id', categories: ['program-update'], diff --git a/lib/routes/firefox/breaches.ts b/lib/routes/firefox/breaches.ts index 0a565cbbc4..5894e772e5 100644 --- a/lib/routes/firefox/breaches.ts +++ b/lib/routes/firefox/breaches.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/firefox/release.ts b/lib/routes/firefox/release.ts index fdc05936aa..96b5c14954 100644 --- a/lib/routes/firefox/release.ts +++ b/lib/routes/firefox/release.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const platformSlugs = { diff --git a/lib/routes/fisher-spb/news.ts b/lib/routes/fisher-spb/news.ts index 24278646fd..057aafce8f 100644 --- a/lib/routes/fisher-spb/news.ts +++ b/lib/routes/fisher-spb/news.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/news', diff --git a/lib/routes/fishshell/index.ts b/lib/routes/fishshell/index.ts index c1a1bbb5ef..9c6450fd3f 100644 --- a/lib/routes/fishshell/index.ts +++ b/lib/routes/fishshell/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; -import got from '@/utils/got'; + import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/fjksbm/index.ts b/lib/routes/fjksbm/index.ts index da87a6f52d..364ed25b88 100644 --- a/lib/routes/fjksbm/index.ts +++ b/lib/routes/fjksbm/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/flashcat/blog.ts b/lib/routes/flashcat/blog.ts index 10f7dd2287..8c01e75106 100644 --- a/lib/routes/flashcat/blog.ts +++ b/lib/routes/flashcat/blog.ts @@ -1,6 +1,7 @@ -import { Route, Data } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Data, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/flyert/creditcard.ts b/lib/routes/flyert/creditcard.ts index 7a2e2f1b80..ea92ab34e4 100644 --- a/lib/routes/flyert/creditcard.ts +++ b/lib/routes/flyert/creditcard.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import util from './utils'; -import iconv from 'iconv-lite'; const gbk2utf8 = (s) => iconv.decode(s, 'gbk'); const host = 'https://www.flyert.com.cn'; diff --git a/lib/routes/flyert/forum.ts b/lib/routes/flyert/forum.ts index 8184b41500..670a9d57ff 100644 --- a/lib/routes/flyert/forum.ts +++ b/lib/routes/flyert/forum.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import iconv from 'iconv-lite'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import iconv from 'iconv-lite'; -import { load } from 'cheerio'; -import { rootUrl, parseArticleList, parsePostList, parseArticle, parsePost } from './util'; + +import { parseArticle, parseArticleList, parsePost, parsePostList, rootUrl } from './util'; export const handler = async (ctx) => { const { params } = ctx.req.param(); diff --git a/lib/routes/flyert/preferential.ts b/lib/routes/flyert/preferential.ts index 06f5a15159..4757890937 100644 --- a/lib/routes/flyert/preferential.ts +++ b/lib/routes/flyert/preferential.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/flyert/util.ts b/lib/routes/flyert/util.ts index 02feb1036c..dea3b16a9c 100644 --- a/lib/routes/flyert/util.ts +++ b/lib/routes/flyert/util.ts @@ -1,8 +1,10 @@ -import { CheerioAPI } from 'cheerio'; -import timezone from '@/utils/timezone'; +import path from 'node:path'; + +import type { CheerioAPI } from 'cheerio'; + import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; const rootUrl = 'https://www.flyert.com.cn'; @@ -182,4 +184,4 @@ const parsePost = ($$: CheerioAPI, item) => { return item; }; -export { rootUrl, parseArticleList, parsePostList, parseArticle, parsePost }; +export { parseArticle, parseArticleList, parsePost, parsePostList, rootUrl }; diff --git a/lib/routes/flyert/utils.ts b/lib/routes/flyert/utils.ts index 6a2303dc41..8502f150e0 100644 --- a/lib/routes/flyert/utils.ts +++ b/lib/routes/flyert/utils.ts @@ -1,7 +1,8 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; import pMap from 'p-map'; + +import got from '@/utils/got'; import wait from '@/utils/wait'; const gbk2utf8 = (s) => iconv.decode(s, 'gbk'); diff --git a/lib/routes/focustaiwan/index.ts b/lib/routes/focustaiwan/index.ts index 46c8ca5e55..d8b8615f7f 100644 --- a/lib/routes/focustaiwan/index.ts +++ b/lib/routes/focustaiwan/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import path from 'node:path'; +import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; -import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/follow/profile.ts b/lib/routes/follow/profile.ts index c0e422878e..c0434b25e0 100644 --- a/lib/routes/follow/profile.ts +++ b/lib/routes/follow/profile.ts @@ -1,9 +1,11 @@ -import { ViewType, type Data, type Route } from '@/types'; import type { Context } from 'hono'; -import ofetch from '@/utils/ofetch'; -import type { FeedSubscription, FollowResponse, InboxSubscription, ListSubscription, Profile, Subscription } from './types'; import { parse } from 'tldts'; +import { type Data, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; + +import type { FeedSubscription, FollowResponse, InboxSubscription, ListSubscription, Profile, Subscription } from './types'; + export const route: Route = { name: 'User subscriptions', categories: ['social-media'], diff --git a/lib/routes/followin/index.ts b/lib/routes/followin/index.ts index 2ef59c3dce..055cd8bfcb 100644 --- a/lib/routes/followin/index.ts +++ b/lib/routes/followin/index.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { apiUrl, favicon, getBParam, getBuildId, getGToken, parseList, parseItem } from './utils'; + +import { apiUrl, favicon, getBParam, getBuildId, getGToken, parseItem, parseList } from './utils'; export const route: Route = { path: '/:categoryId?/:lang?', diff --git a/lib/routes/followin/kol.ts b/lib/routes/followin/kol.ts index 5fc3855112..83b5ab69f7 100644 --- a/lib/routes/followin/kol.ts +++ b/lib/routes/followin/kol.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { baseUrl, getBuildId, parseList, parseItem } from './utils'; + +import { baseUrl, getBuildId, parseItem, parseList } from './utils'; export const route: Route = { path: '/kol/:kolId/:lang?', diff --git a/lib/routes/followin/news.ts b/lib/routes/followin/news.ts index 27b0f004ec..1ae433a732 100644 --- a/lib/routes/followin/news.ts +++ b/lib/routes/followin/news.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { baseUrl, favicon, getBuildId, parseList, parseItem } from './utils'; + +import { baseUrl, favicon, getBuildId, parseItem, parseList } from './utils'; export const route: Route = { path: '/news/:lang?', diff --git a/lib/routes/followin/tag.ts b/lib/routes/followin/tag.ts index 7840de2d53..7d277f3f07 100644 --- a/lib/routes/followin/tag.ts +++ b/lib/routes/followin/tag.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { apiUrl, baseUrl, getBParam, getBuildId, getGToken, parseList, parseItem } from './utils'; + +import { apiUrl, baseUrl, getBParam, getBuildId, getGToken, parseItem, parseList } from './utils'; export const route: Route = { path: '/tag/:tagId/:lang?', diff --git a/lib/routes/followin/topic.ts b/lib/routes/followin/topic.ts index 3c4960f0f0..3d3938a469 100644 --- a/lib/routes/followin/topic.ts +++ b/lib/routes/followin/topic.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { baseUrl, getBuildId, parseList, parseItem } from './utils'; + +import { baseUrl, getBuildId, parseItem, parseList } from './utils'; export const route: Route = { path: '/topic/:topicId/:lang?', diff --git a/lib/routes/followin/utils.ts b/lib/routes/followin/utils.ts index 24e4e21e8d..1f210423ab 100644 --- a/lib/routes/followin/utils.ts +++ b/lib/routes/followin/utils.ts @@ -1,10 +1,12 @@ -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + const apiUrl = 'https://api.followin.io'; const baseUrl = 'https://followin.io'; const favicon = `${baseUrl}/favicon.ico`; @@ -70,4 +72,4 @@ const parseItem = (item, tryGet) => return item; }); -export { apiUrl, baseUrl, favicon, getBParam, getBuildId, getGToken, parseList, parseItem }; +export { apiUrl, baseUrl, favicon, getBParam, getBuildId, getGToken, parseItem, parseList }; diff --git a/lib/routes/foodtalks/index.ts b/lib/routes/foodtalks/index.ts index 9a9454286e..0ea4f240e7 100644 --- a/lib/routes/foodtalks/index.ts +++ b/lib/routes/foodtalks/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { namespace } from './namespace'; import logger from '@/utils/logger'; +import ofetch from '@/utils/ofetch'; + +import { namespace } from './namespace'; export const route: Route = { path: '/', diff --git a/lib/routes/foreignaffairs/rss.ts b/lib/routes/foreignaffairs/rss.ts index 4649d38c5f..274a8ae492 100644 --- a/lib/routes/foreignaffairs/rss.ts +++ b/lib/routes/foreignaffairs/rss.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import parser from '@/utils/rss-parser'; -import { load } from 'cheerio'; export const route: Route = { path: '/rss', diff --git a/lib/routes/foresightnews/article.ts b/lib/routes/foresightnews/article.ts index d9798ab392..7cebf0f7d5 100644 --- a/lib/routes/foresightnews/article.ts +++ b/lib/routes/foresightnews/article.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; -import { rootUrl, apiRootUrl, processItems, icon, image } from './util'; +import type { Route } from '@/types'; + +import { apiRootUrl, icon, image, processItems, rootUrl } from './util'; export const route: Route = { path: '/article', diff --git a/lib/routes/foresightnews/column.ts b/lib/routes/foresightnews/column.ts index 04074ccfae..47f68d20a6 100644 --- a/lib/routes/foresightnews/column.ts +++ b/lib/routes/foresightnews/column.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; -import { rootUrl, apiRootUrl, processItems, icon, image } from './util'; +import type { Route } from '@/types'; + +import { apiRootUrl, icon, image, processItems, rootUrl } from './util'; export const route: Route = { path: '/column/:id', diff --git a/lib/routes/foresightnews/index.ts b/lib/routes/foresightnews/index.ts index 782340f7c1..3c9cbad9be 100644 --- a/lib/routes/foresightnews/index.ts +++ b/lib/routes/foresightnews/index.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; -import { rootUrl, apiRootUrl, processItems, icon, image } from './util'; +import type { Route } from '@/types'; + +import { apiRootUrl, icon, image, processItems, rootUrl } from './util'; export const route: Route = { path: '/', diff --git a/lib/routes/foresightnews/news.ts b/lib/routes/foresightnews/news.ts index e5587f0327..563de1150e 100644 --- a/lib/routes/foresightnews/news.ts +++ b/lib/routes/foresightnews/news.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; -import { rootUrl, apiRootUrl, processItems, icon, image } from './util'; +import type { Route } from '@/types'; + +import { apiRootUrl, icon, image, processItems, rootUrl } from './util'; export const route: Route = { path: '/news', diff --git a/lib/routes/foresightnews/util.ts b/lib/routes/foresightnews/util.ts index eec4ebebf3..17e3c19d78 100644 --- a/lib/routes/foresightnews/util.ts +++ b/lib/routes/foresightnews/util.ts @@ -1,8 +1,9 @@ +import path from 'node:path'; +import zlib from 'node:zlib'; + import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import zlib from 'node:zlib'; const constants = { labelHot: '热门', @@ -82,4 +83,4 @@ const processItems = async (apiUrl, limit, ...parameters) => { return { items, info }; }; -export { icon, image, rootUrl, apiRootUrl, imgRootUrl, processItems }; +export { apiRootUrl, icon, image, imgRootUrl, processItems, rootUrl }; diff --git a/lib/routes/foreverblog/feeds.ts b/lib/routes/foreverblog/feeds.ts index 39d911344a..a3bc2918b7 100644 --- a/lib/routes/foreverblog/feeds.ts +++ b/lib/routes/foreverblog/feeds.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/forklog/index.ts b/lib/routes/forklog/index.ts index 63ea7fd387..0c2c2d4d1e 100644 --- a/lib/routes/forklog/index.ts +++ b/lib/routes/forklog/index.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Route } from '@/types'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/fortnite/news.ts b/lib/routes/fortnite/news.ts index 99022f6a8b..057831f577 100644 --- a/lib/routes/fortnite/news.ts +++ b/lib/routes/fortnite/news.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; import logger from '@/utils/logger'; +import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; export const route: Route = { diff --git a/lib/routes/fortunechina/index.ts b/lib/routes/fortunechina/index.ts index 32bcebff01..f5cc29699d 100644 --- a/lib/routes/fortunechina/index.ts +++ b/lib/routes/fortunechina/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate, parseRelativeDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import { PRESETS } from '@/utils/header-generator'; +import ofetch from '@/utils/ofetch'; +import { parseDate, parseRelativeDate } from '@/utils/parse-date'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/fosshub/index.ts b/lib/routes/fosshub/index.ts index 4870daacdd..bb71f52df4 100644 --- a/lib/routes/fosshub/index.ts +++ b/lib/routes/fosshub/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:id', diff --git a/lib/routes/free/rss.ts b/lib/routes/free/rss.ts index b3d3f9fc72..70842032e0 100644 --- a/lib/routes/free/rss.ts +++ b/lib/routes/free/rss.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Route } from '@/types'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/', diff --git a/lib/routes/freebuf/index.ts b/lib/routes/freebuf/index.ts index a80637cd66..e3c0b0721d 100644 --- a/lib/routes/freebuf/index.ts +++ b/lib/routes/freebuf/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/freecomputerbooks/index.ts b/lib/routes/freecomputerbooks/index.ts index e8de3825de..96fb249d53 100644 --- a/lib/routes/freecomputerbooks/index.ts +++ b/lib/routes/freecomputerbooks/index.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; -import { load } from 'cheerio'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { art } from '@/utils/render'; diff --git a/lib/routes/freewechat/profile.ts b/lib/routes/freewechat/profile.ts index 836a004065..6fb1dbdc26 100644 --- a/lib/routes/freewechat/profile.ts +++ b/lib/routes/freewechat/profile.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; import { fixArticleContent } from '@/utils/wechat-mp'; -import { config } from '@/config'; + const baseUrl = 'https://freewechat.com'; export const route: Route = { diff --git a/lib/routes/freexcomic/book.ts b/lib/routes/freexcomic/book.ts index 068904eeed..a6d62d83a2 100644 --- a/lib/routes/freexcomic/book.ts +++ b/lib/routes/freexcomic/book.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import * as cheerio from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; const jjmhw = 'http://www.jjmhw.cc'; diff --git a/lib/routes/ft/myft.ts b/lib/routes/ft/myft.ts index 1d36e2a7fc..236b2b8f53 100644 --- a/lib/routes/ft/myft.ts +++ b/lib/routes/ft/myft.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import parser from '@/utils/rss-parser'; -import { load } from 'cheerio'; export const route: Route = { path: '/myft/:key', diff --git a/lib/routes/ftchinese/channel.ts b/lib/routes/ftchinese/channel.ts index fb6bcb22a2..e2f1a88cdc 100644 --- a/lib/routes/ftchinese/channel.ts +++ b/lib/routes/ftchinese/channel.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/ftchinese/utils.ts b/lib/routes/ftchinese/utils.ts index ce42eb7e8d..9ce5be2469 100644 --- a/lib/routes/ftchinese/utils.ts +++ b/lib/routes/ftchinese/utils.ts @@ -1,7 +1,8 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; import parser from '@/utils/rss-parser'; -import { load } from 'cheerio'; const ProcessFeed = (i, $, link) => { const title = $('h1').text(); diff --git a/lib/routes/ftm/index.ts b/lib/routes/ftm/index.ts index c840337892..408131eb11 100644 --- a/lib/routes/ftm/index.ts +++ b/lib/routes/ftm/index.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; - import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/', diff --git a/lib/routes/fuliba/latest.ts b/lib/routes/fuliba/latest.ts index a5df4df6d6..de117786aa 100644 --- a/lib/routes/fuliba/latest.ts +++ b/lib/routes/fuliba/latest.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/furaffinity/art.ts b/lib/routes/furaffinity/art.ts index fe4260454a..31c6b2d989 100644 --- a/lib/routes/furaffinity/art.ts +++ b/lib/routes/furaffinity/art.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/furaffinity/browse.ts b/lib/routes/furaffinity/browse.ts index 81c9009bf5..8ab9930128 100644 --- a/lib/routes/furaffinity/browse.ts +++ b/lib/routes/furaffinity/browse.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/furaffinity/commissions.ts b/lib/routes/furaffinity/commissions.ts index 6a8067c677..b2f11db93f 100644 --- a/lib/routes/furaffinity/commissions.ts +++ b/lib/routes/furaffinity/commissions.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/furaffinity/home.ts b/lib/routes/furaffinity/home.ts index a8aaf9e677..63cc0fab75 100644 --- a/lib/routes/furaffinity/home.ts +++ b/lib/routes/furaffinity/home.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/furaffinity/journal-comments.ts b/lib/routes/furaffinity/journal-comments.ts index 70495dea6d..0fd40d71bb 100644 --- a/lib/routes/furaffinity/journal-comments.ts +++ b/lib/routes/furaffinity/journal-comments.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/furaffinity/journals.ts b/lib/routes/furaffinity/journals.ts index 98d59234aa..2dea98ac15 100644 --- a/lib/routes/furaffinity/journals.ts +++ b/lib/routes/furaffinity/journals.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/furaffinity/search.ts b/lib/routes/furaffinity/search.ts index 21c722b11a..2fabc24d97 100644 --- a/lib/routes/furaffinity/search.ts +++ b/lib/routes/furaffinity/search.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/furaffinity/shouts.ts b/lib/routes/furaffinity/shouts.ts index 6fd539ca60..043055bc7a 100644 --- a/lib/routes/furaffinity/shouts.ts +++ b/lib/routes/furaffinity/shouts.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/furaffinity/status.ts b/lib/routes/furaffinity/status.ts index b4554fb91c..e9dc5041fc 100644 --- a/lib/routes/furaffinity/status.ts +++ b/lib/routes/furaffinity/status.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/furaffinity/submission-comments.ts b/lib/routes/furaffinity/submission-comments.ts index c3f8edf44c..985a628642 100644 --- a/lib/routes/furaffinity/submission-comments.ts +++ b/lib/routes/furaffinity/submission-comments.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/furaffinity/user.ts b/lib/routes/furaffinity/user.ts index a152e3317e..f7ac1e981a 100644 --- a/lib/routes/furaffinity/user.ts +++ b/lib/routes/furaffinity/user.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/furaffinity/watchers.ts b/lib/routes/furaffinity/watchers.ts index 3b28aa5d50..cfe5ad270a 100644 --- a/lib/routes/furaffinity/watchers.ts +++ b/lib/routes/furaffinity/watchers.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/furaffinity/watching.ts b/lib/routes/furaffinity/watching.ts index 917e129339..3c689c7b1f 100644 --- a/lib/routes/furaffinity/watching.ts +++ b/lib/routes/furaffinity/watching.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/furstar/archive.ts b/lib/routes/furstar/archive.ts index ac342e9679..17907b5642 100644 --- a/lib/routes/furstar/archive.ts +++ b/lib/routes/furstar/archive.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import utils from './utils'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import utils from './utils'; + export const route: Route = { path: '/archive/:lang?', categories: ['shopping'], diff --git a/lib/routes/furstar/artists.ts b/lib/routes/furstar/artists.ts index 06bd98dedd..8f6821104f 100644 --- a/lib/routes/furstar/artists.ts +++ b/lib/routes/furstar/artists.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import utils from './utils'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import utils from './utils'; + export const route: Route = { path: '/artists/:lang?', categories: ['shopping'], diff --git a/lib/routes/furstar/index.ts b/lib/routes/furstar/index.ts index c392e61102..016f469abc 100644 --- a/lib/routes/furstar/index.ts +++ b/lib/routes/furstar/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import utils from './utils'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import utils from './utils'; + export const route: Route = { path: '/characters/:lang?', categories: ['shopping'], diff --git a/lib/routes/furstar/utils.ts b/lib/routes/furstar/utils.ts index c6432ea9fa..d63e92a18c 100644 --- a/lib/routes/furstar/utils.ts +++ b/lib/routes/furstar/utils.ts @@ -1,7 +1,9 @@ +import path from 'node:path'; + import { load } from 'cheerio'; + import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; const base = 'https://furstar.jp'; diff --git a/lib/routes/futunn/live.ts b/lib/routes/futunn/live.ts index eb4f9ba69c..fdec6cb2a5 100644 --- a/lib/routes/futunn/live.ts +++ b/lib/routes/futunn/live.ts @@ -1,5 +1,4 @@ -import { Route } from '@/types'; - +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/futunn/main.ts b/lib/routes/futunn/main.ts index 66349dc29a..d61282025c 100644 --- a/lib/routes/futunn/main.ts +++ b/lib/routes/futunn/main.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: ['/main', '/'], diff --git a/lib/routes/futunn/topic.ts b/lib/routes/futunn/topic.ts index 739b117b93..4f9a670ee2 100644 --- a/lib/routes/futunn/topic.ts +++ b/lib/routes/futunn/topic.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/topic/:id', diff --git a/lib/routes/futunn/video.ts b/lib/routes/futunn/video.ts index 707b6add69..87de70a71e 100644 --- a/lib/routes/futunn/video.ts +++ b/lib/routes/futunn/video.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/video', diff --git a/lib/routes/fx-markets/channel.ts b/lib/routes/fx-markets/channel.ts index 59702b77de..9d8f749941 100644 --- a/lib/routes/fx-markets/channel.ts +++ b/lib/routes/fx-markets/channel.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/fx678/kx.ts b/lib/routes/fx678/kx.ts index 2de1bc8c94..bd6b9d2623 100644 --- a/lib/routes/fx678/kx.ts +++ b/lib/routes/fx678/kx.ts @@ -1,6 +1,8 @@ -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/fxiaoke/crm.ts b/lib/routes/fxiaoke/crm.ts index 66f42a4508..ec386098df 100644 --- a/lib/routes/fxiaoke/crm.ts +++ b/lib/routes/fxiaoke/crm.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const baseUrl = 'https://www.fxiaoke.com/crm'; const baseTitle = '纷享销客 CRM'; const titleMap = new Map([ diff --git a/lib/routes/fzmtr/announcements.ts b/lib/routes/fzmtr/announcements.ts index 57375ba57c..ebd4aaf011 100644 --- a/lib/routes/fzmtr/announcements.ts +++ b/lib/routes/fzmtr/announcements.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/galxe/index.ts b/lib/routes/galxe/index.ts index e7edeb6002..90110bd75d 100644 --- a/lib/routes/galxe/index.ts +++ b/lib/routes/galxe/index.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/quest/:alias', diff --git a/lib/routes/gameapps/index.ts b/lib/routes/gameapps/index.ts index b46616b8e1..ec64f0b50d 100644 --- a/lib/routes/gameapps/index.ts +++ b/lib/routes/gameapps/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import parser from '@/utils/rss-parser'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import parser from '@/utils/rss-parser'; export const route: Route = { path: '/', diff --git a/lib/routes/gamebase/news.ts b/lib/routes/gamebase/news.ts index 407b6f36bb..d6f16350d6 100644 --- a/lib/routes/gamebase/news.ts +++ b/lib/routes/gamebase/news.ts @@ -1,15 +1,15 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import { art } from '@/utils/render'; -import cache from '@/utils/cache'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; +import path from 'node:path'; import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; -import path from 'node:path'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; const types = { newslist: 'newsList', diff --git a/lib/routes/gamegene/news.ts b/lib/routes/gamegene/news.ts index 3949781d56..62d01b52f6 100644 --- a/lib/routes/gamegene/news.ts +++ b/lib/routes/gamegene/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/gamekee/news.ts b/lib/routes/gamekee/news.ts index 20c69d8b31..c3df4677f0 100644 --- a/lib/routes/gamekee/news.ts +++ b/lib/routes/gamekee/news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; + import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/news', diff --git a/lib/routes/gamer/ani/anime.ts b/lib/routes/gamer/ani/anime.ts index 5c5f272f1d..d0d8b7e362 100644 --- a/lib/routes/gamer/ani/anime.ts +++ b/lib/routes/gamer/ani/anime.ts @@ -1,4 +1,5 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/gamer/ani/new-anime.ts b/lib/routes/gamer/ani/new-anime.ts index 7b593a1ce4..c6e5e72d5c 100644 --- a/lib/routes/gamer/ani/new-anime.ts +++ b/lib/routes/gamer/ani/new-anime.ts @@ -1,4 +1,5 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gamer/gnn-index.ts b/lib/routes/gamer/gnn-index.ts index be85e1a55d..aa571da318 100644 --- a/lib/routes/gamer/gnn-index.ts +++ b/lib/routes/gamer/gnn-index.ts @@ -1,10 +1,12 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; +import pMap from 'p-map'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import pMap from 'p-map'; export const route: Route = { path: '/gnn/:category?', diff --git a/lib/routes/gamer/hot.ts b/lib/routes/gamer/hot.ts index e4e4ec513c..7438f95680 100644 --- a/lib/routes/gamer/hot.ts +++ b/lib/routes/gamer/hot.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gamer520/index.ts b/lib/routes/gamer520/index.ts index b49d5fe7e0..ee8c9096b4 100644 --- a/lib/routes/gamer520/index.ts +++ b/lib/routes/gamer520/index.ts @@ -1,8 +1,9 @@ -import { Data, DataItem, Route } from '@/types'; +import type { Context } from 'hono'; + +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { Context } from 'hono'; export const route: Route = { path: '/:category?/:order?', diff --git a/lib/routes/gamersecret/index.ts b/lib/routes/gamersecret/index.ts index b871566eb6..4fb5df94f5 100644 --- a/lib/routes/gamersecret/index.ts +++ b/lib/routes/gamersecret/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/:type?/:category?', diff --git a/lib/routes/gamersky/ent.ts b/lib/routes/gamersky/ent.ts index 9f376c8ece..5953700673 100644 --- a/lib/routes/gamersky/ent.ts +++ b/lib/routes/gamersky/ent.ts @@ -1,6 +1,8 @@ -import type { Route } from '@/types'; import type { Context } from 'hono'; -import { getArticleList, parseArticleList, getArticle, mdTableBuilder } from './utils'; + +import type { Route } from '@/types'; + +import { getArticle, getArticleList, mdTableBuilder, parseArticleList } from './utils'; const idNameMap = new Map([ ['all', { title: '热点图文', suffix: 'ent', nodeId: '20107' }], diff --git a/lib/routes/gamersky/news.ts b/lib/routes/gamersky/news.ts index 57b6c5d260..46b0f192f6 100644 --- a/lib/routes/gamersky/news.ts +++ b/lib/routes/gamersky/news.ts @@ -1,6 +1,8 @@ -import type { Route } from '@/types'; import type { Context } from 'hono'; -import { getArticleList, parseArticleList, getArticle, mdTableBuilder } from './utils'; + +import type { Route } from '@/types'; + +import { getArticle, getArticleList, mdTableBuilder, parseArticleList } from './utils'; const idNameMap = [ { diff --git a/lib/routes/gamersky/review.ts b/lib/routes/gamersky/review.ts index eb2fd8a641..e5c55ad89e 100644 --- a/lib/routes/gamersky/review.ts +++ b/lib/routes/gamersky/review.ts @@ -1,6 +1,9 @@ -import type { Route } from '@/types'; import type { Context } from 'hono'; -import { getArticleList, parseArticleList, getArticle, mdTableBuilder } from './utils'; + +import type { Route } from '@/types'; + +import { getArticle, getArticleList, mdTableBuilder, parseArticleList } from './utils'; + const idNameMap = [ { type: 'pc', diff --git a/lib/routes/gamersky/utils.ts b/lib/routes/gamersky/utils.ts index 1d0f8b1be5..c11f631ad3 100644 --- a/lib/routes/gamersky/utils.ts +++ b/lib/routes/gamersky/utils.ts @@ -1,8 +1,8 @@ -import type { DataItem } from '@/types'; - -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { DataItem } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gamme/category.ts b/lib/routes/gamme/category.ts index e60ab5a84f..ad48a2eca7 100644 --- a/lib/routes/gamme/category.ts +++ b/lib/routes/gamme/category.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import parser from '@/utils/rss-parser'; import { isValidHost } from '@/utils/valid-host'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; export const route: Route = { path: '/:domain/:category?', diff --git a/lib/routes/gamme/tag.ts b/lib/routes/gamme/tag.ts index b9dbb922e4..cd70229d30 100644 --- a/lib/routes/gamme/tag.ts +++ b/lib/routes/gamme/tag.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { isValidHost } from '@/utils/valid-host'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; export const route: Route = { path: '/:domain/tag/:tag', diff --git a/lib/routes/gaoyu/blog.ts b/lib/routes/gaoyu/blog.ts index 59944c8a3d..8705124fe1 100644 --- a/lib/routes/gaoyu/blog.ts +++ b/lib/routes/gaoyu/blog.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '20', 10); diff --git a/lib/routes/gc.ca/pm-news.ts b/lib/routes/gc.ca/pm-news.ts index 34073eab4b..364389d2a1 100644 --- a/lib/routes/gc.ca/pm-news.ts +++ b/lib/routes/gc.ca/pm-news.ts @@ -1,8 +1,9 @@ +import { load } from 'cheerio'; +import type { Context } from 'hono'; + import type { Data, DataItem, Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; -import type { Context } from 'hono'; export const route: Route = { path: '/pm/:language?', diff --git a/lib/routes/gcores/articles.ts b/lib/routes/gcores/articles.ts index bc7a1f48e7..910b2b5a1d 100644 --- a/lib/routes/gcores/articles.ts +++ b/lib/routes/gcores/articles.ts @@ -1,7 +1,7 @@ -import { type Data, type Route, ViewType } from '@/types'; - import { type Context } from 'hono'; +import { type Data, type Route, ViewType } from '@/types'; + import { baseUrl, processItems } from './util'; export const handler = async (ctx: Context): Promise => { diff --git a/lib/routes/gcores/categories.ts b/lib/routes/gcores/categories.ts index d1fc2637ff..68bfe84e79 100644 --- a/lib/routes/gcores/categories.ts +++ b/lib/routes/gcores/categories.ts @@ -1,7 +1,7 @@ -import { type Data, type Route, ViewType } from '@/types'; - import { type Context } from 'hono'; +import { type Data, type Route, ViewType } from '@/types'; + import { baseUrl, processItems } from './util'; let viewType: ViewType = ViewType.Articles; diff --git a/lib/routes/gcores/collections.ts b/lib/routes/gcores/collections.ts index 81a4afc6a3..e9155bb8b1 100644 --- a/lib/routes/gcores/collections.ts +++ b/lib/routes/gcores/collections.ts @@ -1,7 +1,7 @@ -import { type Data, type Route, ViewType } from '@/types'; - import { type Context } from 'hono'; +import { type Data, type Route, ViewType } from '@/types'; + import { baseUrl, processItems } from './util'; let viewType: ViewType = ViewType.Articles; diff --git a/lib/routes/gcores/news.ts b/lib/routes/gcores/news.ts index 2a90bc6554..4e763776d7 100644 --- a/lib/routes/gcores/news.ts +++ b/lib/routes/gcores/news.ts @@ -1,7 +1,7 @@ -import { type Data, type Route, ViewType } from '@/types'; - import { type Context } from 'hono'; +import { type Data, type Route, ViewType } from '@/types'; + import { baseUrl, processItems } from './util'; export const handler = async (ctx: Context): Promise => { diff --git a/lib/routes/gcores/parser.ts b/lib/routes/gcores/parser.ts index 814c7ee6bb..e11f471276 100644 --- a/lib/routes/gcores/parser.ts +++ b/lib/routes/gcores/parser.ts @@ -1,7 +1,7 @@ -import { art } from '@/utils/render'; - import path from 'node:path'; +import { art } from '@/utils/render'; + interface Style { [key: string]: string; } diff --git a/lib/routes/gcores/program-previews.ts b/lib/routes/gcores/program-previews.ts index f8d571070e..07e760f1e3 100644 --- a/lib/routes/gcores/program-previews.ts +++ b/lib/routes/gcores/program-previews.ts @@ -1,7 +1,7 @@ -import { type Data, type Route, ViewType } from '@/types'; - import { type Context } from 'hono'; +import { type Data, type Route, ViewType } from '@/types'; + import { baseUrl, processItems } from './util'; export const handler = async (ctx: Context): Promise => { diff --git a/lib/routes/gcores/radio.ts b/lib/routes/gcores/radio.ts index 9383b2e888..e09b3dad3b 100644 --- a/lib/routes/gcores/radio.ts +++ b/lib/routes/gcores/radio.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; -import { parseDate } from '@/utils/parse-date'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import md5 from '@/utils/md5'; -import path from 'node:path'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; export const route: Route = { path: '/radios/:category?', diff --git a/lib/routes/gcores/tags.ts b/lib/routes/gcores/tags.ts index c68a2e07de..60f86574ca 100644 --- a/lib/routes/gcores/tags.ts +++ b/lib/routes/gcores/tags.ts @@ -1,7 +1,7 @@ -import { type Data, type Route, ViewType } from '@/types'; - import { type Context } from 'hono'; +import { type Data, type Route, ViewType } from '@/types'; + import { baseUrl, processItems } from './util'; let viewType: ViewType = ViewType.Articles; diff --git a/lib/routes/gcores/topics.ts b/lib/routes/gcores/topics.ts index d5056cc619..6ade81fcaf 100644 --- a/lib/routes/gcores/topics.ts +++ b/lib/routes/gcores/topics.ts @@ -1,7 +1,7 @@ -import { type Data, type Route, ViewType } from '@/types'; - import { type Context } from 'hono'; +import { type Data, type Route, ViewType } from '@/types'; + import { baseUrl, processItems } from './util'; export const handler = async (ctx: Context): Promise => { diff --git a/lib/routes/gcores/util.ts b/lib/routes/gcores/util.ts index 85c036fa28..4e90b2278c 100644 --- a/lib/routes/gcores/util.ts +++ b/lib/routes/gcores/util.ts @@ -1,11 +1,11 @@ -import { type Data, type DataItem } from '@/types'; - -import { art } from '@/utils/render'; -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; +import path from 'node:path'; import { type CheerioAPI, load } from 'cheerio'; -import path from 'node:path'; + +import { type Data, type DataItem } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import { parseContent } from './parser'; @@ -170,4 +170,4 @@ const processItems = async (limit: number, query: any, apiUrl: string, targetUrl }; }; -export { baseUrl, imageBaseUrl, audioBaseUrl, processItems }; +export { audioBaseUrl, baseUrl, imageBaseUrl, processItems }; diff --git a/lib/routes/gcores/videos.ts b/lib/routes/gcores/videos.ts index 92d44b823c..5be5f91e35 100644 --- a/lib/routes/gcores/videos.ts +++ b/lib/routes/gcores/videos.ts @@ -1,7 +1,7 @@ -import { type Data, type Route, ViewType } from '@/types'; - import { type Context } from 'hono'; +import { type Data, type Route, ViewType } from '@/types'; + import { baseUrl, processItems } from './util'; export const handler = async (ctx: Context): Promise => { diff --git a/lib/routes/gdsrx/index.ts b/lib/routes/gdsrx/index.ts index abbb9e6036..50e261afde 100644 --- a/lib/routes/gdsrx/index.ts +++ b/lib/routes/gdsrx/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/gdufs/news.ts b/lib/routes/gdufs/news.ts index 49a284d476..031928e6fc 100644 --- a/lib/routes/gdufs/news.ts +++ b/lib/routes/gdufs/news.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/gdufs/xwxy/index.ts b/lib/routes/gdufs/xwxy/index.ts index b652c60050..ae90103051 100644 --- a/lib/routes/gdufs/xwxy/index.ts +++ b/lib/routes/gdufs/xwxy/index.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/gdut/oa-news.ts b/lib/routes/gdut/oa-news.ts index 60d5c3c10a..35fba5e345 100644 --- a/lib/routes/gdut/oa-news.ts +++ b/lib/routes/gdut/oa-news.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import pMap from 'p-map'; +import { CookieJar } from 'tough-cookie'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { CookieJar } from 'tough-cookie'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import pMap from 'p-map'; const site = 'https://oas.gdut.edu.cn/seeyon'; const typeMap = { diff --git a/lib/routes/geekpark/index.ts b/lib/routes/geekpark/index.ts index 39b3124980..9fddca5c91 100644 --- a/lib/routes/geekpark/index.ts +++ b/lib/routes/geekpark/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const handler = async (ctx) => { const { column } = ctx.req.param(); diff --git a/lib/routes/gelbooru/post.ts b/lib/routes/gelbooru/post.ts index c8977cee89..64a28a5adb 100644 --- a/lib/routes/gelbooru/post.ts +++ b/lib/routes/gelbooru/post.ts @@ -1,11 +1,13 @@ -import { Route, ViewType } from '@/types'; -import { Context } from 'hono'; -import { parseDate } from '@/utils/parse-date'; -import { renderDesc, getAPIKeys } from './utils'; - -import got from '@/utils/got'; +import type { Context } from 'hono'; import queryString from 'query-string'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + +import { getAPIKeys, renderDesc } from './utils'; + export const route: Route = { path: '/post/:tags?/:quality?', categories: ['picture'], diff --git a/lib/routes/gelbooru/utils.ts b/lib/routes/gelbooru/utils.ts index bf74c2fa61..3d59a4e9a2 100644 --- a/lib/routes/gelbooru/utils.ts +++ b/lib/routes/gelbooru/utils.ts @@ -1,6 +1,7 @@ import path from 'node:path'; -import { art } from '@/utils/render'; + import { config } from '@/config'; +import { art } from '@/utils/render'; export function renderDesc(post, link, quality: 'sample' | 'orig') { const { id, source, owner, file_url: fileUrl, tags, score } = post; diff --git a/lib/routes/gelonghui/home.ts b/lib/routes/gelonghui/home.ts index 99fbae0da6..988ae246cb 100644 --- a/lib/routes/gelonghui/home.ts +++ b/lib/routes/gelonghui/home.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { parseItem } from './utils'; export const route: Route = { diff --git a/lib/routes/gelonghui/hot-article.ts b/lib/routes/gelonghui/hot-article.ts index 823d2056cb..8986ffd666 100644 --- a/lib/routes/gelonghui/hot-article.ts +++ b/lib/routes/gelonghui/hot-article.ts @@ -1,7 +1,10 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import { parseItem } from './utils'; export const route: Route = { diff --git a/lib/routes/gelonghui/keyword.ts b/lib/routes/gelonghui/keyword.ts index d2cff515f0..65091fcab1 100644 --- a/lib/routes/gelonghui/keyword.ts +++ b/lib/routes/gelonghui/keyword.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { parseItem } from './utils'; export const route: Route = { diff --git a/lib/routes/gelonghui/live.ts b/lib/routes/gelonghui/live.ts index 85336493df..fe52724a5f 100644 --- a/lib/routes/gelonghui/live.ts +++ b/lib/routes/gelonghui/live.ts @@ -1,9 +1,10 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const baseUrl = 'https://www.gelonghui.com'; diff --git a/lib/routes/gelonghui/subject.ts b/lib/routes/gelonghui/subject.ts index 66a58253f1..368f07a340 100644 --- a/lib/routes/gelonghui/subject.ts +++ b/lib/routes/gelonghui/subject.ts @@ -1,8 +1,11 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + import { parseItem } from './utils'; export const route: Route = { diff --git a/lib/routes/gelonghui/user.ts b/lib/routes/gelonghui/user.ts index be073674d8..968e30d0c8 100644 --- a/lib/routes/gelonghui/user.ts +++ b/lib/routes/gelonghui/user.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { parseItem } from './utils'; export const route: Route = { diff --git a/lib/routes/gelonghui/utils.ts b/lib/routes/gelonghui/utils.ts index 9a2259fac5..2080c7c4a6 100644 --- a/lib/routes/gelonghui/utils.ts +++ b/lib/routes/gelonghui/utils.ts @@ -1,5 +1,6 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/genossenschaften/index.ts b/lib/routes/genossenschaften/index.ts index 40d9789011..f9ad489e17 100644 --- a/lib/routes/genossenschaften/index.ts +++ b/lib/routes/genossenschaften/index.ts @@ -1,6 +1,7 @@ import { load } from 'cheerio'; -import ofetch from '@/utils/ofetch'; + import type { Data, DataItem, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; const FEED_TITLE = 'Genossenschaften.immo' as const; const FEED_LOGO = 'https://genossenschaften.immo/static/gimmo/img/favicon/favicon-128x128.png' as const; diff --git a/lib/routes/geocaching/blogs.ts b/lib/routes/geocaching/blogs.ts index 2917349de2..cb4beda0a9 100644 --- a/lib/routes/geocaching/blogs.ts +++ b/lib/routes/geocaching/blogs.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/gesiba/index.ts b/lib/routes/gesiba/index.ts index 0a3ec13adc..164cc5a731 100644 --- a/lib/routes/gesiba/index.ts +++ b/lib/routes/gesiba/index.ts @@ -1,7 +1,8 @@ import { load } from 'cheerio'; + +import type { Data, DataItem, Route } from '@/types'; import { getSubPath } from '@/utils/common-utils'; import ofetch from '@/utils/ofetch'; -import type { Data, DataItem, Route } from '@/types'; const FEED_TITLE = 'Wohnungen - Gesiba' as const; const FEED_LANGUAGE = 'de' as const; diff --git a/lib/routes/gesiba/namespace.ts b/lib/routes/gesiba/namespace.ts index 6d93110355..a75ff0d02b 100644 --- a/lib/routes/gesiba/namespace.ts +++ b/lib/routes/gesiba/namespace.ts @@ -1,4 +1,4 @@ -import { Namespace } from '@/types'; +import type { Namespace } from '@/types'; export const namespace: Namespace = { name: 'Gesiba', diff --git a/lib/routes/getdr/index.ts b/lib/routes/getdr/index.ts index baedf7b48f..03e9c631a0 100644 --- a/lib/routes/getdr/index.ts +++ b/lib/routes/getdr/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/getitfree/index.ts b/lib/routes/getitfree/index.ts index 08443ab3f9..47998a802e 100644 --- a/lib/routes/getitfree/index.ts +++ b/lib/routes/getitfree/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { apiSlug, rootUrl, bakeFilterSearchParams, bakeFiltersWithPair, bakeUrl, fetchData, getFilterNameForTitle, getFilterParamsForUrl, parseFilterStr } from './util'; +import { apiSlug, bakeFilterSearchParams, bakeFiltersWithPair, bakeUrl, fetchData, getFilterNameForTitle, getFilterParamsForUrl, parseFilterStr, rootUrl } from './util'; export const route: Route = { path: '/:filter{.+}?', diff --git a/lib/routes/getitfree/util.ts b/lib/routes/getitfree/util.ts index 2915c11dd1..454a946aaa 100644 --- a/lib/routes/getitfree/util.ts +++ b/lib/routes/getitfree/util.ts @@ -1,6 +1,7 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; +import got from '@/utils/got'; + const rootUrl = 'https://getitfree.cn'; const apiSlug = 'wp-json/wp/v2'; @@ -312,4 +313,4 @@ const parseFilterStr = (filterStr) => { return parseStr(filterStr, {}); }; -export { apiSlug, rootUrl, bakeFilterSearchParams, bakeFiltersWithPair, bakeUrl, fetchData, getFilterNameForTitle, getFilterParamsForUrl, parseFilterStr }; +export { apiSlug, bakeFilterSearchParams, bakeFiltersWithPair, bakeUrl, fetchData, getFilterNameForTitle, getFilterParamsForUrl, parseFilterStr, rootUrl }; diff --git a/lib/routes/gettr/user.ts b/lib/routes/gettr/user.ts index 1e1e6d3864..06b7816370 100644 --- a/lib/routes/gettr/user.ts +++ b/lib/routes/gettr/user.ts @@ -1,9 +1,10 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const actionMap = { pub_pst: 'Published a post: ', diff --git a/lib/routes/gf-cn/news.ts b/lib/routes/gf-cn/news.ts index 1544b60301..46d2bb4330 100644 --- a/lib/routes/gf-cn/news.ts +++ b/lib/routes/gf-cn/news.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const titles = { 1: '新闻', diff --git a/lib/routes/gihyo/group.ts b/lib/routes/gihyo/group.ts index e4a435ad2c..a3398df68c 100644 --- a/lib/routes/gihyo/group.ts +++ b/lib/routes/gihyo/group.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gisreportsonline/index.ts b/lib/routes/gisreportsonline/index.ts index fcf9b2ff49..de27af795c 100644 --- a/lib/routes/gisreportsonline/index.ts +++ b/lib/routes/gisreportsonline/index.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; - import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/:path{.*}', diff --git a/lib/routes/gitcode/repos/commits.ts b/lib/routes/gitcode/repos/commits.ts index 13f2e9a903..9d732a1b34 100644 --- a/lib/routes/gitcode/repos/commits.ts +++ b/lib/routes/gitcode/repos/commits.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import MarkdownIt from 'markdown-it'; const md = MarkdownIt({ html: true, diff --git a/lib/routes/gitee/repos/commits.ts b/lib/routes/gitee/repos/commits.ts index 742d0dca50..d29d47196f 100644 --- a/lib/routes/gitee/repos/commits.ts +++ b/lib/routes/gitee/repos/commits.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import MarkdownIt from 'markdown-it'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; -import MarkdownIt from 'markdown-it'; + const md = MarkdownIt({ html: true, }); diff --git a/lib/routes/gitee/repos/events.ts b/lib/routes/gitee/repos/events.ts index 67f1fc7ba4..0057395dd8 100644 --- a/lib/routes/gitee/repos/events.ts +++ b/lib/routes/gitee/repos/events.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import MarkdownIt from 'markdown-it'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; -import MarkdownIt from 'markdown-it'; + const md = MarkdownIt({ html: true, }); diff --git a/lib/routes/gitee/repos/releases.ts b/lib/routes/gitee/repos/releases.ts index 083cb442ca..5257dc4b09 100644 --- a/lib/routes/gitee/repos/releases.ts +++ b/lib/routes/gitee/repos/releases.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import MarkdownIt from 'markdown-it'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; -import MarkdownIt from 'markdown-it'; + const md = MarkdownIt({ html: true, }); diff --git a/lib/routes/gitee/users/events.ts b/lib/routes/gitee/users/events.ts index e68a222a43..6322be0bc8 100644 --- a/lib/routes/gitee/users/events.ts +++ b/lib/routes/gitee/users/events.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import MarkdownIt from 'markdown-it'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; -import MarkdownIt from 'markdown-it'; + const md = MarkdownIt({ html: true, }); diff --git a/lib/routes/github/activity.ts b/lib/routes/github/activity.ts index 04f0415110..785a42e377 100644 --- a/lib/routes/github/activity.ts +++ b/lib/routes/github/activity.ts @@ -1,9 +1,11 @@ -import { Route, ViewType } from '@/types'; -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; import Parser from 'rss-parser'; import sanitizeHtml from 'sanitize-html'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + const parser = new Parser(); export const route: Route = { diff --git a/lib/routes/github/advisor.ts b/lib/routes/github/advisor.ts index 8a0edd8dcf..61446b743a 100644 --- a/lib/routes/github/advisor.ts +++ b/lib/routes/github/advisor.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import ofetch from '@/utils/ofetch'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/advisor/data/:type?/:category?', diff --git a/lib/routes/github/branches.ts b/lib/routes/github/branches.ts index 857809ff8d..3b19d72d5b 100644 --- a/lib/routes/github/branches.ts +++ b/lib/routes/github/branches.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { config } from '@/config'; +import type { Route } from '@/types'; +import got from '@/utils/got'; export const route: Route = { path: '/branches/:user/:repo', diff --git a/lib/routes/github/comments.ts b/lib/routes/github/comments.ts index cfc6148bda..2b6446dc4c 100644 --- a/lib/routes/github/comments.ts +++ b/lib/routes/github/comments.ts @@ -1,13 +1,16 @@ -import { Route } from '@/types'; +import MarkdownIt from 'markdown-it'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import MarkdownIt from 'markdown-it'; + const md = MarkdownIt({ html: true, }); const rootUrl = 'https://github.com'; const apiUrl = 'https://api.github.com'; -import { config } from '@/config'; + const typeDict = { issue: { title: 'Issue', diff --git a/lib/routes/github/contributors.ts b/lib/routes/github/contributors.ts index 5237c6bb51..3e5f63c270 100644 --- a/lib/routes/github/contributors.ts +++ b/lib/routes/github/contributors.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { config } from '@/config'; +import type { Route } from '@/types'; +import got from '@/utils/got'; export const route: Route = { path: '/contributors/:user/:repo/:order?/:anon?', diff --git a/lib/routes/github/discussions.ts b/lib/routes/github/discussions.ts index d9adf5c05f..028f17c4fb 100644 --- a/lib/routes/github/discussions.ts +++ b/lib/routes/github/discussions.ts @@ -1,13 +1,15 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; +import MarkdownIt from 'markdown-it'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; -import MarkdownIt from 'markdown-it'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + const md = MarkdownIt({ html: true, linkify: true, }); -import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/discussion/:user/:repo/:state?/:category?', diff --git a/lib/routes/github/file.ts b/lib/routes/github/file.ts index b1c192a0e9..9edb796622 100644 --- a/lib/routes/github/file.ts +++ b/lib/routes/github/file.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import { config } from '@/config'; import queryString from 'query-string'; +import { config } from '@/config'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/file/:user/:repo/:branch/:filepath{.+}', example: '/github/file/DIYgod/RSSHub/master/README.md', diff --git a/lib/routes/github/follower.ts b/lib/routes/github/follower.ts index 30363b8b29..47941fb95b 100644 --- a/lib/routes/github/follower.ts +++ b/lib/routes/github/follower.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import got from '@/utils/got'; export const route: Route = { path: '/user/followers/:user', diff --git a/lib/routes/github/gist.ts b/lib/routes/github/gist.ts index 15972bec86..85e214e8d2 100644 --- a/lib/routes/github/gist.ts +++ b/lib/routes/github/gist.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { config } from '@/config'; +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/github/issue.ts b/lib/routes/github/issue.ts index 7b72acc0f1..f0c95a5bde 100644 --- a/lib/routes/github/issue.ts +++ b/lib/routes/github/issue.ts @@ -1,13 +1,16 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; -import { config } from '@/config'; import MarkdownIt from 'markdown-it'; +import queryString from 'query-string'; + +import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + const md = MarkdownIt({ html: true, linkify: true, }); -import queryString from 'query-string'; -import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/issue/:user/:repo/:state?/:labels?', diff --git a/lib/routes/github/notifications.ts b/lib/routes/github/notifications.ts index e7105b72a6..3c658fd2a7 100644 --- a/lib/routes/github/notifications.ts +++ b/lib/routes/github/notifications.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; const apiUrl = 'https://api.github.com'; -import { config } from '@/config'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; export const route: Route = { path: '/notifications', diff --git a/lib/routes/github/org-event.ts b/lib/routes/github/org-event.ts index ad016ad60a..4ebfb47de4 100644 --- a/lib/routes/github/org-event.ts +++ b/lib/routes/github/org-event.ts @@ -1,6 +1,8 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; + import { filterEvents } from './eventapi'; export const route: Route = { diff --git a/lib/routes/github/private-feed.ts b/lib/routes/github/private-feed.ts index 7ee7af1f0d..3970df6802 100644 --- a/lib/routes/github/private-feed.ts +++ b/lib/routes/github/private-feed.ts @@ -1,6 +1,8 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; + import { filterEvents } from './eventapi'; export const route: Route = { diff --git a/lib/routes/github/pulls.ts b/lib/routes/github/pulls.ts index a4ccb97f2d..1d0c876988 100644 --- a/lib/routes/github/pulls.ts +++ b/lib/routes/github/pulls.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import { config } from '@/config'; import MarkdownIt from 'markdown-it'; + +import { config } from '@/config'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + const md = MarkdownIt({ html: true, linkify: true, }); -import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/pull/:user/:repo/:state?/:labels?', diff --git a/lib/routes/github/pulse.ts b/lib/routes/github/pulse.ts index fbcf6326c2..ca21eb5595 100644 --- a/lib/routes/github/pulse.ts +++ b/lib/routes/github/pulse.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; import { load } from 'cheerio'; -import path from 'node:path'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import md5 from '@/utils/md5'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/github/repo-event.ts b/lib/routes/github/repo-event.ts index 5bdb5bb3f0..9d56ffd45e 100644 --- a/lib/routes/github/repo-event.ts +++ b/lib/routes/github/repo-event.ts @@ -1,6 +1,8 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; + import { filterEvents } from './eventapi'; export const route: Route = { diff --git a/lib/routes/github/repos.ts b/lib/routes/github/repos.ts index 8f4ae671d0..b0c8c15cc3 100644 --- a/lib/routes/github/repos.ts +++ b/lib/routes/github/repos.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { config } from '@/config'; +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/github/search.ts b/lib/routes/github/search.ts index df3c38f311..d591edea91 100644 --- a/lib/routes/github/search.ts +++ b/lib/routes/github/search.ts @@ -1,7 +1,8 @@ -import { DataItem, Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import * as url from 'node:url'; +import type { DataItem, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + const host = 'https://github.com'; export const route: Route = { diff --git a/lib/routes/github/star.ts b/lib/routes/github/star.ts index b4cbcdec0c..f8b3fb29b5 100644 --- a/lib/routes/github/star.ts +++ b/lib/routes/github/star.ts @@ -1,7 +1,8 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; export const route: Route = { path: '/stars/:user/:repo', diff --git a/lib/routes/github/starred-repos.ts b/lib/routes/github/starred-repos.ts index 707d84e124..2ecefa84fa 100644 --- a/lib/routes/github/starred-repos.ts +++ b/lib/routes/github/starred-repos.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { config } from '@/config'; +import type { Route } from '@/types'; +import got from '@/utils/got'; import md5 from '@/utils/md5'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/github/topic.ts b/lib/routes/github/topic.ts index 811184ee33..61ef585ed2 100644 --- a/lib/routes/github/topic.ts +++ b/lib/routes/github/topic.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/github/trending.ts b/lib/routes/github/trending.ts index 10eb68cc31..d65c88dba9 100644 --- a/lib/routes/github/trending.ts +++ b/lib/routes/github/trending.ts @@ -1,11 +1,13 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; + +import { load } from 'cheerio'; import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import { load } from 'cheerio'; -import path from 'node:path'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; export const route: Route = { path: '/trending/:since/:language/:spoken_language?', diff --git a/lib/routes/github/user-event.ts b/lib/routes/github/user-event.ts index 2bc3ec3eb5..2082a2e7c5 100644 --- a/lib/routes/github/user-event.ts +++ b/lib/routes/github/user-event.ts @@ -1,6 +1,8 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; + import { filterEvents } from './eventapi'; export const route: Route = { diff --git a/lib/routes/github/wiki.ts b/lib/routes/github/wiki.ts index f056205c61..379d35dea4 100644 --- a/lib/routes/github/wiki.ts +++ b/lib/routes/github/wiki.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://github.com'; diff --git a/lib/routes/gitpod/blog.ts b/lib/routes/gitpod/blog.ts index 4ddf0f0f1d..a4c2621921 100644 --- a/lib/routes/gitpod/blog.ts +++ b/lib/routes/gitpod/blog.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { rootUrl } from './utils'; import { art } from '@/utils/render'; -import path from 'node:path'; + +import { rootUrl } from './utils'; export const route: Route = { path: '/blog', diff --git a/lib/routes/gitpod/changelog.ts b/lib/routes/gitpod/changelog.ts index 8837cb17be..468567351d 100644 --- a/lib/routes/gitpod/changelog.ts +++ b/lib/routes/gitpod/changelog.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { rootUrl } from './utils'; export const route: Route = { diff --git a/lib/routes/gitstar-ranking/index.ts b/lib/routes/gitstar-ranking/index.ts index b0114a93a8..f59b1487ac 100644 --- a/lib/routes/gitstar-ranking/index.ts +++ b/lib/routes/gitstar-ranking/index.ts @@ -1,12 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; -import ofetch from '@/utils/ofetch'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type Context } from 'hono'; -import path from 'node:path'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { category = 'repositories' } = ctx.req.param(); diff --git a/lib/routes/globallawreview/index.ts b/lib/routes/globallawreview/index.ts index 3710e73be6..ea64e6d401 100644 --- a/lib/routes/globallawreview/index.ts +++ b/lib/routes/globallawreview/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/', radar: [ diff --git a/lib/routes/gmcmonline/chinacustoms.ts b/lib/routes/gmcmonline/chinacustoms.ts index 9386d1579e..d67b7b39c7 100644 --- a/lib/routes/gmcmonline/chinacustoms.ts +++ b/lib/routes/gmcmonline/chinacustoms.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const handler = async (ctx) => { diff --git a/lib/routes/gmu/news.ts b/lib/routes/gmu/news.ts index 4eb50f711a..c845908cff 100644 --- a/lib/routes/gmu/news.ts +++ b/lib/routes/gmu/news.ts @@ -1,9 +1,10 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; import type { Context } from 'hono'; + import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/news/:type?', diff --git a/lib/routes/gmu/yjs.ts b/lib/routes/gmu/yjs.ts index 3cba8be3c4..b5964e1d99 100644 --- a/lib/routes/gmu/yjs.ts +++ b/lib/routes/gmu/yjs.ts @@ -1,9 +1,10 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import type { Route } from '@/types'; import type { Context } from 'hono'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; const sections = { zsgz: { diff --git a/lib/routes/go/jihs/idwr.ts b/lib/routes/go/jihs/idwr.ts index 4941e8df9d..15d36eced6 100644 --- a/lib/routes/go/jihs/idwr.ts +++ b/lib/routes/go/jihs/idwr.ts @@ -1,12 +1,11 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + export const handler = async (ctx: Context): Promise => { const { year = new Date().getFullYear() } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/go/mhlw/pdf.ts b/lib/routes/go/mhlw/pdf.ts index c47ef71791..267916b7ae 100644 --- a/lib/routes/go/mhlw/pdf.ts +++ b/lib/routes/go/mhlw/pdf.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const handler = async (ctx) => { const { category = 'stf/seisakunitsuite/bunya/houkokusuunosuii' } = ctx.req.param(); const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 30; diff --git a/lib/routes/gocn/jobs.ts b/lib/routes/gocn/jobs.ts index 09a676ef29..46a4cc556d 100644 --- a/lib/routes/gocn/jobs.ts +++ b/lib/routes/gocn/jobs.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { renderHTML } from './utils'; export const route: Route = { diff --git a/lib/routes/gocn/news.ts b/lib/routes/gocn/news.ts index 6cefd4e04d..c84538bd38 100644 --- a/lib/routes/gocn/news.ts +++ b/lib/routes/gocn/news.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { renderHTML } from './utils'; export const route: Route = { diff --git a/lib/routes/gocn/topics.ts b/lib/routes/gocn/topics.ts index acbf327ea6..5226d17047 100644 --- a/lib/routes/gocn/topics.ts +++ b/lib/routes/gocn/topics.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { renderHTML } from './utils'; export const route: Route = { diff --git a/lib/routes/gofans/index.ts b/lib/routes/gofans/index.ts index bdcf83dd8a..fb129ee640 100644 --- a/lib/routes/gofans/index.ts +++ b/lib/routes/gofans/index.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:kind?', diff --git a/lib/routes/gogoanimehd/recent-releases.ts b/lib/routes/gogoanimehd/recent-releases.ts index 769ac7b24e..989c2d0208 100644 --- a/lib/routes/gogoanimehd/recent-releases.ts +++ b/lib/routes/gogoanimehd/recent-releases.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/recent-releases', categories: ['anime'], diff --git a/lib/routes/google/album.ts b/lib/routes/google/album.ts index e09bb4955c..39f15f9a91 100644 --- a/lib/routes/google/album.ts +++ b/lib/routes/google/album.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/google/alerts.ts b/lib/routes/google/alerts.ts index f619bc6efb..c7df26f8a7 100644 --- a/lib/routes/google/alerts.ts +++ b/lib/routes/google/alerts.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/alerts/:keyword', categories: ['other'], diff --git a/lib/routes/google/citations.ts b/lib/routes/google/citations.ts index ac0abc0add..f70bbe226b 100644 --- a/lib/routes/google/citations.ts +++ b/lib/routes/google/citations.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/citations/:id', categories: ['journal'], diff --git a/lib/routes/google/developers.ts b/lib/routes/google/developers.ts index 54777fc1bf..4322f5f7d4 100644 --- a/lib/routes/google/developers.ts +++ b/lib/routes/google/developers.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; import type { Context } from 'hono'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + const baseUrl = 'https://developers.googleblog.com'; export const route: Route = { diff --git a/lib/routes/google/doodles.ts b/lib/routes/google/doodles.ts index 723702b2d0..7d695ac590 100644 --- a/lib/routes/google/doodles.ts +++ b/lib/routes/google/doodles.ts @@ -1,4 +1,5 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/google/extension.ts b/lib/routes/google/extension.ts index 5a4b5efae9..4a970fd8db 100644 --- a/lib/routes/google/extension.ts +++ b/lib/routes/google/extension.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/google/fonts.ts b/lib/routes/google/fonts.ts index edc6a5669c..2d5dcda6fa 100644 --- a/lib/routes/google/fonts.ts +++ b/lib/routes/google/fonts.ts @@ -1,11 +1,11 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { config } from '@/config'; -import { art } from '@/utils/render'; import path from 'node:path'; -import { parseDate } from '@/utils/parse-date'; + +import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; const titleMap = { date: 'Newest', diff --git a/lib/routes/google/jules.ts b/lib/routes/google/jules.ts index f3ff756ae1..b732404cde 100644 --- a/lib/routes/google/jules.ts +++ b/lib/routes/google/jules.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/google/news.ts b/lib/routes/google/news.ts index 0e519bd0a0..2bb0fc25ef 100644 --- a/lib/routes/google/news.ts +++ b/lib/routes/google/news.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const baseUrl = 'https://news.google.com'; diff --git a/lib/routes/google/play.ts b/lib/routes/google/play.ts index 07118e01b5..7ebd53272d 100644 --- a/lib/routes/google/play.ts +++ b/lib/routes/google/play.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import type { Context } from 'hono'; import gPlay from 'google-play-scraper'; +import type { Context } from 'hono'; + +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/google/research.ts b/lib/routes/google/research.ts index db5acba430..88f36f1174 100644 --- a/lib/routes/google/research.ts +++ b/lib/routes/google/research.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://research.google'; diff --git a/lib/routes/google/scholar.ts b/lib/routes/google/scholar.ts index a5bca1a837..23d9f571ea 100644 --- a/lib/routes/google/scholar.ts +++ b/lib/routes/google/scholar.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/scholar/:query', categories: ['journal'], diff --git a/lib/routes/google/search.ts b/lib/routes/google/search.ts index fff174e29d..82691f9416 100644 --- a/lib/routes/google/search.ts +++ b/lib/routes/google/search.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; -import { config } from '@/config'; export const route: Route = { path: '/search/:keyword/:language?', diff --git a/lib/routes/gov/ah/kjt.ts b/lib/routes/gov/ah/kjt.ts index 625fd9f7b5..b156a67b71 100644 --- a/lib/routes/gov/ah/kjt.ts +++ b/lib/routes/gov/ah/kjt.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { category = 'kjzx/tzgg' } = ctx.req.param(); diff --git a/lib/routes/gov/beijing/bjedu/gh.ts b/lib/routes/gov/beijing/bjedu/gh.ts index 6355d55c83..528387bfaa 100644 --- a/lib/routes/gov/beijing/bjedu/gh.ts +++ b/lib/routes/gov/beijing/bjedu/gh.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gov/beijing/bphc/index.ts b/lib/routes/gov/beijing/bphc/index.ts index ca1553cd08..320711d551 100644 --- a/lib/routes/gov/beijing/bphc/index.ts +++ b/lib/routes/gov/beijing/bphc/index.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import { getSubPath } from '@/utils/common-utils'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gov/beijing/jw/tzgg.ts b/lib/routes/gov/beijing/jw/tzgg.ts index c72a8147e8..dfd3053b60 100644 --- a/lib/routes/gov/beijing/jw/tzgg.ts +++ b/lib/routes/gov/beijing/jw/tzgg.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/beijing/jw/tzgg', diff --git a/lib/routes/gov/beijing/kw/index.ts b/lib/routes/gov/beijing/kw/index.ts index be65a97e22..bab38a33d5 100644 --- a/lib/routes/gov/beijing/kw/index.ts +++ b/lib/routes/gov/beijing/kw/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootUrl = 'http://kw.beijing.gov.cn'; diff --git a/lib/routes/gov/caac/cjwt.ts b/lib/routes/gov/caac/cjwt.ts index 48aba151f8..54f6c56c15 100644 --- a/lib/routes/gov/caac/cjwt.ts +++ b/lib/routes/gov/caac/cjwt.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/caac/cjwt/:category?', diff --git a/lib/routes/gov/cac/index.ts b/lib/routes/gov/cac/index.ts index 95d46dcbde..1aec93ff59 100644 --- a/lib/routes/gov/cac/index.ts +++ b/lib/routes/gov/cac/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { config } from '@/config'; export const route: Route = { path: '/cac/*', diff --git a/lib/routes/gov/cbirc/index.ts b/lib/routes/gov/cbirc/index.ts index 3b20b41619..dffbc05e38 100644 --- a/lib/routes/gov/cbirc/index.ts +++ b/lib/routes/gov/cbirc/index.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { id = '915' } = ctx.req.param(); diff --git a/lib/routes/gov/ccdi/index.ts b/lib/routes/gov/ccdi/index.ts index 7f870aa69d..9c1f5d7d8a 100644 --- a/lib/routes/gov/ccdi/index.ts +++ b/lib/routes/gov/ccdi/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import { getSubPath } from '@/utils/common-utils'; -import { rootUrl, parseNewsList, parseArticle } from './utils'; + +import { parseArticle, parseNewsList, rootUrl } from './utils'; export const route: Route = { path: '/ccdi/*', diff --git a/lib/routes/gov/ccdi/utils.ts b/lib/routes/gov/ccdi/utils.ts index 667be1a145..ff1366a581 100644 --- a/lib/routes/gov/ccdi/utils.ts +++ b/lib/routes/gov/ccdi/utils.ts @@ -1,10 +1,11 @@ -import cache from '@/utils/cache'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; +import { Cookie, CookieJar } from 'tough-cookie'; + +import cache from '@/utils/cache'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { CookieJar, Cookie } from 'tough-cookie'; const cookieJar = new CookieJar(); const owner = '中央纪委国家监委网站'; @@ -88,4 +89,4 @@ const parseArticle = async (item) => { }); }; -export { rootUrl, parseNewsList, parseArticle }; +export { parseArticle, parseNewsList, rootUrl }; diff --git a/lib/routes/gov/chinamine-safety/util.ts b/lib/routes/gov/chinamine-safety/util.ts index 1e92aaee24..7a5c3bff1a 100644 --- a/lib/routes/gov/chinamine-safety/util.ts +++ b/lib/routes/gov/chinamine-safety/util.ts @@ -1,7 +1,8 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const rootUrl = 'https://www.chinamine-safety.gov.cn'; @@ -69,4 +70,4 @@ const fetchData = ($, currentUrl) => { }; }; -export { rootUrl, processItems, fetchData }; +export { fetchData, processItems, rootUrl }; diff --git a/lib/routes/gov/chinamine-safety/xw.ts b/lib/routes/gov/chinamine-safety/xw.ts index 26c456e957..becd3ff8c9 100644 --- a/lib/routes/gov/chinamine-safety/xw.ts +++ b/lib/routes/gov/chinamine-safety/xw.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; -import { rootUrl, processItems, fetchData } from './util'; +import { fetchData, processItems, rootUrl } from './util'; export const route: Route = { path: '/chinamine-safety/xw/:category{.+}?', diff --git a/lib/routes/gov/chinamine-safety/zfxxgk.ts b/lib/routes/gov/chinamine-safety/zfxxgk.ts index 8c7fe865c2..2b1fdf3c7b 100644 --- a/lib/routes/gov/chinamine-safety/zfxxgk.ts +++ b/lib/routes/gov/chinamine-safety/zfxxgk.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { rootUrl, processItems, fetchData } from './util'; +import { fetchData, processItems, rootUrl } from './util'; export const route: Route = { path: '/chinamine-safety/zfxxgk/:category{.+}?', diff --git a/lib/routes/gov/chinatax/latest.ts b/lib/routes/gov/chinatax/latest.ts index 4e69529abd..a3dabc6279 100644 --- a/lib/routes/gov/chinatax/latest.ts +++ b/lib/routes/gov/chinatax/latest.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/chinatax/latest', diff --git a/lib/routes/gov/chongqing/gzw.ts b/lib/routes/gov/chongqing/gzw.ts index 7ab0938e8d..479d0069d0 100644 --- a/lib/routes/gov/chongqing/gzw.ts +++ b/lib/routes/gov/chongqing/gzw.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/chongqing/gzw/:category{.+}?', diff --git a/lib/routes/gov/chongqing/rsks.ts b/lib/routes/gov/chongqing/rsks.ts index 09f6f66be1..05934b386e 100644 --- a/lib/routes/gov/chongqing/rsks.ts +++ b/lib/routes/gov/chongqing/rsks.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const rsksUrl = 'https://rlsbj.cq.gov.cn/ywzl/rsks/tzgg_109374/'; export const route: Route = { path: '/chongqing/rsks', diff --git a/lib/routes/gov/chongqing/sydwgkzp.ts b/lib/routes/gov/chongqing/sydwgkzp.ts index 7b22e485a6..39b3d318ed 100644 --- a/lib/routes/gov/chongqing/sydwgkzp.ts +++ b/lib/routes/gov/chongqing/sydwgkzp.ts @@ -1,9 +1,10 @@ -import { Route, Data } from '@/types'; +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { Data, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import type { Context } from 'hono'; export const route: Route = { path: '/chongqing/sydwgkzp/:year?', diff --git a/lib/routes/gov/cmse/fxrw.ts b/lib/routes/gov/cmse/fxrw.ts index d138bd1b0f..18e025d9a2 100644 --- a/lib/routes/gov/cmse/fxrw.ts +++ b/lib/routes/gov/cmse/fxrw.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/cmse/fxrw', diff --git a/lib/routes/gov/cmse/index.ts b/lib/routes/gov/cmse/index.ts index ef0f085bf8..299b1e4eb1 100644 --- a/lib/routes/gov/cmse/index.ts +++ b/lib/routes/gov/cmse/index.ts @@ -1,12 +1,12 @@ -import { Route } from '@/types'; - -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 type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/cmse/*', diff --git a/lib/routes/gov/cn/news/index.ts b/lib/routes/gov/cn/news/index.ts index 020f11d63f..510ec2fd94 100644 --- a/lib/routes/gov/cn/news/index.ts +++ b/lib/routes/gov/cn/news/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import logger from '@/utils/logger'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gov/cnnic/index.ts b/lib/routes/gov/cnnic/index.ts index 4a797167a5..9f66c6f4af 100644 --- a/lib/routes/gov/cnnic/index.ts +++ b/lib/routes/gov/cnnic/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -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 type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/cnnic/*', diff --git a/lib/routes/gov/csrc/auditstatus.ts b/lib/routes/gov/csrc/auditstatus.ts index f7f3cf390c..8a01615475 100644 --- a/lib/routes/gov/csrc/auditstatus.ts +++ b/lib/routes/gov/csrc/auditstatus.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; +import md5 from '@/utils/md5'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import md5 from '@/utils/md5'; export const route: Route = { path: '/csrc/auditstatus/:apply_id', diff --git a/lib/routes/gov/csrc/csrc.ts b/lib/routes/gov/csrc/csrc.ts index 7491a7ded8..b0eee4dfa0 100644 --- a/lib/routes/gov/csrc/csrc.ts +++ b/lib/routes/gov/csrc/csrc.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const handler = async (ctx) => { const { id = 'c101972' } = ctx.req.param(); diff --git a/lib/routes/gov/csrc/news.ts b/lib/routes/gov/csrc/news.ts index f6f2a77572..2db23dd1ae 100644 --- a/lib/routes/gov/csrc/news.ts +++ b/lib/routes/gov/csrc/news.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/csrc/news/:suffix{.+}?', diff --git a/lib/routes/gov/customs/list.ts b/lib/routes/gov/customs/list.ts index 27d1b03b12..d28d20200c 100644 --- a/lib/routes/gov/customs/list.ts +++ b/lib/routes/gov/customs/list.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; -import { host, puppeteerGet } from './utils'; + import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import puppeteer from '@/utils/puppeteer'; +import timezone from '@/utils/timezone'; + +import { host, puppeteerGet } from './utils'; export const route: Route = { path: '/customs/list/:gchannel?', diff --git a/lib/routes/gov/dianbai/dianbai.ts b/lib/routes/gov/dianbai/dianbai.ts index 01851d9370..d640188df3 100644 --- a/lib/routes/gov/dianbai/dianbai.ts +++ b/lib/routes/gov/dianbai/dianbai.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { gdgov } from '../general/general'; export const route: Route = { diff --git a/lib/routes/gov/forestry/gjlckjdjt.ts b/lib/routes/gov/forestry/gjlckjdjt.ts index 6fefefdd14..8c6baef001 100644 --- a/lib/routes/gov/forestry/gjlckjdjt.ts +++ b/lib/routes/gov/forestry/gjlckjdjt.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/forestry/gjlckjdjt/:category?', diff --git a/lib/routes/gov/gaozhou/gaozhou.ts b/lib/routes/gov/gaozhou/gaozhou.ts index 38f2025ada..8cf0731e29 100644 --- a/lib/routes/gov/gaozhou/gaozhou.ts +++ b/lib/routes/gov/gaozhou/gaozhou.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { gdgov } from '../general/general'; export const route: Route = { diff --git a/lib/routes/gov/general/general.ts b/lib/routes/gov/general/general.ts index 016d21bf7a..6f0d4e6775 100644 --- a/lib/routes/gov/general/general.ts +++ b/lib/routes/gov/general/general.ts @@ -1,5 +1,7 @@ -import { getSubPath } from '@/utils/common-utils'; +import { load } from 'cheerio'; + import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; // 来人拯救一下啊( >﹏<。) // 待做功能: // 1. 传入和处理 @@ -10,7 +12,6 @@ import cache from '@/utils/cache'; // [] 示例1: http://www.dianbai.gov.cn/ywdt/dbyw/content/post_1091433.html // 4. 处理网站功能 // [] hdjlpt 互动交流 - // 使用方法 // import { gdgov } from '../general/general'; // @@ -36,12 +37,10 @@ import cache from '@/utils/cache'; // }; // await gdgov(info, ctx); // }; - import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; import { finishArticleItem } from '@/utils/wechat-mp'; const gdgov = async (info, ctx) => { diff --git a/lib/routes/gov/guangdong/tqyb/sncsyjxh.ts b/lib/routes/gov/guangdong/tqyb/sncsyjxh.ts index 3c7941f17a..8321dfe757 100644 --- a/lib/routes/gov/guangdong/tqyb/sncsyjxh.ts +++ b/lib/routes/gov/guangdong/tqyb/sncsyjxh.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; const rootUrl = 'http://www.tqyb.com.cn'; diff --git a/lib/routes/gov/guangdong/tqyb/tfxtq.ts b/lib/routes/gov/guangdong/tqyb/tfxtq.ts index d03bb0c2d7..37f2a96c9f 100644 --- a/lib/routes/gov/guangdong/tqyb/tfxtq.ts +++ b/lib/routes/gov/guangdong/tqyb/tfxtq.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; const rootUrl = 'http://www.tqyb.com.cn'; diff --git a/lib/routes/gov/gz/index.ts b/lib/routes/gov/gz/index.ts index 3c9a58a14d..02f799a0f0 100644 --- a/lib/routes/gov/gz/index.ts +++ b/lib/routes/gov/gz/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const rootUrl = 'https://www.gz.gov.cn'; diff --git a/lib/routes/gov/hainan/iitb/tzgg.ts b/lib/routes/gov/hainan/iitb/tzgg.ts index a071279a01..6cb7526dd4 100644 --- a/lib/routes/gov/hainan/iitb/tzgg.ts +++ b/lib/routes/gov/hainan/iitb/tzgg.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/gov/hangzhou/zwfw.ts b/lib/routes/gov/hangzhou/zwfw.ts index 6dd7ff1f56..48a3d36c5b 100644 --- a/lib/routes/gov/hangzhou/zwfw.ts +++ b/lib/routes/gov/hangzhou/zwfw.ts @@ -1,15 +1,17 @@ -import { Route } from '@/types'; +import path from 'node:path'; + import { load } from 'cheerio'; -import puppeteer from '@/utils/puppeteer'; -import ofetch from '@/utils/ofetch'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { crawler, analyzer } from './zjzwfw'; -import timezone from '@/utils/timezone'; -import path from 'node:path'; +import puppeteer from '@/utils/puppeteer'; import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; + +import { analyzer, crawler } from './zjzwfw'; export const route: Route = { path: '/hangzhou/zwfw', diff --git a/lib/routes/gov/hebei/czt.ts b/lib/routes/gov/hebei/czt.ts index ae99435210..e5a56a30a2 100644 --- a/lib/routes/gov/hebei/czt.ts +++ b/lib/routes/gov/hebei/czt.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/gov/huazhou/huazhou.ts b/lib/routes/gov/huazhou/huazhou.ts index 69dc3826aa..3c4e28aadd 100644 --- a/lib/routes/gov/huazhou/huazhou.ts +++ b/lib/routes/gov/huazhou/huazhou.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { gdgov } from '../general/general'; export const route: Route = { diff --git a/lib/routes/gov/huizhou/zwgk/index.ts b/lib/routes/gov/huizhou/zwgk/index.ts index e9bbe8ba6d..b9aaebb0a9 100644 --- a/lib/routes/gov/huizhou/zwgk/index.ts +++ b/lib/routes/gov/huizhou/zwgk/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gov/hunan/changsha/major-email.ts b/lib/routes/gov/hunan/changsha/major-email.ts index 258bf336e3..641076b26e 100644 --- a/lib/routes/gov/hunan/changsha/major-email.ts +++ b/lib/routes/gov/hunan/changsha/major-email.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + const baseUrl = 'http://wlwz.changsha.gov.cn'; export const route: Route = { diff --git a/lib/routes/gov/immiau/news.ts b/lib/routes/gov/immiau/news.ts index efa70ea55f..5222ab30c8 100644 --- a/lib/routes/gov/immiau/news.ts +++ b/lib/routes/gov/immiau/news.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/gov/jgjcndrc/index.ts b/lib/routes/gov/jgjcndrc/index.ts index d4ec56c9b3..c0a0efaaf1 100644 --- a/lib/routes/gov/jgjcndrc/index.ts +++ b/lib/routes/gov/jgjcndrc/index.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { columnId = '1832739866673426433', subColumnId } = ctx.req.param(); diff --git a/lib/routes/gov/jiangsu/wlt/index.ts b/lib/routes/gov/jiangsu/wlt/index.ts index 14b1957b73..1b6ad453e1 100644 --- a/lib/routes/gov/jiangsu/wlt/index.ts +++ b/lib/routes/gov/jiangsu/wlt/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/jiangsu/wlt/:page?', diff --git a/lib/routes/gov/jinan/healthcommission/medical-exam-notice.ts b/lib/routes/gov/jinan/healthcommission/medical-exam-notice.ts index 4e8afa8f99..222fd71eef 100644 --- a/lib/routes/gov/jinan/healthcommission/medical-exam-notice.ts +++ b/lib/routes/gov/jinan/healthcommission/medical-exam-notice.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/jinan/healthcommission/medical_exam_notice', diff --git a/lib/routes/gov/lswz/index.ts b/lib/routes/gov/lswz/index.ts index 69025db062..b712cb5196 100644 --- a/lib/routes/gov/lswz/index.ts +++ b/lib/routes/gov/lswz/index.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { category = 'html/xinwen/index' } = ctx.req.param(); diff --git a/lib/routes/gov/maoming/maoming.ts b/lib/routes/gov/maoming/maoming.ts index b92599091f..916b214941 100644 --- a/lib/routes/gov/maoming/maoming.ts +++ b/lib/routes/gov/maoming/maoming.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import { getSubPath } from '@/utils/common-utils'; + import { gdgov } from '../general/general'; export const route: Route = { diff --git a/lib/routes/gov/maonan/maonan.ts b/lib/routes/gov/maonan/maonan.ts index 581adf52de..e9a0ca4866 100644 --- a/lib/routes/gov/maonan/maonan.ts +++ b/lib/routes/gov/maonan/maonan.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gov/mee/nnsa.ts b/lib/routes/gov/mee/nnsa.ts index a4ecf5615c..129e62ae37 100644 --- a/lib/routes/gov/mee/nnsa.ts +++ b/lib/routes/gov/mee/nnsa.ts @@ -1,14 +1,13 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const { category = 'ywdt/hjyw' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '15', 10); diff --git a/lib/routes/gov/mee/ywdt.ts b/lib/routes/gov/mee/ywdt.ts index 86570a51ff..b027d7648b 100644 --- a/lib/routes/gov/mee/ywdt.ts +++ b/lib/routes/gov/mee/ywdt.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gov/mem/sgcc.ts b/lib/routes/gov/mem/sgcc.ts index 2ddce6a9d3..b3574d4867 100644 --- a/lib/routes/gov/mem/sgcc.ts +++ b/lib/routes/gov/mem/sgcc.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/gov/mem/zfxxgkpt.ts b/lib/routes/gov/mem/zfxxgkpt.ts index 5db799878b..5e650ba126 100644 --- a/lib/routes/gov/mem/zfxxgkpt.ts +++ b/lib/routes/gov/mem/zfxxgkpt.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/gov/mfa/wjdt.ts b/lib/routes/gov/mfa/wjdt.ts index 3d15cb3ca6..ee2375599d 100644 --- a/lib/routes/gov/mfa/wjdt.ts +++ b/lib/routes/gov/mfa/wjdt.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; const categories = { gjldrhd: 'gjldrhd_674881', diff --git a/lib/routes/gov/mgs/mgs.ts b/lib/routes/gov/mgs/mgs.ts index 9d4db65879..ea1c5256ef 100644 --- a/lib/routes/gov/mgs/mgs.ts +++ b/lib/routes/gov/mgs/mgs.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { gdgov } from '../general/general'; export const route: Route = { diff --git a/lib/routes/gov/miit/wjfb.ts b/lib/routes/gov/miit/wjfb.ts index 282a1054ec..9d0cadc87e 100644 --- a/lib/routes/gov/miit/wjfb.ts +++ b/lib/routes/gov/miit/wjfb.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootUrl = 'https://www.miit.gov.cn'; diff --git a/lib/routes/gov/miit/wjgs.ts b/lib/routes/gov/miit/wjgs.ts index c6a6c74224..ba9156c15f 100644 --- a/lib/routes/gov/miit/wjgs.ts +++ b/lib/routes/gov/miit/wjgs.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + const baseUrl = 'https://www.miit.gov.cn'; const siteUrl = `${baseUrl}/zwgk/wjgs/index.html`; diff --git a/lib/routes/gov/miit/yjzj.ts b/lib/routes/gov/miit/yjzj.ts index cd0a901962..a7ac3584f3 100644 --- a/lib/routes/gov/miit/yjzj.ts +++ b/lib/routes/gov/miit/yjzj.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootUrl = 'https://www.miit.gov.cn'; diff --git a/lib/routes/gov/miit/zcjd.ts b/lib/routes/gov/miit/zcjd.ts index ad966c1124..16888942dd 100644 --- a/lib/routes/gov/miit/zcjd.ts +++ b/lib/routes/gov/miit/zcjd.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + const baseUrl = 'https://www.miit.gov.cn'; const siteUrl = `${baseUrl}/zwgk/zcjd/index.html`; diff --git a/lib/routes/gov/miit/zcwj.ts b/lib/routes/gov/miit/zcwj.ts index 3aac4d5ccb..35a92504f5 100644 --- a/lib/routes/gov/miit/zcwj.ts +++ b/lib/routes/gov/miit/zcwj.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/miit/zcwj', diff --git a/lib/routes/gov/mmht/mmht.ts b/lib/routes/gov/mmht/mmht.ts index ee5acd9c23..355cf25f8c 100644 --- a/lib/routes/gov/mmht/mmht.ts +++ b/lib/routes/gov/mmht/mmht.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { gdgov } from '../general/general'; export const route: Route = { diff --git a/lib/routes/gov/moa/gjs.ts b/lib/routes/gov/moa/gjs.ts index 7b5bd12be5..715e542a56 100644 --- a/lib/routes/gov/moa/gjs.ts +++ b/lib/routes/gov/moa/gjs.ts @@ -1,14 +1,13 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const { category = 'gzdt' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/gov/moa/moa.ts b/lib/routes/gov/moa/moa.ts index fa5b1cdb2a..3460037170 100644 --- a/lib/routes/gov/moa/moa.ts +++ b/lib/routes/gov/moa/moa.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseRelativeDate } from '@/utils/parse-date'; const hostUrl = 'http://www.moa.gov.cn/'; diff --git a/lib/routes/gov/moa/szcpxx.ts b/lib/routes/gov/moa/szcpxx.ts index b8dff425aa..ea83941fe9 100644 --- a/lib/routes/gov/moa/szcpxx.ts +++ b/lib/routes/gov/moa/szcpxx.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const handler = async (ctx) => { const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 6; diff --git a/lib/routes/gov/moa/zdscxx.ts b/lib/routes/gov/moa/zdscxx.ts index 4a5aafb105..efbee0e64d 100644 --- a/lib/routes/gov/moa/zdscxx.ts +++ b/lib/routes/gov/moa/zdscxx.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const handler = async (ctx) => { diff --git a/lib/routes/gov/moe/moe.ts b/lib/routes/gov/moe/moe.ts index 716b8ea2f9..6334ebc71f 100644 --- a/lib/routes/gov/moe/moe.ts +++ b/lib/routes/gov/moe/moe.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import logger from '@/utils/logger'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/gov/moe/s78.ts b/lib/routes/gov/moe/s78.ts index e575d2edc8..9968fb8912 100644 --- a/lib/routes/gov/moe/s78.ts +++ b/lib/routes/gov/moe/s78.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gov/mof/bond.ts b/lib/routes/gov/mof/bond.ts index a38d34b748..6e703b03a2 100644 --- a/lib/routes/gov/mof/bond.ts +++ b/lib/routes/gov/mof/bond.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; const domain = 'gks.mof.gov.cn'; const theme = 'guozaiguanli'; diff --git a/lib/routes/gov/mof/gss.ts b/lib/routes/gov/mof/gss.ts index 46a5c40ef4..ef91fd99d3 100644 --- a/lib/routes/gov/mof/gss.ts +++ b/lib/routes/gov/mof/gss.ts @@ -1,10 +1,11 @@ -import { Data, Route } from '@/types'; +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { Data, Route } from '@/types'; 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 { Context } from 'hono'; +import timezone from '@/utils/timezone'; const DOMAIN = 'gss.mof.gov.cn'; diff --git a/lib/routes/gov/mofcom/article.ts b/lib/routes/gov/mofcom/article.ts index 4e7f66757b..6fd06e75fc 100644 --- a/lib/routes/gov/mofcom/article.ts +++ b/lib/routes/gov/mofcom/article.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gov/moj/aac/news.ts b/lib/routes/gov/moj/aac/news.ts index 7eccf2a487..e1676f5e6c 100644 --- a/lib/routes/gov/moj/aac/news.ts +++ b/lib/routes/gov/moj/aac/news.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + const baseUrl = 'https://www.aac.moj.gov.tw'; export const route: Route = { diff --git a/lib/routes/gov/moj/lfyjzj.ts b/lib/routes/gov/moj/lfyjzj.ts index 1f5a909a11..5e905f8833 100644 --- a/lib/routes/gov/moj/lfyjzj.ts +++ b/lib/routes/gov/moj/lfyjzj.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; const DOMAIN = 'www.moj.gov.cn'; diff --git a/lib/routes/gov/mot/index.ts b/lib/routes/gov/mot/index.ts index 13944a1850..34aaaaa617 100644 --- a/lib/routes/gov/mot/index.ts +++ b/lib/routes/gov/mot/index.ts @@ -1,13 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const { category = 'jiaotongyaowen' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/gov/ndrc/fggz.ts b/lib/routes/gov/ndrc/fggz.ts index 92f248ea69..118edca9e5 100644 --- a/lib/routes/gov/ndrc/fggz.ts +++ b/lib/routes/gov/ndrc/fggz.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/ndrc/fggz/:category{.+}?', diff --git a/lib/routes/gov/ndrc/xwdt.ts b/lib/routes/gov/ndrc/xwdt.ts index 3c70506826..ddb1b51678 100644 --- a/lib/routes/gov/ndrc/xwdt.ts +++ b/lib/routes/gov/ndrc/xwdt.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gov/ndrc/zfxxgk.ts b/lib/routes/gov/ndrc/zfxxgk.ts index 72e274ba35..6a6f67e2e4 100644 --- a/lib/routes/gov/ndrc/zfxxgk.ts +++ b/lib/routes/gov/ndrc/zfxxgk.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const handler = async (ctx) => { diff --git a/lib/routes/gov/nea/ghs.ts b/lib/routes/gov/nea/ghs.ts index 3de98e980c..adae6b0b75 100644 --- a/lib/routes/gov/nea/ghs.ts +++ b/lib/routes/gov/nea/ghs.ts @@ -1,9 +1,11 @@ -import type { Route, DataItem } from '@/types'; +import { URL } from 'node:url'; + +import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { URL } from 'node:url'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/gov/nifdc/index.ts b/lib/routes/gov/nifdc/index.ts index 8f77418893..d3be4dbb1f 100644 --- a/lib/routes/gov/nifdc/index.ts +++ b/lib/routes/gov/nifdc/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/nifdc/:path{.+}?', diff --git a/lib/routes/gov/nmpa/generic.ts b/lib/routes/gov/nmpa/generic.ts index aec4789577..99d0628771 100644 --- a/lib/routes/gov/nmpa/generic.ts +++ b/lib/routes/gov/nmpa/generic.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; -import { parseDate } from '@/utils/parse-date'; -import { finishArticleItem } from '@/utils/wechat-mp'; + import { config } from '@/config'; -const baseUrl = 'https://www.nmpa.gov.cn'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; +import { finishArticleItem } from '@/utils/wechat-mp'; + +const baseUrl = 'https://www.nmpa.gov.cn'; export const route: Route = { path: '/nmpa/*', diff --git a/lib/routes/gov/nopss/index.ts b/lib/routes/gov/nopss/index.ts index ffc8c3a4e1..99a7219d49 100644 --- a/lib/routes/gov/nopss/index.ts +++ b/lib/routes/gov/nopss/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/nopss/*', diff --git a/lib/routes/gov/npc/index.ts b/lib/routes/gov/npc/index.ts index 94cf496766..e4fe2bd0e0 100644 --- a/lib/routes/gov/npc/index.ts +++ b/lib/routes/gov/npc/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gov/nrta/dsj.ts b/lib/routes/gov/nrta/dsj.ts index 275af3afcf..667178e143 100644 --- a/lib/routes/gov/nrta/dsj.ts +++ b/lib/routes/gov/nrta/dsj.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import pMap from 'p-map'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import pMap from 'p-map'; export const route: Route = { path: '/nrta/dsj/:category?', diff --git a/lib/routes/gov/nrta/news.ts b/lib/routes/gov/nrta/news.ts index 8607eeb173..8cd9d7ee05 100644 --- a/lib/routes/gov/nrta/news.ts +++ b/lib/routes/gov/nrta/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gov/nsfc/index.ts b/lib/routes/gov/nsfc/index.ts index cfc790803a..1ece4920b9 100644 --- a/lib/routes/gov/nsfc/index.ts +++ b/lib/routes/gov/nsfc/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import shortcuts from './shortcuts'; diff --git a/lib/routes/gov/pbc/goutongjiaoliu.ts b/lib/routes/gov/pbc/goutongjiaoliu.ts index 3cfa5365ab..76dc0cec41 100644 --- a/lib/routes/gov/pbc/goutongjiaoliu.ts +++ b/lib/routes/gov/pbc/goutongjiaoliu.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import puppeteer from '@/utils/puppeteer'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/pbc/goutongjiaoliu', diff --git a/lib/routes/gov/pbc/gzlw.ts b/lib/routes/gov/pbc/gzlw.ts index e1dd5bc364..7d54b5c9f5 100644 --- a/lib/routes/gov/pbc/gzlw.ts +++ b/lib/routes/gov/pbc/gzlw.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import { processItems } from './utils'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import { processItems } from './utils'; + const host = 'http://www.pbc.gov.cn'; export const route: Route = { diff --git a/lib/routes/gov/pbc/trade-announcement.ts b/lib/routes/gov/pbc/trade-announcement.ts index 74e39550f9..0a36214294 100644 --- a/lib/routes/gov/pbc/trade-announcement.ts +++ b/lib/routes/gov/pbc/trade-announcement.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import puppeteer from '@/utils/puppeteer'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/pbc/tradeAnnouncement', diff --git a/lib/routes/gov/pbc/utils.ts b/lib/routes/gov/pbc/utils.ts index 2e7ed00b62..2fc8468a25 100644 --- a/lib/routes/gov/pbc/utils.ts +++ b/lib/routes/gov/pbc/utils.ts @@ -1,6 +1,7 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; const processItems = (list) => Promise.all( diff --git a/lib/routes/gov/pbc/zcyj.ts b/lib/routes/gov/pbc/zcyj.ts index 27936fa2e0..29d8fa34fc 100644 --- a/lib/routes/gov/pbc/zcyj.ts +++ b/lib/routes/gov/pbc/zcyj.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; -import { processItems } from './utils'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; +import { processItems } from './utils'; + const host = 'http://www.pbc.gov.cn'; export const route: Route = { diff --git a/lib/routes/gov/pudong/zwgk.ts b/lib/routes/gov/pudong/zwgk.ts index 4bf720ee1e..ba93e58343 100644 --- a/lib/routes/gov/pudong/zwgk.ts +++ b/lib/routes/gov/pudong/zwgk.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; // 解析日期的工具函数 + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; // 解析日期的工具函数 export const route: Route = { path: '/pudong/zwgk', diff --git a/lib/routes/gov/safe/business.ts b/lib/routes/gov/safe/business.ts index 4fe4951c66..fc54eef0d9 100644 --- a/lib/routes/gov/safe/business.ts +++ b/lib/routes/gov/safe/business.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { processZxfkItems } from './util'; export const route: Route = { diff --git a/lib/routes/gov/safe/complaint.ts b/lib/routes/gov/safe/complaint.ts index a03bb0119b..c45ef580bd 100644 --- a/lib/routes/gov/safe/complaint.ts +++ b/lib/routes/gov/safe/complaint.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { processZxfkItems } from './util'; export const route: Route = { diff --git a/lib/routes/gov/safe/util.ts b/lib/routes/gov/safe/util.ts index 19eaed7c53..ab48c67e1a 100644 --- a/lib/routes/gov/safe/util.ts +++ b/lib/routes/gov/safe/util.ts @@ -1,8 +1,10 @@ -import got from '@/utils/got'; +import path from 'node:path'; + import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const rootUrl = 'https://www.safe.gov.cn'; diff --git a/lib/routes/gov/samr/xgzlyhd.ts b/lib/routes/gov/samr/xgzlyhd.ts index b61b0776da..70ceb4349e 100644 --- a/lib/routes/gov/samr/xgzlyhd.ts +++ b/lib/routes/gov/samr/xgzlyhd.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const rootUrl = 'https://xgzlyhd.samr.gov.cn'; const apiUrl = new URL('gjjly/message/getMessageList', rootUrl).href; diff --git a/lib/routes/gov/sasac/generic.ts b/lib/routes/gov/sasac/generic.ts index 4612868106..06a1e0117c 100644 --- a/lib/routes/gov/sasac/generic.ts +++ b/lib/routes/gov/sasac/generic.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/gov/sdb/sdb.ts b/lib/routes/gov/sdb/sdb.ts index f34015a389..20883d6b6f 100644 --- a/lib/routes/gov/sdb/sdb.ts +++ b/lib/routes/gov/sdb/sdb.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { gdgov } from '../general/general'; export const route: Route = { diff --git a/lib/routes/gov/sh/fgw/index.ts b/lib/routes/gov/sh/fgw/index.ts index dbecd57858..93e0c49662 100644 --- a/lib/routes/gov/sh/fgw/index.ts +++ b/lib/routes/gov/sh/fgw/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 path from 'node:path'; +import timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { category = 'fgw_zxxxgk' } = ctx.req.param(); diff --git a/lib/routes/gov/sh/rsj/ksxm.ts b/lib/routes/gov/sh/rsj/ksxm.ts index 402b4e4f5c..2ed2594658 100644 --- a/lib/routes/gov/sh/rsj/ksxm.ts +++ b/lib/routes/gov/sh/rsj/ksxm.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; const rootUrl = 'http://www.rsj.sh.gov.cn'; diff --git a/lib/routes/gov/sh/wgj/wgj.ts b/lib/routes/gov/sh/wgj/wgj.ts index 105efff699..c982576433 100644 --- a/lib/routes/gov/sh/wgj/wgj.ts +++ b/lib/routes/gov/sh/wgj/wgj.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: ['/sh/wgj/:page?', '/shanghai/wgj/:page?'], diff --git a/lib/routes/gov/sh/wsjkw/yqtb/index.ts b/lib/routes/gov/sh/wsjkw/yqtb/index.ts index 298476c1ad..003cb60a19 100644 --- a/lib/routes/gov/sh/wsjkw/yqtb/index.ts +++ b/lib/routes/gov/sh/wsjkw/yqtb/index.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/gov/sh/yjj/index.ts b/lib/routes/gov/sh/yjj/index.ts index 973c2fede7..80e209605b 100644 --- a/lib/routes/gov/sh/yjj/index.ts +++ b/lib/routes/gov/sh/yjj/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -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 type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: ['/sh/yjj/*', '/shanghai/yjj/*'], diff --git a/lib/routes/gov/shaanxi/kjt.ts b/lib/routes/gov/shaanxi/kjt.ts index c13763fa7d..9988b1153d 100644 --- a/lib/routes/gov/shaanxi/kjt.ts +++ b/lib/routes/gov/shaanxi/kjt.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/shaanxi/kjt/:id?', diff --git a/lib/routes/gov/shenzhen/hrss/szksy/index.ts b/lib/routes/gov/shenzhen/hrss/szksy/index.ts index 24653b20e3..2aa7aade1a 100644 --- a/lib/routes/gov/shenzhen/hrss/szksy/index.ts +++ b/lib/routes/gov/shenzhen/hrss/szksy/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gov/shenzhen/szlh/index.ts b/lib/routes/gov/shenzhen/szlh/index.ts index 2ff4df7841..8f83d37e8f 100644 --- a/lib/routes/gov/shenzhen/szlh/index.ts +++ b/lib/routes/gov/shenzhen/szlh/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const config = { tzgg: { diff --git a/lib/routes/gov/shenzhen/xxgk/zfxxgj.ts b/lib/routes/gov/shenzhen/xxgk/zfxxgj.ts index 0c129f15a6..85407af13d 100644 --- a/lib/routes/gov/shenzhen/xxgk/zfxxgj.ts +++ b/lib/routes/gov/shenzhen/xxgk/zfxxgj.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; + const rootUrl = 'http://www.sz.gov.cn/cn/xxgk/zfxxgj/'; const config = { diff --git a/lib/routes/gov/shenzhen/zjj/index.ts b/lib/routes/gov/shenzhen/zjj/index.ts index 86c47cc673..8032e08d3a 100644 --- a/lib/routes/gov/shenzhen/zjj/index.ts +++ b/lib/routes/gov/shenzhen/zjj/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const config = { tzgg: { diff --git a/lib/routes/gov/shenzhen/zzb/index.ts b/lib/routes/gov/shenzhen/zzb/index.ts index a3650db5b7..6bb742ab2d 100644 --- a/lib/routes/gov/shenzhen/zzb/index.ts +++ b/lib/routes/gov/shenzhen/zzb/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gov/sichuan/deyang/govpublicinfo.ts b/lib/routes/gov/sichuan/deyang/govpublicinfo.ts index 9361ff12be..8d968c0589 100644 --- a/lib/routes/gov/sichuan/deyang/govpublicinfo.ts +++ b/lib/routes/gov/sichuan/deyang/govpublicinfo.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; import timezone from '@/utils/timezone'; // 各地区url信息 diff --git a/lib/routes/gov/sichuan/deyang/mztoday.ts b/lib/routes/gov/sichuan/deyang/mztoday.ts index f57aed81c7..0fa37d6c3a 100644 --- a/lib/routes/gov/sichuan/deyang/mztoday.ts +++ b/lib/routes/gov/sichuan/deyang/mztoday.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; import timezone from '@/utils/timezone'; const rootUrl = 'http://www.mztoday.gov.cn'; diff --git a/lib/routes/gov/stats/index.ts b/lib/routes/gov/stats/index.ts index 241cebd6ac..2036997d7d 100644 --- a/lib/routes/gov/stats/index.ts +++ b/lib/routes/gov/stats/index.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/stats/*', diff --git a/lib/routes/gov/suzhou/doc.ts b/lib/routes/gov/suzhou/doc.ts index 13966d233d..e3f26e02e2 100644 --- a/lib/routes/gov/suzhou/doc.ts +++ b/lib/routes/gov/suzhou/doc.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gov/suzhou/fg.ts b/lib/routes/gov/suzhou/fg.ts index e32c8c5702..1d36dd3071 100644 --- a/lib/routes/gov/suzhou/fg.ts +++ b/lib/routes/gov/suzhou/fg.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/suzhou/fg/:category{.+}?', diff --git a/lib/routes/gov/suzhou/news.ts b/lib/routes/gov/suzhou/news.ts index 727a06130b..e370c9f138 100644 --- a/lib/routes/gov/suzhou/news.ts +++ b/lib/routes/gov/suzhou/news.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; export const route: Route = { path: '/suzhou/news/:uid', diff --git a/lib/routes/gov/taiyuan/rsj.ts b/lib/routes/gov/taiyuan/rsj.ts index 7b49178e6a..bdf8bcd1a3 100644 --- a/lib/routes/gov/taiyuan/rsj.ts +++ b/lib/routes/gov/taiyuan/rsj.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gov/tianjin/tjftz.ts b/lib/routes/gov/tianjin/tjftz.ts index d84c7fe152..7a4d69e628 100644 --- a/lib/routes/gov/tianjin/tjftz.ts +++ b/lib/routes/gov/tianjin/tjftz.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/gov/tianjin/tjrcgzw.ts b/lib/routes/gov/tianjin/tjrcgzw.ts index 55af4408ce..1c59112962 100644 --- a/lib/routes/gov/tianjin/tjrcgzw.ts +++ b/lib/routes/gov/tianjin/tjrcgzw.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + export const route: Route = { path: '/tianjin/tjrcgzw-notice/:cate/:subCate', categories: ['government'], diff --git a/lib/routes/gov/wuhan/whyw.ts b/lib/routes/gov/wuhan/whyw.ts index b0b0330eef..6f2f4ec943 100644 --- a/lib/routes/gov/wuhan/whyw.ts +++ b/lib/routes/gov/wuhan/whyw.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gov/xinyi/xinyi.ts b/lib/routes/gov/xinyi/xinyi.ts index b79835f673..496b185a83 100644 --- a/lib/routes/gov/xinyi/xinyi.ts +++ b/lib/routes/gov/xinyi/xinyi.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { gdgov } from '../general/general'; export const route: Route = { diff --git a/lib/routes/gov/xuzhou/hrss.ts b/lib/routes/gov/xuzhou/hrss.ts index 8855ad0729..37d4f8ae9d 100644 --- a/lib/routes/gov/xuzhou/hrss.ts +++ b/lib/routes/gov/xuzhou/hrss.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/xuzhou/hrss/:category?', diff --git a/lib/routes/gov/zhejiang/gwy.ts b/lib/routes/gov/zhejiang/gwy.ts index e0276fb6da..d041d10273 100644 --- a/lib/routes/gov/zhejiang/gwy.ts +++ b/lib/routes/gov/zhejiang/gwy.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/gov/zhengce/govall.ts b/lib/routes/gov/zhengce/govall.ts index fe3fb7da1d..f39868276b 100644 --- a/lib/routes/gov/zhengce/govall.ts +++ b/lib/routes/gov/zhengce/govall.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gov/zhengce/index.ts b/lib/routes/gov/zhengce/index.ts index 1c648fc547..aa9bb62625 100644 --- a/lib/routes/gov/zhengce/index.ts +++ b/lib/routes/gov/zhengce/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: ['/zhengce/zuixin', '/zhengce/:category{.+}?'], diff --git a/lib/routes/gov/zhengce/wenjian.ts b/lib/routes/gov/zhengce/wenjian.ts index 29b407d1ca..4d3356b94f 100644 --- a/lib/routes/gov/zhengce/wenjian.ts +++ b/lib/routes/gov/zhengce/wenjian.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gov/zhengce/zhengceku.ts b/lib/routes/gov/zhengce/zhengceku.ts index d72588e11e..21149cbd4a 100644 --- a/lib/routes/gov/zhengce/zhengceku.ts +++ b/lib/routes/gov/zhengce/zhengceku.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import buildData from '@/utils/common-config'; export const route: Route = { diff --git a/lib/routes/gov/zj/ningbogzw-notice.ts b/lib/routes/gov/zj/ningbogzw-notice.ts index f3454f46c0..b78c0f3edb 100644 --- a/lib/routes/gov/zj/ningbogzw-notice.ts +++ b/lib/routes/gov/zj/ningbogzw-notice.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/gov/zj/ningborsjnotice.ts b/lib/routes/gov/zj/ningborsjnotice.ts index 5f3d9202aa..a9a73e572a 100644 --- a/lib/routes/gov/zj/ningborsjnotice.ts +++ b/lib/routes/gov/zj/ningborsjnotice.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/gov/zj/search.ts b/lib/routes/gov/zj/search.ts index e8c0bd9efb..623579719f 100644 --- a/lib/routes/gov/zj/search.ts +++ b/lib/routes/gov/zj/search.ts @@ -1,8 +1,10 @@ -import { Route, DataItem } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import got from '@/utils/got'; import { load } from 'cheerio'; import dayjs from 'dayjs'; + +import type { DataItem, Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + export const route: Route = { path: '/zj/search/:websiteid?/:word/:cateid?', categories: ['government'], diff --git a/lib/routes/gq/news.ts b/lib/routes/gq/news.ts index 3ccba09561..23de73a3e0 100644 --- a/lib/routes/gq/news.ts +++ b/lib/routes/gq/news.ts @@ -1,8 +1,11 @@ -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; -import parser from '@/utils/rss-parser'; import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import parser from '@/utils/rss-parser'; + const host = 'https://www.gq.com'; export const route: Route = { path: '/news', diff --git a/lib/routes/grainoil/category.ts b/lib/routes/grainoil/category.ts index 801649dcde..180ee384d1 100644 --- a/lib/routes/grainoil/category.ts +++ b/lib/routes/grainoil/category.ts @@ -1,13 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const { category, id } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/greasyfork/feedback.ts b/lib/routes/greasyfork/feedback.ts index de5bfa5804..d837e55575 100644 --- a/lib/routes/greasyfork/feedback.ts +++ b/lib/routes/greasyfork/feedback.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/greasyfork/scripts.ts b/lib/routes/greasyfork/scripts.ts index 48447e2af5..e9ee07e2a0 100644 --- a/lib/routes/greasyfork/scripts.ts +++ b/lib/routes/greasyfork/scripts.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/greasyfork/versions.ts b/lib/routes/greasyfork/versions.ts index 5ece426a43..8c42ad56ac 100644 --- a/lib/routes/greasyfork/versions.ts +++ b/lib/routes/greasyfork/versions.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/grist/featured.ts b/lib/routes/grist/featured.ts index dcc6f306e7..79901e2fe6 100644 --- a/lib/routes/grist/featured.ts +++ b/lib/routes/grist/featured.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import { getData, getList } from './utils'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + +import { getData, getList } from './utils'; + export const route: Route = { path: '/featured', categories: ['new-media'], diff --git a/lib/routes/grist/index.ts b/lib/routes/grist/index.ts index 2a0232bed4..fb9ea7cce3 100644 --- a/lib/routes/grist/index.ts +++ b/lib/routes/grist/index.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { getData, getList } from './utils'; export const route: Route = { diff --git a/lib/routes/grist/series.ts b/lib/routes/grist/series.ts index 0425502e06..e0c1c34f37 100644 --- a/lib/routes/grist/series.ts +++ b/lib/routes/grist/series.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { getData, getList } from './utils'; export const route: Route = { diff --git a/lib/routes/grist/topic.ts b/lib/routes/grist/topic.ts index ea41be09ac..28fa9b6557 100644 --- a/lib/routes/grist/topic.ts +++ b/lib/routes/grist/topic.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { getData, getList } from './utils'; export const route: Route = { diff --git a/lib/routes/grubstreet/index.ts b/lib/routes/grubstreet/index.ts index 77212aa0d8..18709bb0ac 100644 --- a/lib/routes/grubstreet/index.ts +++ b/lib/routes/grubstreet/index.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/grubstreet/utils.ts b/lib/routes/grubstreet/utils.ts index b86687531f..c56dece20c 100644 --- a/lib/routes/grubstreet/utils.ts +++ b/lib/routes/grubstreet/utils.ts @@ -1,6 +1,7 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; async function loadContent(link) { const response = await got(link); diff --git a/lib/routes/gs/developer/blog.ts b/lib/routes/gs/developer/blog.ts index 36fc4ec299..5f85252361 100644 --- a/lib/routes/gs/developer/blog.ts +++ b/lib/routes/gs/developer/blog.ts @@ -1,7 +1,8 @@ -import { Route, Data } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import type { Data, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + export const route: Route = { path: '/developer/blog', categories: ['blog'], diff --git a/lib/routes/guancha/headline.ts b/lib/routes/guancha/headline.ts index 3e09b26158..fcd522e7b3 100644 --- a/lib/routes/guancha/headline.ts +++ b/lib/routes/guancha/headline.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/headline', diff --git a/lib/routes/guancha/index.ts b/lib/routes/guancha/index.ts index 33616cbf59..11a3386325 100644 --- a/lib/routes/guancha/index.ts +++ b/lib/routes/guancha/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const config = { review: { diff --git a/lib/routes/guancha/member.ts b/lib/routes/guancha/member.ts index 4f943f3434..3a893e425d 100644 --- a/lib/routes/guancha/member.ts +++ b/lib/routes/guancha/member.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const titles = { recommend: '精选', diff --git a/lib/routes/guancha/personalpage.ts b/lib/routes/guancha/personalpage.ts index 16c8d199ce..74f482dde5 100644 --- a/lib/routes/guancha/personalpage.ts +++ b/lib/routes/guancha/personalpage.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/guancha/topic.ts b/lib/routes/guancha/topic.ts index 11febb3251..f2dc57f517 100644 --- a/lib/routes/guancha/topic.ts +++ b/lib/routes/guancha/topic.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseRelativeDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/guangdiu/cheaps.ts b/lib/routes/guangdiu/cheaps.ts index 74ed403dbe..e744269de8 100644 --- a/lib/routes/guangdiu/cheaps.ts +++ b/lib/routes/guangdiu/cheaps.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseRelativeDate } from '@/utils/parse-date'; const host = 'https://guangdiu.com'; diff --git a/lib/routes/guangdiu/index.ts b/lib/routes/guangdiu/index.ts index cb0f543581..83bfe2e785 100644 --- a/lib/routes/guangdiu/index.ts +++ b/lib/routes/guangdiu/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseRelativeDate } from '@/utils/parse-date'; const host = 'https://guangdiu.com'; diff --git a/lib/routes/guangdiu/rank.ts b/lib/routes/guangdiu/rank.ts index 6221763118..9c880bd424 100644 --- a/lib/routes/guangdiu/rank.ts +++ b/lib/routes/guangdiu/rank.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseRelativeDate } from '@/utils/parse-date'; const host = 'https://guangdiu.com'; diff --git a/lib/routes/guangdiu/search.ts b/lib/routes/guangdiu/search.ts index b04aa025c8..3b6e327a60 100644 --- a/lib/routes/guangdiu/search.ts +++ b/lib/routes/guangdiu/search.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseRelativeDate } from '@/utils/parse-date'; const host = 'https://guangdiu.com'; diff --git a/lib/routes/guangzhoumetro/news.ts b/lib/routes/guangzhoumetro/news.ts index 025c2cf12d..ef09a42ee8 100644 --- a/lib/routes/guangzhoumetro/news.ts +++ b/lib/routes/guangzhoumetro/news.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/guanhai/index.ts b/lib/routes/guanhai/index.ts index 220dbe8dee..ed33d1960e 100644 --- a/lib/routes/guanhai/index.ts +++ b/lib/routes/guanhai/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/guduodata/daily.ts b/lib/routes/guduodata/daily.ts index 3aa987b51a..ca717ed266 100644 --- a/lib/routes/guduodata/daily.ts +++ b/lib/routes/guduodata/daily.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import dayjs from 'dayjs'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import dayjs from 'dayjs'; import { art } from '@/utils/render'; -import path from 'node:path'; const host = 'http://d.guduodata.com'; diff --git a/lib/routes/gumroad/index.ts b/lib/routes/gumroad/index.ts index bc4789c89d..1f348988c5 100644 --- a/lib/routes/gumroad/index.ts +++ b/lib/routes/gumroad/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; -import { isValidHost } from '@/utils/valid-host'; + +import { load } from 'cheerio'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; +import { isValidHost } from '@/utils/valid-host'; export const route: Route = { path: '/:username/:products', diff --git a/lib/routes/guokr/channel.ts b/lib/routes/guokr/channel.ts index b70d08631a..bac498899e 100644 --- a/lib/routes/guokr/channel.ts +++ b/lib/routes/guokr/channel.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import { parseList, parseItem } from './utils'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import { parseItem, parseList } from './utils'; const channelMap = { calendar: 'pac', diff --git a/lib/routes/guokr/scientific.ts b/lib/routes/guokr/scientific.ts index 691f1cc4fb..4225f069fb 100644 --- a/lib/routes/guokr/scientific.ts +++ b/lib/routes/guokr/scientific.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import { parseList, parseItem } from './utils'; + +import { parseItem, parseList } from './utils'; export const route: Route = { path: '/scientific', diff --git a/lib/routes/guokr/utils.ts b/lib/routes/guokr/utils.ts index 7fb1a041a7..b6bc262edf 100644 --- a/lib/routes/guokr/utils.ts +++ b/lib/routes/guokr/utils.ts @@ -1,7 +1,8 @@ -import { parseDate } from '@/utils/parse-date'; +import * as cheerio from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import * as cheerio from 'cheerio'; +import { parseDate } from '@/utils/parse-date'; export const parseList = (result) => result.map((item) => ({ diff --git a/lib/routes/guozaoke/index.ts b/lib/routes/guozaoke/index.ts index 0e71195b49..8b813f3700 100644 --- a/lib/routes/guozaoke/index.ts +++ b/lib/routes/guozaoke/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseRelativeDate } from '@/utils/parse-date'; -import { config } from '@/config'; -import cache from '@/utils/cache'; import pMap from 'p-map'; +import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseRelativeDate } from '@/utils/parse-date'; + export const route: Route = { path: '/default', categories: ['bbs'], diff --git a/lib/routes/gxmzu/ai.ts b/lib/routes/gxmzu/ai.ts index 1dcc4680ed..f62b7bf43b 100644 --- a/lib/routes/gxmzu/ai.ts +++ b/lib/routes/gxmzu/ai.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { getNoticeList } from './utils'; const url = 'https://ai.gxmzu.edu.cn/index/tzgg.htm'; diff --git a/lib/routes/gxmzu/lib.ts b/lib/routes/gxmzu/lib.ts index b73c8e4da8..e3091e3d6d 100644 --- a/lib/routes/gxmzu/lib.ts +++ b/lib/routes/gxmzu/lib.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; // 使用ofetch库代替got -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gxmzu/utils/index.ts b/lib/routes/gxmzu/utils/index.ts index db107b7b02..b3a8d9c1ce 100644 --- a/lib/routes/gxmzu/utils/index.ts +++ b/lib/routes/gxmzu/utils/index.ts @@ -1,6 +1,7 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; // 使用ofetch库代替got -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/gxmzu/yjs.ts b/lib/routes/gxmzu/yjs.ts index 33a1281673..1ca62e1dc9 100644 --- a/lib/routes/gxmzu/yjs.ts +++ b/lib/routes/gxmzu/yjs.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { getNoticeList } from './utils'; const url = 'https://yjs.gxmzu.edu.cn/tzgg/zsgg.htm'; diff --git a/lib/routes/gzdaily/app.ts b/lib/routes/gzdaily/app.ts index 1ddfd24df8..f226afddb4 100644 --- a/lib/routes/gzdaily/app.ts +++ b/lib/routes/gzdaily/app.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/app/:column?', diff --git a/lib/routes/gzhu/yjs.ts b/lib/routes/gzhu/yjs.ts index 9570871958..fee27438fa 100644 --- a/lib/routes/gzhu/yjs.ts +++ b/lib/routes/gzhu/yjs.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/hackernews/index.ts b/lib/routes/hackernews/index.ts index 9616011da5..da483c90d9 100644 --- a/lib/routes/hackernews/index.ts +++ b/lib/routes/hackernews/index.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/hackertalk/index.ts b/lib/routes/hackertalk/index.ts index 99b8e48951..6078c7bada 100644 --- a/lib/routes/hackertalk/index.ts +++ b/lib/routes/hackertalk/index.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; +import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import MarkdownIt from 'markdown-it'; + const md = MarkdownIt(); export const route: Route = { diff --git a/lib/routes/hacking8/index.ts b/lib/routes/hacking8/index.ts index 70ac38a7fc..94461f66fe 100644 --- a/lib/routes/hacking8/index.ts +++ b/lib/routes/hacking8/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/hacking8/search.ts b/lib/routes/hacking8/search.ts index 1cd2fc6a9d..f8ca16d6e2 100644 --- a/lib/routes/hacking8/search.ts +++ b/lib/routes/hacking8/search.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/search/:keyword?', diff --git a/lib/routes/hackmd/profile.ts b/lib/routes/hackmd/profile.ts index 8797a5dbbe..c993909c51 100644 --- a/lib/routes/hackmd/profile.ts +++ b/lib/routes/hackmd/profile.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/hackyournews/index.ts b/lib/routes/hackyournews/index.ts index 56b0ed6abb..26dcbaa53f 100644 --- a/lib/routes/hackyournews/index.ts +++ b/lib/routes/hackyournews/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; // an HTML parser with a jQuery-like API + +import type { Route } from '@/types'; // Require necessary modules import got from '@/utils/got'; // a customised got -import { load } from 'cheerio'; // an HTML parser with a jQuery-like API import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/hafu/news.ts b/lib/routes/hafu/news.ts index cbc6533eba..bfa9c6c7ce 100644 --- a/lib/routes/hafu/news.ts +++ b/lib/routes/hafu/news.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import parseList from './utils'; export const route: Route = { diff --git a/lib/routes/hafu/utils.ts b/lib/routes/hafu/utils.ts index 34f4fae25d..75827d57ac 100644 --- a/lib/routes/hafu/utils.ts +++ b/lib/routes/hafu/utils.ts @@ -1,10 +1,12 @@ +import path from 'node:path'; + +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; const typeMap = { ggtz: { url: 'https://www.hafu.edu.cn/index/ggtz.htm', root: 'https://www.hafu.edu.cn/', title: '河南财院 - 公告通知', parseFn: ggtzParse }, diff --git a/lib/routes/hakkatv/type.ts b/lib/routes/hakkatv/type.ts index 7644ad1263..c4b6382854 100644 --- a/lib/routes/hakkatv/type.ts +++ b/lib/routes/hakkatv/type.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/hamel/index.ts b/lib/routes/hamel/index.ts index 3946e48cba..1b0654c52f 100644 --- a/lib/routes/hamel/index.ts +++ b/lib/routes/hamel/index.ts @@ -1,8 +1,9 @@ -import { Route, DataItem } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/blog', diff --git a/lib/routes/hameln/chapter.ts b/lib/routes/hameln/chapter.ts index 8b4c58e32a..0fe7ba0b0c 100644 --- a/lib/routes/hameln/chapter.ts +++ b/lib/routes/hameln/chapter.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/chapter/:id', diff --git a/lib/routes/hanime1/previews.ts b/lib/routes/hanime1/previews.ts index 2696695ddf..d2dcd01e90 100644 --- a/lib/routes/hanime1/previews.ts +++ b/lib/routes/hanime1/previews.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import { config } from '@/config'; import { load } from 'cheerio'; +import { config } from '@/config'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + export const route: Route = { path: '/previews/:date?', name: '每月新番', diff --git a/lib/routes/hanime1/search.ts b/lib/routes/hanime1/search.ts index 0652101b59..025354362a 100644 --- a/lib/routes/hanime1/search.ts +++ b/lib/routes/hanime1/search.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import { config } from '@/config'; import { load } from 'cheerio'; +import { config } from '@/config'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + async function handler(ctx) { const { params } = ctx.req.param(); const baseUrl = 'https://hanime1.me'; diff --git a/lib/routes/harvard/health/blog.ts b/lib/routes/harvard/health/blog.ts index 17cfb3b24f..4cb34d06b7 100644 --- a/lib/routes/harvard/health/blog.ts +++ b/lib/routes/harvard/health/blog.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/hashnode/blog.ts b/lib/routes/hashnode/blog.ts index aa64170c45..dde13dfe4d 100644 --- a/lib/routes/hashnode/blog.ts +++ b/lib/routes/hashnode/blog.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; const baseApiUrl = 'https://api.hashnode.com'; diff --git a/lib/routes/hbooker/chapter.ts b/lib/routes/hbooker/chapter.ts index 75b2cb4aed..df83e3e5e8 100644 --- a/lib/routes/hbooker/chapter.ts +++ b/lib/routes/hbooker/chapter.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/hbr/topic.ts b/lib/routes/hbr/topic.ts index 134dacf4cb..7bfcaee45e 100644 --- a/lib/routes/hbr/topic.ts +++ b/lib/routes/hbr/topic.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/hdu/auto/notice.ts b/lib/routes/hdu/auto/notice.ts index c28e87beef..b7ae35d78b 100644 --- a/lib/routes/hdu/auto/notice.ts +++ b/lib/routes/hdu/auto/notice.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import { fetchAutoNews } from './utils'; +import type { Route } from '@/types'; import logger from '@/utils/logger'; +import { fetchAutoNews } from './utils'; + const typeMap = { notice: { name: '通知公告', diff --git a/lib/routes/hdu/auto/utils.ts b/lib/routes/hdu/auto/utils.ts index 7dac71a24e..38c6bb7436 100644 --- a/lib/routes/hdu/auto/utils.ts +++ b/lib/routes/hdu/auto/utils.ts @@ -1,7 +1,8 @@ -import { Data, DataItem } from '@/types'; +import { load } from 'cheerio'; + +import type { Data, DataItem } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const BASE_URL = 'https://auto.hdu.edu.cn'; diff --git a/lib/routes/hdu/cs/notice.ts b/lib/routes/hdu/cs/notice.ts index 4686573b20..b0a12fa59d 100644 --- a/lib/routes/hdu/cs/notice.ts +++ b/lib/routes/hdu/cs/notice.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const link = 'https://computer.hdu.edu.cn'; diff --git a/lib/routes/hdu/cs/pg.ts b/lib/routes/hdu/cs/pg.ts index 07ee8af2af..8adf3419b5 100644 --- a/lib/routes/hdu/cs/pg.ts +++ b/lib/routes/hdu/cs/pg.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const link = 'https://computer.hdu.edu.cn'; diff --git a/lib/routes/hebtv/nong-bo-shi-zai-xing-dong.ts b/lib/routes/hebtv/nong-bo-shi-zai-xing-dong.ts index 232de22e82..2f46b76f22 100644 --- a/lib/routes/hebtv/nong-bo-shi-zai-xing-dong.ts +++ b/lib/routes/hebtv/nong-bo-shi-zai-xing-dong.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; const baseUrl = 'https://web.cmc.hebtv.com/cms/rmt0336/19/19js/st/ds/nmpd/nbszxd/index.shtml'; diff --git a/lib/routes/hedwig/posts.ts b/lib/routes/hedwig/posts.ts index bfdc8b9adf..be4d2b83f2 100644 --- a/lib/routes/hedwig/posts.ts +++ b/lib/routes/hedwig/posts.ts @@ -1,12 +1,14 @@ -import { Route, ViewType } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import MarkdownIt from 'markdown-it'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; import { isValidHost } from '@/utils/valid-host'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; -import MarkdownIt from 'markdown-it'; const md = MarkdownIt({ html: true, }); diff --git a/lib/routes/hellobtc/information.ts b/lib/routes/hellobtc/information.ts index ada41ba379..f6de5ff63e 100644 --- a/lib/routes/hellobtc/information.ts +++ b/lib/routes/hellobtc/information.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/hellobtc/kepu.ts b/lib/routes/hellobtc/kepu.ts index 01448480b3..0607a6f4b9 100644 --- a/lib/routes/hellobtc/kepu.ts +++ b/lib/routes/hellobtc/kepu.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; const rootUrl = 'https://www.hellobtc.com'; diff --git a/lib/routes/hellobtc/news.ts b/lib/routes/hellobtc/news.ts index 5c9007a91a..0cbc7ba3ac 100644 --- a/lib/routes/hellobtc/news.ts +++ b/lib/routes/hellobtc/news.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/hellogithub/article.ts b/lib/routes/hellogithub/article.ts index 7e6329f6ea..6151387efe 100644 --- a/lib/routes/hellogithub/article.ts +++ b/lib/routes/hellogithub/article.ts @@ -1,5 +1,4 @@ -import { Route } from '@/types'; - +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/hellogithub/index.ts b/lib/routes/hellogithub/index.ts index 418c8208f6..32c7427549 100644 --- a/lib/routes/hellogithub/index.ts +++ b/lib/routes/hellogithub/index.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; - import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const sorts = { diff --git a/lib/routes/hellogithub/report.ts b/lib/routes/hellogithub/report.ts index ca315f5eec..81a886f17e 100644 --- a/lib/routes/hellogithub/report.ts +++ b/lib/routes/hellogithub/report.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const types = { tiobe: '编程语言', diff --git a/lib/routes/hellogithub/volume.ts b/lib/routes/hellogithub/volume.ts index ebd751877b..892577a36a 100644 --- a/lib/routes/hellogithub/volume.ts +++ b/lib/routes/hellogithub/volume.ts @@ -1,16 +1,18 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; import MarkdownIt from 'markdown-it'; + +import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + const md = MarkdownIt({ html: true, }); -import { load } from 'cheerio'; -import cache from '@/utils/cache'; -import { config } from '@/config'; -import { parseDate } from '@/utils/parse-date'; art.defaults.imports.render = function (string) { return md.render(string); diff --git a/lib/routes/hex-rays/index.ts b/lib/routes/hex-rays/index.ts index 692d803ed2..337a4f4efc 100644 --- a/lib/routes/hex-rays/index.ts +++ b/lib/routes/hex-rays/index.ts @@ -1,7 +1,8 @@ +import { load } from 'cheerio'; + import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/hexun/index.ts b/lib/routes/hexun/index.ts index b4860c4807..aefd556a78 100644 --- a/lib/routes/hexun/index.ts +++ b/lib/routes/hexun/index.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const decoder = new TextDecoder('gbk'); diff --git a/lib/routes/hfut/hf/notice.ts b/lib/routes/hfut/hf/notice.ts index d39b935bd2..0e51744911 100644 --- a/lib/routes/hfut/hf/notice.ts +++ b/lib/routes/hfut/hf/notice.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import parseList from './utils'; export const route: Route = { diff --git a/lib/routes/hfut/hf/utils.ts b/lib/routes/hfut/hf/utils.ts index 874121db6b..51a849dcd6 100644 --- a/lib/routes/hfut/hf/utils.ts +++ b/lib/routes/hfut/hf/utils.ts @@ -1,6 +1,7 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const typeMap = { diff --git a/lib/routes/hfut/xc/notice.ts b/lib/routes/hfut/xc/notice.ts index 538867464d..aecddbd58d 100644 --- a/lib/routes/hfut/xc/notice.ts +++ b/lib/routes/hfut/xc/notice.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import parseList from './utils'; export const route: Route = { diff --git a/lib/routes/hfut/xc/utils.ts b/lib/routes/hfut/xc/utils.ts index 3e2c998fed..d9dabc0339 100644 --- a/lib/routes/hfut/xc/utils.ts +++ b/lib/routes/hfut/xc/utils.ts @@ -1,6 +1,7 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const typeMap = { diff --git a/lib/routes/hicairo/rss.ts b/lib/routes/hicairo/rss.ts index 2798fea09a..72f89fd3d5 100644 --- a/lib/routes/hicairo/rss.ts +++ b/lib/routes/hicairo/rss.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/', categories: ['blog'], diff --git a/lib/routes/hinatazaka46/blog.ts b/lib/routes/hinatazaka46/blog.ts index 8439743d5e..9be7b64f70 100644 --- a/lib/routes/hinatazaka46/blog.ts +++ b/lib/routes/hinatazaka46/blog.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const rootUrl = 'https://www.hinatazaka46.com'; diff --git a/lib/routes/hinatazaka46/news.ts b/lib/routes/hinatazaka46/news.ts index 785daaec54..262471ab18 100644 --- a/lib/routes/hinatazaka46/news.ts +++ b/lib/routes/hinatazaka46/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/hiring.cafe/jobs.ts b/lib/routes/hiring.cafe/jobs.ts index aacd10f58a..518da16fbd 100644 --- a/lib/routes/hiring.cafe/jobs.ts +++ b/lib/routes/hiring.cafe/jobs.ts @@ -1,8 +1,10 @@ -import ofetch from '@/utils/ofetch'; import path from 'node:path'; + +import type { Context } from 'hono'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { art } from '@/utils/render'; -import { Context } from 'hono'; -import { Route } from '@/types'; const CONFIG = { DEFAULT_PAGE_SIZE: 20, diff --git a/lib/routes/hit/hitgs.ts b/lib/routes/hit/hitgs.ts index 3ee2675a71..61820e3dcd 100644 --- a/lib/routes/hit/hitgs.ts +++ b/lib/routes/hit/hitgs.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { id = 'tzgg' } = ctx.req.param(); diff --git a/lib/routes/hit/today.ts b/lib/routes/hit/today.ts index 62c8aedcae..c86681817b 100644 --- a/lib/routes/hit/today.ts +++ b/lib/routes/hit/today.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/hitcon/zeroday.ts b/lib/routes/hitcon/zeroday.ts index bd72639068..f89505e8f5 100644 --- a/lib/routes/hitcon/zeroday.ts +++ b/lib/routes/hitcon/zeroday.ts @@ -1,11 +1,13 @@ -import type { Data, DataItem, Route } from '@/types'; -import type { Context } from 'hono'; -import { load } from 'cheerio'; -import puppeteer from '@/utils/puppeteer'; -import logger from '@/utils/logger'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { Data, DataItem, Route } from '@/types'; +import logger from '@/utils/logger'; import { parseDate } from '@/utils/parse-date'; +import puppeteer from '@/utils/puppeteer'; +import { art } from '@/utils/render'; export const route: Route = { name: '漏洞', diff --git a/lib/routes/hitsz/article.ts b/lib/routes/hitsz/article.ts index fe8731a5ed..01dfad0779 100644 --- a/lib/routes/hitsz/article.ts +++ b/lib/routes/hitsz/article.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/hitsz/due-tzgg.ts b/lib/routes/hitsz/due-tzgg.ts index b278ac1af2..b4a880386d 100644 --- a/lib/routes/hitsz/due-tzgg.ts +++ b/lib/routes/hitsz/due-tzgg.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/hitsz/due.ts b/lib/routes/hitsz/due.ts index 98fd12495e..db4c65a645 100644 --- a/lib/routes/hitsz/due.ts +++ b/lib/routes/hitsz/due.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/hitwh/today.ts b/lib/routes/hitwh/today.ts index 4433eb45c1..fa759b865a 100644 --- a/lib/routes/hitwh/today.ts +++ b/lib/routes/hitwh/today.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/hizu/index.ts b/lib/routes/hizu/index.ts index 3a108f6d0c..037b3947e1 100644 --- a/lib/routes/hizu/index.ts +++ b/lib/routes/hizu/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const titles = { diff --git a/lib/routes/hk01/channel.ts b/lib/routes/hk01/channel.ts index 70b673a2c9..fd3d0b71e0 100644 --- a/lib/routes/hk01/channel.ts +++ b/lib/routes/hk01/channel.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { rootUrl, apiRootUrl, ProcessItems } from './utils'; + +import { apiRootUrl, ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/channel/:id?', diff --git a/lib/routes/hk01/hot.ts b/lib/routes/hk01/hot.ts index c69f672825..e58df8ee7b 100644 --- a/lib/routes/hk01/hot.ts +++ b/lib/routes/hk01/hot.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { rootUrl, apiRootUrl, ProcessItems } from './utils'; + +import { apiRootUrl, ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/hot', diff --git a/lib/routes/hk01/issue.ts b/lib/routes/hk01/issue.ts index d82db78642..c46ebd34a0 100644 --- a/lib/routes/hk01/issue.ts +++ b/lib/routes/hk01/issue.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { rootUrl, apiRootUrl, ProcessItems } from './utils'; + +import { apiRootUrl, ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/issue/:id?', diff --git a/lib/routes/hk01/latest.ts b/lib/routes/hk01/latest.ts index 1c80531844..8b873291e3 100644 --- a/lib/routes/hk01/latest.ts +++ b/lib/routes/hk01/latest.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { rootUrl, apiRootUrl, ProcessItems } from './utils'; + +import { apiRootUrl, ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/latest', diff --git a/lib/routes/hk01/tag.ts b/lib/routes/hk01/tag.ts index 57d18f2a70..d7a580d97e 100644 --- a/lib/routes/hk01/tag.ts +++ b/lib/routes/hk01/tag.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { rootUrl, apiRootUrl, ProcessItems } from './utils'; + +import { apiRootUrl, ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/tag/:id?', diff --git a/lib/routes/hk01/utils.ts b/lib/routes/hk01/utils.ts index cddf434d7d..0e47008d4d 100644 --- a/lib/routes/hk01/utils.ts +++ b/lib/routes/hk01/utils.ts @@ -1,7 +1,8 @@ +import path from 'node:path'; + import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const rootUrl = 'https://hk01.com'; const apiRootUrl = 'https://web-data.api.hk01.com'; @@ -38,4 +39,4 @@ const ProcessItems = (items, limit, tryGet) => ) ); -export { rootUrl, apiRootUrl, ProcessItems }; +export { apiRootUrl, ProcessItems, rootUrl }; diff --git a/lib/routes/hk01/zone.ts b/lib/routes/hk01/zone.ts index 05ef1e8912..237a852728 100644 --- a/lib/routes/hk01/zone.ts +++ b/lib/routes/hk01/zone.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { rootUrl, apiRootUrl, ProcessItems } from './utils'; + +import { apiRootUrl, ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/zone/:id?', diff --git a/lib/routes/hkej/index.ts b/lib/routes/hkej/index.ts index 909eeb5c9d..1cf2c6fd7e 100644 --- a/lib/routes/hkej/index.ts +++ b/lib/routes/hkej/index.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; +import { CookieJar } from 'tough-cookie'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { CookieJar } from 'tough-cookie'; +import timezone from '@/utils/timezone'; const cookieJar = new CookieJar(); diff --git a/lib/routes/hkepc/index.ts b/lib/routes/hkepc/index.ts index 6e64baed4d..677e3c0d9b 100644 --- a/lib/routes/hkepc/index.ts +++ b/lib/routes/hkepc/index.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { baseUrl, categoryMap } from './data'; export const route: Route = { diff --git a/lib/routes/hket/index.ts b/lib/routes/hket/index.ts index 0b5ed9563b..f466fa41be 100644 --- a/lib/routes/hket/index.ts +++ b/lib/routes/hket/index.ts @@ -1,12 +1,13 @@ -import { DataItem, Route } from '@/types'; +import path from 'node:path'; +import * as cheerio from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import * as cheerio from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; -import path from 'node:path'; import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; const urlMap = { srac: { diff --git a/lib/routes/hkjunkcall/index.ts b/lib/routes/hkjunkcall/index.ts index 21c3de2daa..b8b1f9eae9 100644 --- a/lib/routes/hkjunkcall/index.ts +++ b/lib/routes/hkjunkcall/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/hko/earthquake.ts b/lib/routes/hko/earthquake.ts index 9bccb0c314..6d3e3d0019 100644 --- a/lib/routes/hko/earthquake.ts +++ b/lib/routes/hko/earthquake.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/hko/weather.ts b/lib/routes/hko/weather.ts index 10145ffd4b..0bd934b347 100644 --- a/lib/routes/hko/weather.ts +++ b/lib/routes/hko/weather.ts @@ -1,6 +1,7 @@ +import * as cheerio from 'cheerio'; + import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; -import * as cheerio from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const handler = async () => { diff --git a/lib/routes/hkushop/vinyl-or-picture-lp.ts b/lib/routes/hkushop/vinyl-or-picture-lp.ts index 5f2a1d0cf8..572ca70a37 100644 --- a/lib/routes/hkushop/vinyl-or-picture-lp.ts +++ b/lib/routes/hkushop/vinyl-or-picture-lp.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import puppeteer from '@/utils/puppeteer'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import puppeteer from '@/utils/puppeteer'; + export const route: Route = { path: '/vinyl/:cat?', categories: ['shopping'], diff --git a/lib/routes/hlju/news.ts b/lib/routes/hlju/news.ts index 38ee028bb1..82e17b54f8 100644 --- a/lib/routes/hlju/news.ts +++ b/lib/routes/hlju/news.ts @@ -1,7 +1,8 @@ -import { Route, DataItem } from '@/types'; +import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/hljucm/yjsy.ts b/lib/routes/hljucm/yjsy.ts index 6873a21810..11b72243b7 100644 --- a/lib/routes/hljucm/yjsy.ts +++ b/lib/routes/hljucm/yjsy.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/yjsy/:category?', diff --git a/lib/routes/hnrb/index.ts b/lib/routes/hnrb/index.ts index 821969d0e7..cf414c2273 100644 --- a/lib/routes/hnrb/index.ts +++ b/lib/routes/hnrb/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/:id?', diff --git a/lib/routes/hnu/careers.ts b/lib/routes/hnu/careers.ts index cd3c9ec649..445d4a5b2b 100644 --- a/lib/routes/hnu/careers.ts +++ b/lib/routes/hnu/careers.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/home-assistant/hacs.ts b/lib/routes/home-assistant/hacs.ts index 14580fbbbe..593b655c9d 100644 --- a/lib/routes/home-assistant/hacs.ts +++ b/lib/routes/home-assistant/hacs.ts @@ -1,5 +1,4 @@ -import { Route } from '@/types'; - +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/hongkong/chp.ts b/lib/routes/hongkong/chp.ts index a2d1857001..98d4c6ab09 100644 --- a/lib/routes/hongkong/chp.ts +++ b/lib/routes/hongkong/chp.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const titles = { diff --git a/lib/routes/hongkong/dh.ts b/lib/routes/hongkong/dh.ts index 767e6cfed7..e92ec10ef0 100644 --- a/lib/routes/hongkong/dh.ts +++ b/lib/routes/hongkong/dh.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/hostmonit/cloudflareyes.ts b/lib/routes/hostmonit/cloudflareyes.ts index 3d1fd3113a..5815578b93 100644 --- a/lib/routes/hostmonit/cloudflareyes.ts +++ b/lib/routes/hostmonit/cloudflareyes.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; const lines = { CM: '中国移动', diff --git a/lib/routes/hostmonit/cloudflareyesv6.ts b/lib/routes/hostmonit/cloudflareyesv6.ts index c7d38cbae3..ca54d6dc52 100644 --- a/lib/routes/hostmonit/cloudflareyesv6.ts +++ b/lib/routes/hostmonit/cloudflareyesv6.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + export const route: Route = { path: '/cloudflareyesv6', name: 'Unknown', diff --git a/lib/routes/hottoys/index.ts b/lib/routes/hottoys/index.ts index a1cc08f840..7fe63092a3 100644 --- a/lib/routes/hottoys/index.ts +++ b/lib/routes/hottoys/index.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import puppeteer from '@/utils/puppeteer'; export const route: Route = { diff --git a/lib/routes/hotukdeals/hottest.ts b/lib/routes/hotukdeals/hottest.ts index 69a6318bfa..9a9c581a05 100644 --- a/lib/routes/hotukdeals/hottest.ts +++ b/lib/routes/hotukdeals/hottest.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { JSDOM } from 'jsdom'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/hottest', categories: ['shopping'], diff --git a/lib/routes/hotukdeals/index.ts b/lib/routes/hotukdeals/index.ts index eab022438e..ebf8a405a9 100644 --- a/lib/routes/hotukdeals/index.ts +++ b/lib/routes/hotukdeals/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/:type', categories: ['shopping'], diff --git a/lib/routes/houxu/events.ts b/lib/routes/houxu/events.ts index ca37a26ae5..5793564b96 100644 --- a/lib/routes/houxu/events.ts +++ b/lib/routes/houxu/events.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/events', diff --git a/lib/routes/houxu/index.ts b/lib/routes/houxu/index.ts index 72cea3991a..17ca07e39b 100644 --- a/lib/routes/houxu/index.ts +++ b/lib/routes/houxu/index.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { name: '热点', diff --git a/lib/routes/houxu/lives.ts b/lib/routes/houxu/lives.ts index 68fd41c5ab..0c8814ff30 100644 --- a/lib/routes/houxu/lives.ts +++ b/lib/routes/houxu/lives.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/houxu/memory.ts b/lib/routes/houxu/memory.ts index 2a807f903a..f0944690c5 100644 --- a/lib/routes/houxu/memory.ts +++ b/lib/routes/houxu/memory.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/memory', diff --git a/lib/routes/howtoforge/rss.ts b/lib/routes/howtoforge/rss.ts index fe189ef4a9..5cce95cb05 100644 --- a/lib/routes/howtoforge/rss.ts +++ b/lib/routes/howtoforge/rss.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/', categories: ['study'], diff --git a/lib/routes/hoyolab/constant.ts b/lib/routes/hoyolab/constant.ts index e1e7f4cee1..59405dfc5b 100644 --- a/lib/routes/hoyolab/constant.ts +++ b/lib/routes/hoyolab/constant.ts @@ -25,4 +25,4 @@ const OFFICIAL_PAGE_TYPE = { 5: 43, }; -export { PRIVATE_IMG, PUBLIC_IMG, LINK, POST_FULL, HOST, EVENT_LIST, NEW_LIST, OFFICIAL_PAGE_TYPE }; +export { EVENT_LIST, HOST, LINK, NEW_LIST, OFFICIAL_PAGE_TYPE, POST_FULL, PRIVATE_IMG, PUBLIC_IMG }; diff --git a/lib/routes/hoyolab/news.ts b/lib/routes/hoyolab/news.ts index e6ed922e39..5466ae0cb8 100644 --- a/lib/routes/hoyolab/news.ts +++ b/lib/routes/hoyolab/news.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import logger from '@/utils/logger'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { HOST, NEW_LIST, OFFICIAL_PAGE_TYPE, POST_FULL, LINK, PUBLIC_IMG, PRIVATE_IMG } from './constant'; + +import { HOST, LINK, NEW_LIST, OFFICIAL_PAGE_TYPE, POST_FULL, PRIVATE_IMG, PUBLIC_IMG } from './constant'; import { getI18nGameInfo, getI18nType } from './utils'; const getEventList = async ({ type, gids, size, language }) => { diff --git a/lib/routes/hpoi/all.ts b/lib/routes/hpoi/all.ts index 0f8fe53b75..6215456ee2 100644 --- a/lib/routes/hpoi/all.ts +++ b/lib/routes/hpoi/all.ts @@ -1,4 +1,6 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; + import { ProcessFeed } from './utils'; export const route: Route = { diff --git a/lib/routes/hpoi/banner-item.ts b/lib/routes/hpoi/banner-item.ts index 0382bb1194..a917893619 100644 --- a/lib/routes/hpoi/banner-item.ts +++ b/lib/routes/hpoi/banner-item.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/bannerItem', diff --git a/lib/routes/hpoi/character.ts b/lib/routes/hpoi/character.ts index 72682e5a64..13bf595e8d 100644 --- a/lib/routes/hpoi/character.ts +++ b/lib/routes/hpoi/character.ts @@ -1,4 +1,6 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; + import { ProcessFeed } from './utils'; export const route: Route = { diff --git a/lib/routes/hpoi/info.ts b/lib/routes/hpoi/info.ts index b04c0296fa..19e51c6865 100644 --- a/lib/routes/hpoi/info.ts +++ b/lib/routes/hpoi/info.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseRelativeDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/hpoi/user.ts b/lib/routes/hpoi/user.ts index 38ee4584ff..aab8364c29 100644 --- a/lib/routes/hpoi/user.ts +++ b/lib/routes/hpoi/user.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + const root_url = 'https://www.hpoi.net'; const titleMap = { diff --git a/lib/routes/hpoi/utils.ts b/lib/routes/hpoi/utils.ts index 73b8c6c55c..3ca6700c42 100644 --- a/lib/routes/hpoi/utils.ts +++ b/lib/routes/hpoi/utils.ts @@ -1,6 +1,7 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; +import got from '@/utils/got'; + const host = 'https://www.hpoi.net'; const MAPs = { diff --git a/lib/routes/hpoi/work.ts b/lib/routes/hpoi/work.ts index fbe8f4bd88..6d487c0ac9 100644 --- a/lib/routes/hpoi/work.ts +++ b/lib/routes/hpoi/work.ts @@ -1,4 +1,6 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; + import { ProcessFeed } from './utils'; export const route: Route = { diff --git a/lib/routes/hrbeu/cec/list.ts b/lib/routes/hrbeu/cec/list.ts index 1c37a38cbf..cd6e8c5e8b 100644 --- a/lib/routes/hrbeu/cec/list.ts +++ b/lib/routes/hrbeu/cec/list.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const rootUrl = 'http://cec.hrbeu.edu.cn'; export const route: Route = { diff --git a/lib/routes/hrbeu/gx/card.ts b/lib/routes/hrbeu/gx/card.ts index a854508b87..2fa03e43a8 100644 --- a/lib/routes/hrbeu/gx/card.ts +++ b/lib/routes/hrbeu/gx/card.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + const rootUrl = 'http://news.hrbeu.edu.cn'; export const route: Route = { diff --git a/lib/routes/hrbeu/gx/list.ts b/lib/routes/hrbeu/gx/list.ts index c05b5ea9a9..dc0ab50fd9 100644 --- a/lib/routes/hrbeu/gx/list.ts +++ b/lib/routes/hrbeu/gx/list.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const rootUrl = 'http://news.hrbeu.edu.cn'; export const route: Route = { diff --git a/lib/routes/hrbeu/job/bigemploy.ts b/lib/routes/hrbeu/job/bigemploy.ts index 95c53fc7ca..2d281367f1 100644 --- a/lib/routes/hrbeu/job/bigemploy.ts +++ b/lib/routes/hrbeu/job/bigemploy.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/hrbeu/job/calendar.ts b/lib/routes/hrbeu/job/calendar.ts index 2ea0d0cb65..ad7631f3f7 100644 --- a/lib/routes/hrbeu/job/calendar.ts +++ b/lib/routes/hrbeu/job/calendar.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + const rootUrl = 'http://job.hrbeu.edu.cn'; export const route: Route = { diff --git a/lib/routes/hrbeu/job/list.ts b/lib/routes/hrbeu/job/list.ts index 4c02a1eb6e..f5b43a329f 100644 --- a/lib/routes/hrbeu/job/list.ts +++ b/lib/routes/hrbeu/job/list.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { finishArticleItem } from '@/utils/wechat-mp'; + const rootUrl = 'http://job.hrbeu.edu.cn'; const idMap = { diff --git a/lib/routes/hrbeu/sec/list.ts b/lib/routes/hrbeu/sec/list.ts index 795f861908..a9f233b7b1 100644 --- a/lib/routes/hrbeu/sec/list.ts +++ b/lib/routes/hrbeu/sec/list.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const rootUrl = 'http://sec.hrbeu.edu.cn'; export const route: Route = { diff --git a/lib/routes/hrbeu/uae/news.ts b/lib/routes/hrbeu/uae/news.ts index 0f09620883..7019c27160 100644 --- a/lib/routes/hrbeu/uae/news.ts +++ b/lib/routes/hrbeu/uae/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { finishArticleItem } from '@/utils/wechat-mp'; diff --git a/lib/routes/hrbeu/ugs/news.ts b/lib/routes/hrbeu/ugs/news.ts index 0eeca3dcb0..18f5a07aa2 100644 --- a/lib/routes/hrbeu/ugs/news.ts +++ b/lib/routes/hrbeu/ugs/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'http://ugs.hrbeu.edu.cn'; diff --git a/lib/routes/hrbeu/yjsy/list.ts b/lib/routes/hrbeu/yjsy/list.ts index d101b101b2..0535096611 100644 --- a/lib/routes/hrbeu/yjsy/list.ts +++ b/lib/routes/hrbeu/yjsy/list.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const rootUrl = 'http://yjsy.hrbeu.edu.cn'; export const route: Route = { diff --git a/lib/routes/hrbust/cs.ts b/lib/routes/hrbust/cs.ts index d18659835b..0ff7f04684 100644 --- a/lib/routes/hrbust/cs.ts +++ b/lib/routes/hrbust/cs.ts @@ -1,9 +1,11 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { load } from 'cheerio'; -import ofetch from '@/utils/ofetch'; export const route: Route = { path: '/cs/:category?', diff --git a/lib/routes/hrbust/gzc.ts b/lib/routes/hrbust/gzc.ts index cd4d6bee19..bfc2cb5c7d 100644 --- a/lib/routes/hrbust/gzc.ts +++ b/lib/routes/hrbust/gzc.ts @@ -1,9 +1,11 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { load } from 'cheerio'; -import ofetch from '@/utils/ofetch'; export const route: Route = { path: '/gzc/:category?', diff --git a/lib/routes/hrbust/jwzx.ts b/lib/routes/hrbust/jwzx.ts index 37f8a57fa2..0a4d124f1c 100644 --- a/lib/routes/hrbust/jwzx.ts +++ b/lib/routes/hrbust/jwzx.ts @@ -1,9 +1,11 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import timezone from '@/utils/timezone'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/jwzx/:type?/:page?', diff --git a/lib/routes/hrbust/lib.ts b/lib/routes/hrbust/lib.ts index 7c737a410e..d866b9e351 100644 --- a/lib/routes/hrbust/lib.ts +++ b/lib/routes/hrbust/lib.ts @@ -1,9 +1,11 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { load } from 'cheerio'; -import ofetch from '@/utils/ofetch'; export const route: Route = { path: '/lib/:category?', diff --git a/lib/routes/hrbust/news.ts b/lib/routes/hrbust/news.ts index 8cc2d00ee6..af50d4a507 100644 --- a/lib/routes/hrbust/news.ts +++ b/lib/routes/hrbust/news.ts @@ -1,9 +1,11 @@ -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import ofetch from '@/utils/ofetch'; export const route: Route = { path: '/news/:category?', diff --git a/lib/routes/hrbust/nic.ts b/lib/routes/hrbust/nic.ts index f6d0e3bc50..dc2416224f 100644 --- a/lib/routes/hrbust/nic.ts +++ b/lib/routes/hrbust/nic.ts @@ -1,9 +1,11 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { load } from 'cheerio'; export const route: Route = { path: '/nic/:category?', diff --git a/lib/routes/huanqiu/index.ts b/lib/routes/huanqiu/index.ts index 3f4d03a13d..5cd64beac7 100644 --- a/lib/routes/huanqiu/index.ts +++ b/lib/routes/huanqiu/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { isValidHost } from '@/utils/valid-host'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; function getKeysRecursive(dic, key, attr, array) { for (const v of Object.values(dic)) { diff --git a/lib/routes/huawei/developer/harmonyos/samplecode.ts b/lib/routes/huawei/developer/harmonyos/samplecode.ts index 6de4a56bb5..ff30594350 100644 --- a/lib/routes/huawei/developer/harmonyos/samplecode.ts +++ b/lib/routes/huawei/developer/harmonyos/samplecode.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import MarkdownIt from 'markdown-it'; const md = MarkdownIt({ html: true, diff --git a/lib/routes/hubu/index.ts b/lib/routes/hubu/index.ts index c8f6998a67..fb64cd7eaa 100644 --- a/lib/routes/hubu/index.ts +++ b/lib/routes/hubu/index.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const handler = async (ctx) => { diff --git a/lib/routes/hubu/zhxy.ts b/lib/routes/hubu/zhxy.ts index b5e9801a34..93ab0152a0 100644 --- a/lib/routes/hubu/zhxy.ts +++ b/lib/routes/hubu/zhxy.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const handler = async (ctx) => { diff --git a/lib/routes/hudsonrivertrading/index.ts b/lib/routes/hudsonrivertrading/index.ts index 9d07f35d68..fad4ada47b 100644 --- a/lib/routes/hudsonrivertrading/index.ts +++ b/lib/routes/hudsonrivertrading/index.ts @@ -1,7 +1,7 @@ -import { Route, type Data } from '@/types'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { type Data, Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; type WordpressPost = { id: number; diff --git a/lib/routes/huggingface/blog-community.ts b/lib/routes/huggingface/blog-community.ts index 1e82d9ce6d..4e2bb4190a 100644 --- a/lib/routes/huggingface/blog-community.ts +++ b/lib/routes/huggingface/blog-community.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/huggingface/blog-zh.ts b/lib/routes/huggingface/blog-zh.ts index df4117fb34..7db3abc696 100644 --- a/lib/routes/huggingface/blog-zh.ts +++ b/lib/routes/huggingface/blog-zh.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/huggingface/blog.ts b/lib/routes/huggingface/blog.ts index 71b4fc326f..868de48d4c 100644 --- a/lib/routes/huggingface/blog.ts +++ b/lib/routes/huggingface/blog.ts @@ -1,6 +1,7 @@ -import { Route, type DataItem } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { type DataItem, Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/huggingface/daily-papers.ts b/lib/routes/huggingface/daily-papers.ts index 975056cb46..1a76ef2715 100644 --- a/lib/routes/huggingface/daily-papers.ts +++ b/lib/routes/huggingface/daily-papers.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/huijin-inv/news.ts b/lib/routes/huijin-inv/news.ts index 0512cc4fb3..7fba291ca8 100644 --- a/lib/routes/huijin-inv/news.ts +++ b/lib/routes/huijin-inv/news.ts @@ -1,8 +1,9 @@ -import { type Data, type DataItem, Route } from '@/types'; import { type CheerioAPI, load } from 'cheerio'; + +import type { type Data, type DataItem, Route } from '@/types'; import ofetch from '@/utils/ofetch'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const BASE_URL = 'https://www.huijin-inv.cn'; diff --git a/lib/routes/hunanpea/rsks.ts b/lib/routes/hunanpea/rsks.ts index d249c64238..07c3697ff2 100644 --- a/lib/routes/hunanpea/rsks.ts +++ b/lib/routes/hunanpea/rsks.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/hunau/gfxy/index.ts b/lib/routes/hunau/gfxy/index.ts index 035bae0f99..f399e5f2ac 100644 --- a/lib/routes/hunau/gfxy/index.ts +++ b/lib/routes/hunau/gfxy/index.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import getContent from '../utils/common'; export const route: Route = { diff --git a/lib/routes/hunau/ied.ts b/lib/routes/hunau/ied.ts index 684f033cb8..b92f9bac1c 100644 --- a/lib/routes/hunau/ied.ts +++ b/lib/routes/hunau/ied.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import getContent from './utils/common'; export const route: Route = { diff --git a/lib/routes/hunau/jwc.ts b/lib/routes/hunau/jwc.ts index b79a462086..dfa8e2478d 100644 --- a/lib/routes/hunau/jwc.ts +++ b/lib/routes/hunau/jwc.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import getContent from './utils/common'; export const route: Route = { diff --git a/lib/routes/hunau/utils/common.ts b/lib/routes/hunau/utils/common.ts index b75af647ce..4bef4beb4b 100644 --- a/lib/routes/hunau/utils/common.ts +++ b/lib/routes/hunau/utils/common.ts @@ -1,10 +1,12 @@ -import cache from '@/utils/cache'; // common.js import { load } from 'cheerio'; + +import cache from '@/utils/cache'; import got from '@/utils/got'; + import categoryTitle from './category-title'; -import newsContent from './news-content'; import indexPage from './index-page'; +import newsContent from './news-content'; async function getContent(ctx, { baseHost, baseCategory, baseType, baseTitle, baseDescription = '', baseDeparment = '', baseClass = 'div.article_list ul li:has(a)' }) { const { category = baseCategory, type = baseType, page = '1' } = ctx.req.param(); diff --git a/lib/routes/hunau/utils/news-content.ts b/lib/routes/hunau/utils/news-content.ts index 88a6ef11b4..c455c362d4 100644 --- a/lib/routes/hunau/utils/news-content.ts +++ b/lib/routes/hunau/utils/news-content.ts @@ -1,7 +1,8 @@ +import { load } from 'cheerio'; + import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { load } from 'cheerio'; async function newsContent(link, department = '') { try { diff --git a/lib/routes/hunau/xky/index.ts b/lib/routes/hunau/xky/index.ts index 65024f3c24..f4fdcab4fc 100644 --- a/lib/routes/hunau/xky/index.ts +++ b/lib/routes/hunau/xky/index.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import getContent from '../utils/common'; export const route: Route = { diff --git a/lib/routes/huoxian/zone.ts b/lib/routes/huoxian/zone.ts index 170b3e48c1..fc4fcaae51 100644 --- a/lib/routes/huoxian/zone.ts +++ b/lib/routes/huoxian/zone.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/hupu/all.ts b/lib/routes/hupu/all.ts index 2226ae0528..041268ac92 100644 --- a/lib/routes/hupu/all.ts +++ b/lib/routes/hupu/all.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/all/:id?', diff --git a/lib/routes/hupu/bbs.ts b/lib/routes/hupu/bbs.ts index 39ca3d457b..2d8661258c 100644 --- a/lib/routes/hupu/bbs.ts +++ b/lib/routes/hupu/bbs.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: ['/bbs/:id?/:order?', '/bxj/:id?/:order?'], diff --git a/lib/routes/hupu/index.ts b/lib/routes/hupu/index.ts index fc3b9f2fff..58d33618a4 100644 --- a/lib/routes/hupu/index.ts +++ b/lib/routes/hupu/index.ts @@ -1,10 +1,12 @@ -import { Route, Data, DataItem } from '@/types'; +import { load } from 'cheerio'; + +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; -import { type HupuApiResponse, type HomePostItem, type NewsDataItem, isHomePostItem } from './types'; +import timezone from '@/utils/timezone'; + +import { type HomePostItem, type HupuApiResponse, isHomePostItem, type NewsDataItem } from './types'; const categories = { nba: { diff --git a/lib/routes/hupu/types.ts b/lib/routes/hupu/types.ts index ff6683ba28..8c62dc8429 100644 --- a/lib/routes/hupu/types.ts +++ b/lib/routes/hupu/types.ts @@ -160,4 +160,4 @@ export function isNewsDataItem(item: HomePostItem | NewsDataItem): item is NewsD } // 导出具体类型以供外部使用 -export type { Badge, HomePostItem, NewsDataItem, RecommendMatch, HomePageProps, BasketballPageProps, SoccerPageProps, CategoryPageProps, ApiResponseProps }; +export type { ApiResponseProps, Badge, BasketballPageProps, CategoryPageProps, HomePageProps, HomePostItem, NewsDataItem, RecommendMatch, SoccerPageProps }; diff --git a/lib/routes/hust/aia/news.ts b/lib/routes/hust/aia/news.ts index e3d817ff04..d2ee6f208e 100755 --- a/lib/routes/hust/aia/news.ts +++ b/lib/routes/hust/aia/news.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/hust/aia/notice.ts b/lib/routes/hust/aia/notice.ts index 9ae3fc32d5..f98546ae19 100755 --- a/lib/routes/hust/aia/notice.ts +++ b/lib/routes/hust/aia/notice.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/hust/gs.ts b/lib/routes/hust/gs.ts index e42ddfe181..209fdd52bd 100644 --- a/lib/routes/hust/gs.ts +++ b/lib/routes/hust/gs.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const handler = async (ctx) => { diff --git a/lib/routes/hust/mse.ts b/lib/routes/hust/mse.ts index ee4461987a..b6bc3ad887 100644 --- a/lib/routes/hust/mse.ts +++ b/lib/routes/hust/mse.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const handler = async (ctx) => { diff --git a/lib/routes/hust/yjs.ts b/lib/routes/hust/yjs.ts index fd05e334be..9819c4d228 100644 --- a/lib/routes/hust/yjs.ts +++ b/lib/routes/hust/yjs.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/huxiu/brief-column.ts b/lib/routes/huxiu/brief-column.ts index ffbca49210..f185c568d9 100644 --- a/lib/routes/huxiu/brief-column.ts +++ b/lib/routes/huxiu/brief-column.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { apiBriefRootUrl, processItems, fetchBriefColumnData } from './util'; +import { apiBriefRootUrl, fetchBriefColumnData, processItems } from './util'; export const route: Route = { path: '/briefcolumn/:id', diff --git a/lib/routes/huxiu/channel.ts b/lib/routes/huxiu/channel.ts index e2c6691110..71227c4612 100644 --- a/lib/routes/huxiu/channel.ts +++ b/lib/routes/huxiu/channel.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { rootUrl, apiArticleRootUrl, processItems, fetchData } from './util'; +import { apiArticleRootUrl, fetchData, processItems, rootUrl } from './util'; export const route: Route = { path: ['/article', '/channel/:id?'], diff --git a/lib/routes/huxiu/club.ts b/lib/routes/huxiu/club.ts index 2996097e1a..0ebfe37247 100644 --- a/lib/routes/huxiu/club.ts +++ b/lib/routes/huxiu/club.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { apiBriefRootUrl, processItems, fetchClubData } from './util'; +import { apiBriefRootUrl, fetchClubData, processItems } from './util'; export const route: Route = { path: '/club/:id', diff --git a/lib/routes/huxiu/collection.ts b/lib/routes/huxiu/collection.ts index 0112c44a59..4fd0f01360 100644 --- a/lib/routes/huxiu/collection.ts +++ b/lib/routes/huxiu/collection.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { rootUrl, apiArticleRootUrl, processItems, fetchData } from './util'; +import { apiArticleRootUrl, fetchData, processItems, rootUrl } from './util'; export const route: Route = { path: '/collection/:id', diff --git a/lib/routes/huxiu/member.ts b/lib/routes/huxiu/member.ts index 4a25205237..827e1186c4 100644 --- a/lib/routes/huxiu/member.ts +++ b/lib/routes/huxiu/member.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { rootUrl, apiMemberRootUrl, processItems, fetchData } from './util'; +import { apiMemberRootUrl, fetchData, processItems, rootUrl } from './util'; export const route: Route = { path: ['/author/:id/:type?', '/member/:id/:type?'], diff --git a/lib/routes/huxiu/moment.ts b/lib/routes/huxiu/moment.ts index 01336d063b..c5a75767fa 100644 --- a/lib/routes/huxiu/moment.ts +++ b/lib/routes/huxiu/moment.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { rootUrl, apiMomentRootUrl, processItems, fetchData } from './util'; +import { apiMomentRootUrl, fetchData, processItems, rootUrl } from './util'; export const route: Route = { path: '/moment', diff --git a/lib/routes/huxiu/search.ts b/lib/routes/huxiu/search.ts index dc7be05140..587f5bf0b5 100644 --- a/lib/routes/huxiu/search.ts +++ b/lib/routes/huxiu/search.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { rootUrl, apiSearchRootUrl, generateSignature, processItems, fetchData } from './util'; +import { apiSearchRootUrl, fetchData, generateSignature, processItems, rootUrl } from './util'; export const route: Route = { path: '/search/:keyword', diff --git a/lib/routes/huxiu/tag.ts b/lib/routes/huxiu/tag.ts index 16e32a306a..4b9af92504 100644 --- a/lib/routes/huxiu/tag.ts +++ b/lib/routes/huxiu/tag.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { rootUrl, processItems, fetchData } from './util'; +import { fetchData, processItems, rootUrl } from './util'; export const route: Route = { path: '/tag/:id', diff --git a/lib/routes/huxiu/util.ts b/lib/routes/huxiu/util.ts index 766e587e1e..6eebcfe434 100644 --- a/lib/routes/huxiu/util.ts +++ b/lib/routes/huxiu/util.ts @@ -1,9 +1,11 @@ -import got from '@/utils/got'; +import path from 'node:path'; + import { load } from 'cheerio'; +import CryptoJS from 'crypto-js'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import CryptoJS from 'crypto-js'; const domain = 'huxiu.com'; const rootUrl = `https://www.${domain}`; @@ -442,4 +444,4 @@ const processVideoInfo = (info) => { }; }; -export { rootUrl, apiArticleRootUrl, apiBriefRootUrl, apiMemberRootUrl, apiMomentRootUrl, apiSearchRootUrl, fetchBriefColumnData, fetchClubData, fetchData, generateSignature, processItems }; +export { apiArticleRootUrl, apiBriefRootUrl, apiMemberRootUrl, apiMomentRootUrl, apiSearchRootUrl, fetchBriefColumnData, fetchClubData, fetchData, generateSignature, processItems, rootUrl }; diff --git a/lib/routes/hyperdash/top-traders.ts b/lib/routes/hyperdash/top-traders.ts index e1044b7079..89232f3c88 100644 --- a/lib/routes/hyperdash/top-traders.ts +++ b/lib/routes/hyperdash/top-traders.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import { fetchTopTraders, formatCurrency, formatPnL } from './utils'; -import { art } from '@/utils/render'; import path from 'node:path'; +import type { Route } from '@/types'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + +import { fetchTopTraders, formatCurrency, formatPnL } from './utils'; + export const route: Route = { path: '/top-traders', categories: ['finance'], diff --git a/lib/routes/hypergryph/arknights/announce.ts b/lib/routes/hypergryph/arknights/announce.ts index f034de4353..56a52c5de7 100644 --- a/lib/routes/hypergryph/arknights/announce.ts +++ b/lib/routes/hypergryph/arknights/announce.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; type AnnounceItem = { announceId: string; diff --git a/lib/routes/hypergryph/arknights/arktca.ts b/lib/routes/hypergryph/arknights/arktca.ts index 66fec158e1..2a53156a8d 100644 --- a/lib/routes/hypergryph/arknights/arktca.ts +++ b/lib/routes/hypergryph/arknights/arktca.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; const rssDescription = '明日方舟期刊《回归线》 | 泰拉创作者联合会'; const url = 'aneot.arktca.com'; diff --git a/lib/routes/hypergryph/arknights/japan.ts b/lib/routes/hypergryph/arknights/japan.ts index db96cae337..536c24479e 100644 --- a/lib/routes/hypergryph/arknights/japan.ts +++ b/lib/routes/hypergryph/arknights/japan.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Context } from 'hono'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import type { Context } from 'hono'; type ContentItem = { key: string; diff --git a/lib/routes/hypergryph/arknights/news.ts b/lib/routes/hypergryph/arknights/news.ts index fc5f65fb47..fe01953bb3 100644 --- a/lib/routes/hypergryph/arknights/news.ts +++ b/lib/routes/hypergryph/arknights/news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import * as cheerio from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import * as cheerio from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; type NewsItem = { cid: string; diff --git a/lib/routes/i-cable/news.ts b/lib/routes/i-cable/news.ts index 6541ba5654..a75ecc46fe 100644 --- a/lib/routes/i-cable/news.ts +++ b/lib/routes/i-cable/news.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import path from 'node:path'; -import { art } from '@/utils/render'; + import { config } from '@/config'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; export const route: Route = { path: '/news/:category?', diff --git a/lib/routes/ianspriggs/index.ts b/lib/routes/ianspriggs/index.ts index b652cc458c..f296e83a29 100644 --- a/lib/routes/ianspriggs/index.ts +++ b/lib/routes/ianspriggs/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/icac/news.ts b/lib/routes/icac/news.ts index eed96e0c31..12d3e79235 100644 --- a/lib/routes/icac/news.ts +++ b/lib/routes/icac/news.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import utils from './utils'; import { parseDate } from '@/utils/parse-date'; +import utils from './utils'; + export const route: Route = { path: '/news/:lang?', categories: ['government'], diff --git a/lib/routes/icbc/whpj.ts b/lib/routes/icbc/whpj.ts index b44761535a..f65643ac37 100644 --- a/lib/routes/icbc/whpj.ts +++ b/lib/routes/icbc/whpj.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/idaily/index.ts b/lib/routes/idaily/index.ts index 6fc9c5491d..93be08d147 100644 --- a/lib/routes/idaily/index.ts +++ b/lib/routes/idaily/index.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; +import path from 'node:path'; + import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: ['/:language?'], diff --git a/lib/routes/idolmaster/news.ts b/lib/routes/idolmaster/news.ts index a2e015a54e..935034a935 100644 --- a/lib/routes/idolmaster/news.ts +++ b/lib/routes/idolmaster/news.ts @@ -1,11 +1,13 @@ -import { Route, Data, DataItem } from '@/types'; -import type { Context } from 'hono'; -import got from '@/utils/got'; import querystring from 'node:querystring'; -import timezone from '@/utils/timezone'; -import { parseDate } from '@/utils/parse-date'; -import cache from '@/utils/cache'; + import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { Data, DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { url: 'idolmaster-official.jp/news', diff --git a/lib/routes/idolypride/news.ts b/lib/routes/idolypride/news.ts index 103d96a070..2698d5c1df 100644 --- a/lib/routes/idolypride/news.ts +++ b/lib/routes/idolypride/news.ts @@ -1,4 +1,5 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ieee-security/sp.ts b/lib/routes/ieee-security/sp.ts index d7627fcf64..1c2cbf5235 100644 --- a/lib/routes/ieee-security/sp.ts +++ b/lib/routes/ieee-security/sp.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; + const url = 'https://www.ieee-security.org/'; // https://www.ieee-security.org/TC/SP2023/program-papers.html diff --git a/lib/routes/ieee/author.ts b/lib/routes/ieee/author.ts index 6afef6535f..289e973637 100644 --- a/lib/routes/ieee/author.ts +++ b/lib/routes/ieee/author.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; -import path from 'node:path'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; diff --git a/lib/routes/ieee/journal.ts b/lib/routes/ieee/journal.ts index ed1e96abb2..7ef3e00c90 100644 --- a/lib/routes/ieee/journal.ts +++ b/lib/routes/ieee/journal.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; -import path from 'node:path'; import { art } from '@/utils/render'; const ieeeHost = 'https://ieeexplore.ieee.org'; diff --git a/lib/routes/iehou/index.ts b/lib/routes/iehou/index.ts index 675096cfb9..2d2ed7d837 100644 --- a/lib/routes/iehou/index.ts +++ b/lib/routes/iehou/index.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { category = '' } = ctx.req.param(); diff --git a/lib/routes/ielts/index.ts b/lib/routes/ielts/index.ts index 1792106598..1e08c8db6a 100644 --- a/lib/routes/ielts/index.ts +++ b/lib/routes/ielts/index.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; -import got from '@/utils/got'; -import timezone from '@/utils/timezone'; -import { parseDate } from '@/utils/parse-date'; -const targetUrl = 'https://ielts.neea.cn/allnews?locale=zh_CN'; + import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; +import timezone from '@/utils/timezone'; + +const targetUrl = 'https://ielts.neea.cn/allnews?locale=zh_CN'; export const route: Route = { path: '/', diff --git a/lib/routes/ifanr/category.ts b/lib/routes/ifanr/category.ts index de587d63f7..971baa87ce 100644 --- a/lib/routes/ifanr/category.ts +++ b/lib/routes/ifanr/category.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/ifanr/digest.ts b/lib/routes/ifanr/digest.ts index 2a1cba8ac4..9647b937b6 100644 --- a/lib/routes/ifanr/digest.ts +++ b/lib/routes/ifanr/digest.ts @@ -1,8 +1,7 @@ import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; -import { type DataItem, type Route, type Data, ViewType } from '@/types'; - +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/ifanr/index.ts b/lib/routes/ifanr/index.ts index 34f9426813..a330a8f637 100644 --- a/lib/routes/ifanr/index.ts +++ b/lib/routes/ifanr/index.ts @@ -1,4 +1,5 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/ifeng/feng.ts b/lib/routes/ifeng/feng.ts index fc59a2f9ab..edea32c3d7 100644 --- a/lib/routes/ifeng/feng.ts +++ b/lib/routes/ifeng/feng.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { extractDoc, renderVideo } from './utils'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; +import { extractDoc, renderVideo } from './utils'; + export const route: Route = { path: '/feng/:id/:type', categories: ['new-media'], diff --git a/lib/routes/ifeng/news.ts b/lib/routes/ifeng/news.ts index 70c8d99abe..1134771d0e 100644 --- a/lib/routes/ifeng/news.ts +++ b/lib/routes/ifeng/news.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; +import path from 'node:path'; -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 type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/news/*', diff --git a/lib/routes/ifeng/utils.ts b/lib/routes/ifeng/utils.ts index 387c7c7d9d..0ef7347f46 100644 --- a/lib/routes/ifeng/utils.ts +++ b/lib/routes/ifeng/utils.ts @@ -1,6 +1,7 @@ -import { art } from '@/utils/render'; import path from 'node:path'; +import { art } from '@/utils/render'; + const extractDoc = (data) => data .map((item) => { diff --git a/lib/routes/ifi-audio/download.ts b/lib/routes/ifi-audio/download.ts index 5b82846a85..ed85d9798a 100644 --- a/lib/routes/ifi-audio/download.ts +++ b/lib/routes/ifi-audio/download.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + const host = 'https://ifi-audio.com'; export const route: Route = { diff --git a/lib/routes/ifun/n/category.ts b/lib/routes/ifun/n/category.ts index b7f78de1fa..859e083c90 100644 --- a/lib/routes/ifun/n/category.ts +++ b/lib/routes/ifun/n/category.ts @@ -1,10 +1,9 @@ import { type Context } from 'hono'; -import { type DataItem, type Route, type Data, ViewType } from '@/types'; - +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; -import { author, language, rootUrl, processItems } from './util'; +import { author, language, processItems, rootUrl } from './util'; export const handler = async (ctx: Context): Promise => { const { id } = ctx.req.param(); diff --git a/lib/routes/ifun/n/search.ts b/lib/routes/ifun/n/search.ts index bb0ca4772d..ab8c25a0d4 100644 --- a/lib/routes/ifun/n/search.ts +++ b/lib/routes/ifun/n/search.ts @@ -1,10 +1,9 @@ import { type Context } from 'hono'; -import { type DataItem, type Route, type Data, ViewType } from '@/types'; - +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; -import { author, language, rootUrl, processItems } from './util'; +import { author, language, processItems, rootUrl } from './util'; export const handler = async (ctx: Context): Promise => { const { keywords } = ctx.req.param(); diff --git a/lib/routes/ifun/n/tag.ts b/lib/routes/ifun/n/tag.ts index 0577c40fcc..23f1084639 100644 --- a/lib/routes/ifun/n/tag.ts +++ b/lib/routes/ifun/n/tag.ts @@ -1,10 +1,9 @@ import { type Context } from 'hono'; -import { type DataItem, type Route, type Data, ViewType } from '@/types'; - +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; -import { author, language, rootUrl, processItems } from './util'; +import { author, language, processItems, rootUrl } from './util'; export const handler = async (ctx: Context): Promise => { const { name } = ctx.req.param(); diff --git a/lib/routes/ifun/n/util.ts b/lib/routes/ifun/n/util.ts index 5f1bfa14d8..44916b372e 100644 --- a/lib/routes/ifun/n/util.ts +++ b/lib/routes/ifun/n/util.ts @@ -1,5 +1,4 @@ import { type DataItem } from '@/types'; - import { parseDate } from '@/utils/parse-date'; const author: string = '趣集'; @@ -31,4 +30,4 @@ const processItems: (items: any[], limit: number) => DataItem[] = (items: any[], }; }); -export { author, language, rootUrl, processItems }; +export { author, language, processItems, rootUrl }; diff --git a/lib/routes/iguoguo/index.ts b/lib/routes/iguoguo/index.ts index bb7686ce8e..ec6037ec05 100644 --- a/lib/routes/iguoguo/index.ts +++ b/lib/routes/iguoguo/index.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; -import type { Context } from 'hono'; + const rootUrl = 'https://www.iguoguo.net'; const getCategoryIdFromSlug = (slug) => diff --git a/lib/routes/iheima/index.ts b/lib/routes/iheima/index.ts index 1f105587d5..2c231fc7d4 100644 --- a/lib/routes/iheima/index.ts +++ b/lib/routes/iheima/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/iiilab/index.ts b/lib/routes/iiilab/index.ts index 3de20ca601..174d2dc096 100644 --- a/lib/routes/iiilab/index.ts +++ b/lib/routes/iiilab/index.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import buildData from '@/utils/common-config'; + const baseUrl = 'https://www.iiilab.com/'; export const route: Route = { diff --git a/lib/routes/ikea/cn/family-offers.ts b/lib/routes/ikea/cn/family-offers.ts index af5748a722..3003e2e2de 100644 --- a/lib/routes/ikea/cn/family-offers.ts +++ b/lib/routes/ikea/cn/family-offers.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import { generateProductItem } from './utils'; const familyPriceProductsRequest = ({ pageIndex = 1 }) => diff --git a/lib/routes/ikea/cn/low-price.ts b/lib/routes/ikea/cn/low-price.ts index 994466f348..43935ac9e3 100644 --- a/lib/routes/ikea/cn/low-price.ts +++ b/lib/routes/ikea/cn/low-price.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import { generateRequestHeaders, generateProductItem } from './utils'; + +import { generateProductItem, generateRequestHeaders } from './utils'; export const route: Route = { path: '/cn/low_price', diff --git a/lib/routes/ikea/cn/new.ts b/lib/routes/ikea/cn/new.ts index 502882cdcf..4ee41ef128 100644 --- a/lib/routes/ikea/cn/new.ts +++ b/lib/routes/ikea/cn/new.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import { generateRequestHeaders, generateProductItem } from './utils'; + +import { generateProductItem, generateRequestHeaders } from './utils'; const request = ({ moreToken = '' }) => got({ diff --git a/lib/routes/ikea/cn/utils.ts b/lib/routes/ikea/cn/utils.ts index 75e8af590e..1d067a1901 100644 --- a/lib/routes/ikea/cn/utils.ts +++ b/lib/routes/ikea/cn/utils.ts @@ -1,7 +1,8 @@ -import { art } from '@/utils/render'; -import md5 from '@/utils/md5'; import path from 'node:path'; +import md5 from '@/utils/md5'; +import { art } from '@/utils/render'; + const generateRequestHeaders = () => { const now = Math.round(Date.now() / 1000); return { @@ -36,4 +37,4 @@ const generateProductItem = (product) => { }; }; -export { generateRequestHeaders, generateProductItem }; +export { generateProductItem, generateRequestHeaders }; diff --git a/lib/routes/ikea/gb/new.ts b/lib/routes/ikea/gb/new.ts index 8ad4219e86..ea374dbec7 100644 --- a/lib/routes/ikea/gb/new.ts +++ b/lib/routes/ikea/gb/new.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/gb/new', diff --git a/lib/routes/ikea/gb/offer.ts b/lib/routes/ikea/gb/offer.ts index 8634a1066e..10387aae3b 100644 --- a/lib/routes/ikea/gb/offer.ts +++ b/lib/routes/ikea/gb/offer.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + export const route: Route = { path: '/gb/offer', categories: ['shopping'], diff --git a/lib/routes/iknowwhatyoudownload/daily.ts b/lib/routes/iknowwhatyoudownload/daily.ts index b305f03e41..635d910d57 100644 --- a/lib/routes/iknowwhatyoudownload/daily.ts +++ b/lib/routes/iknowwhatyoudownload/daily.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; +import path from 'node:path'; + import { load } from 'cheerio'; import dayjs from 'dayjs'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; interface TableData { key: string; diff --git a/lib/routes/imagemagick/changelog.ts b/lib/routes/imagemagick/changelog.ts index 8fc3e219d4..b02047493b 100644 --- a/lib/routes/imagemagick/changelog.ts +++ b/lib/routes/imagemagick/changelog.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + const md = MarkdownIt({ html: true, }); diff --git a/lib/routes/imdb/chart.ts b/lib/routes/imdb/chart.ts index 056f60ccf9..a9e58a4eb2 100644 --- a/lib/routes/imdb/chart.ts +++ b/lib/routes/imdb/chart.ts @@ -1,11 +1,15 @@ -import { Route, ViewType } from '@/types'; -import ofetch from '@/utils/ofetch'; +import path from 'node:path'; + import * as cheerio from 'cheerio'; import type { Context } from 'hono'; -import { ChartTitleSearchConnection } from './types'; -import path from 'node:path'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; import { art } from '@/utils/render'; +import type { ChartTitleSearchConnection } from './types'; + const render = (data) => art(path.join(__dirname, 'templates/chart.art'), data); export const route: Route = { diff --git a/lib/routes/imhcg/blog.ts b/lib/routes/imhcg/blog.ts index 73cb24f9a7..e0fdadf15c 100644 --- a/lib/routes/imhcg/blog.ts +++ b/lib/routes/imhcg/blog.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; + export const route: Route = { path: '/', categories: ['blog'], diff --git a/lib/routes/imiker/jinghua.ts b/lib/routes/imiker/jinghua.ts index ce2aeca23f..bbd1f07df0 100644 --- a/lib/routes/imiker/jinghua.ts +++ b/lib/routes/imiker/jinghua.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/ask/jinghua', diff --git a/lib/routes/immich/cursed-knowledge.ts b/lib/routes/immich/cursed-knowledge.ts index c148eee3e9..93eaffe43d 100644 --- a/lib/routes/immich/cursed-knowledge.ts +++ b/lib/routes/immich/cursed-knowledge.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/imop/tianshu.ts b/lib/routes/imop/tianshu.ts index 62b66f7a35..ca90d0e36f 100644 --- a/lib/routes/imop/tianshu.ts +++ b/lib/routes/imop/tianshu.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; -import got from '@/utils/got'; import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; const baseUrl = 'http://t.imop.com'; diff --git a/lib/routes/index.tsx b/lib/routes/index.tsx index 240e1bbb14..7eb4a91410 100644 --- a/lib/routes/index.tsx +++ b/lib/routes/index.tsx @@ -1,4 +1,5 @@ import type { Handler } from 'hono'; + import Index from '@/views/index'; const handler: Handler = (ctx) => { diff --git a/lib/routes/indianexpress/section.ts b/lib/routes/indianexpress/section.ts index 81ca1edf56..1a0fdebb9d 100644 --- a/lib/routes/indianexpress/section.ts +++ b/lib/routes/indianexpress/section.ts @@ -1,11 +1,10 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; - import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + export const handler = async (ctx: Context): Promise => { const { id = 'trending' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '50', 10); diff --git a/lib/routes/indiansinkuwait/latest.ts b/lib/routes/indiansinkuwait/latest.ts index f4e31a159a..ad58cf8d76 100644 --- a/lib/routes/indiansinkuwait/latest.ts +++ b/lib/routes/indiansinkuwait/latest.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://www.indiansinkuwait.com'; diff --git a/lib/routes/indienova/article.ts b/lib/routes/indienova/article.ts index fce76cdbbc..d44a011d36 100644 --- a/lib/routes/indienova/article.ts +++ b/lib/routes/indienova/article.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseList, parseItem } from './utils'; + +import { parseItem, parseList } from './utils'; export const route: Route = { path: '/:type', diff --git a/lib/routes/indienova/column.ts b/lib/routes/indienova/column.ts index e0f3e1ecee..a159044fb1 100644 --- a/lib/routes/indienova/column.ts +++ b/lib/routes/indienova/column.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { baseUrl, parseList, parseItem } from './utils'; + +import { baseUrl, parseItem, parseList } from './utils'; export const route: Route = { path: '/column/:columnId', diff --git a/lib/routes/indienova/gamedb.ts b/lib/routes/indienova/gamedb.ts index e1a155100f..dc25cbb624 100644 --- a/lib/routes/indienova/gamedb.ts +++ b/lib/routes/indienova/gamedb.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/indienova/usergames.ts b/lib/routes/indienova/usergames.ts index 9e998e77af..33b3b79466 100644 --- a/lib/routes/indienova/usergames.ts +++ b/lib/routes/indienova/usergames.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/indienova/utils.ts b/lib/routes/indienova/utils.ts index 51c8ad6a4b..dc6b3e6a1c 100644 --- a/lib/routes/indienova/utils.ts +++ b/lib/routes/indienova/utils.ts @@ -1,5 +1,6 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; @@ -36,4 +37,4 @@ const parseItem = async (item) => { return item; }; -export { baseUrl, parseList, parseItem }; +export { baseUrl, parseItem, parseList }; diff --git a/lib/routes/inewsweek/index.ts b/lib/routes/inewsweek/index.ts index f1c2b362e6..24233919e5 100644 --- a/lib/routes/inewsweek/index.ts +++ b/lib/routes/inewsweek/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import iconv from 'iconv-lite'; const rootUrl = 'http://news.inewsweek.cn'; diff --git a/lib/routes/infoq/presentations.ts b/lib/routes/infoq/presentations.ts index 8cf7ea4bf1..dd5f1e7c17 100644 --- a/lib/routes/infoq/presentations.ts +++ b/lib/routes/infoq/presentations.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const handler = async (ctx) => { const { conference } = ctx.req.param(); diff --git a/lib/routes/infoq/recommend.ts b/lib/routes/infoq/recommend.ts index b2ec6aa303..830f0a7a36 100644 --- a/lib/routes/infoq/recommend.ts +++ b/lib/routes/infoq/recommend.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/infoq/topic.ts b/lib/routes/infoq/topic.ts index 071f25dbdd..b5326f3994 100644 --- a/lib/routes/infoq/topic.ts +++ b/lib/routes/infoq/topic.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/informedainews/docs.ts b/lib/routes/informedainews/docs.ts index 4838ee5f9a..fbf9646dc7 100644 --- a/lib/routes/informedainews/docs.ts +++ b/lib/routes/informedainews/docs.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; // 统一使用的请求库 import { load } from 'cheerio'; // 类似 jQuery 的 API HTML 解析器 -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; // 统一使用的请求库 +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/zh-Hans/docs/:type', diff --git a/lib/routes/informs/index.ts b/lib/routes/informs/index.ts index 3f636a5257..cfbb0aa74e 100644 --- a/lib/routes/informs/index.ts +++ b/lib/routes/informs/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; -import { config } from '@/config'; -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; const rootUrl = 'https://pubsonline.informs.org'; diff --git a/lib/routes/infzm/hot.ts b/lib/routes/infzm/hot.ts index 5801f9c6e0..c9757097a5 100644 --- a/lib/routes/infzm/hot.ts +++ b/lib/routes/infzm/hot.ts @@ -1,6 +1,7 @@ import type { Data, DataItem, Route } from '@/types'; -import type { ContentsResponse } from './types'; import got from '@/utils/got'; + +import type { ContentsResponse } from './types'; import { fetchArticles } from './utils'; export const route: Route = { diff --git a/lib/routes/infzm/index.ts b/lib/routes/infzm/index.ts index e0beedf5e2..753201a21d 100644 --- a/lib/routes/infzm/index.ts +++ b/lib/routes/infzm/index.ts @@ -1,6 +1,7 @@ import type { Data, DataItem, Route } from '@/types'; -import type { ContentsResponse } from './types'; import got from '@/utils/got'; + +import type { ContentsResponse } from './types'; import { fetchArticles } from './utils'; export const route: Route = { diff --git a/lib/routes/infzm/utils.ts b/lib/routes/infzm/utils.ts index 83ca753898..43b659e65b 100644 --- a/lib/routes/infzm/utils.ts +++ b/lib/routes/infzm/utils.ts @@ -1,8 +1,10 @@ +import { load } from 'cheerio'; + import { config } from '@/config'; import cache from '@/utils/cache'; import got from '@/utils/got'; import timezone from '@/utils/timezone'; -import { load } from 'cheerio'; + import { baseUrl } from '.'; export async function fetchArticles(data) { diff --git a/lib/routes/inoreader/index.ts b/lib/routes/inoreader/index.ts index 59e52b3314..49afdb60f2 100644 --- a/lib/routes/inoreader/index.ts +++ b/lib/routes/inoreader/index.ts @@ -1,6 +1,8 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/inoreader/rss.ts b/lib/routes/inoreader/rss.ts index e8a4a4f5fa..159e5ccb25 100644 --- a/lib/routes/inoreader/rss.ts +++ b/lib/routes/inoreader/rss.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; -import parser from '@/utils/rss-parser'; import { load } from 'cheerio'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import parser from '@/utils/rss-parser'; + export const route: Route = { path: '/rss/:user/:tag', categories: ['reading'], diff --git a/lib/routes/inspirehep/author.ts b/lib/routes/inspirehep/author.ts index 768ebea1d0..559de49d02 100644 --- a/lib/routes/inspirehep/author.ts +++ b/lib/routes/inspirehep/author.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import { AuthorResponse, LiteratureResponse } from './types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import type { AuthorResponse, LiteratureResponse } from './types'; import { baseUrl, parseLiterature } from './utils'; export const route: Route = { diff --git a/lib/routes/inspirehep/literature.ts b/lib/routes/inspirehep/literature.ts index 64a2f1f545..18c5429920 100644 --- a/lib/routes/inspirehep/literature.ts +++ b/lib/routes/inspirehep/literature.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; -import { LiteratureResponse } from './types'; +import type { LiteratureResponse } from './types'; import { baseUrl, parseLiterature } from './utils'; export const route: Route = { diff --git a/lib/routes/inspirehep/utils.ts b/lib/routes/inspirehep/utils.ts index fe903b5e91..3279b63873 100644 --- a/lib/routes/inspirehep/utils.ts +++ b/lib/routes/inspirehep/utils.ts @@ -1,6 +1,7 @@ -import { LiteratureResponse } from './types'; import { parseDate } from '@/utils/parse-date'; +import type { LiteratureResponse } from './types'; + export const baseUrl = 'https://inspirehep.net'; export const parseLiterature = (hits: LiteratureResponse['hits']['hits']) => diff --git a/lib/routes/instagram/common-utils.ts b/lib/routes/instagram/common-utils.ts index 11f6be3dac..d2339c6bc8 100644 --- a/lib/routes/instagram/common-utils.ts +++ b/lib/routes/instagram/common-utils.ts @@ -1,6 +1,7 @@ +import path from 'node:path'; + import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const renderItems = (items) => items.map((item) => { diff --git a/lib/routes/instagram/private-api/index.ts b/lib/routes/instagram/private-api/index.ts index 860c7ad744..bb1d55f484 100644 --- a/lib/routes/instagram/private-api/index.ts +++ b/lib/routes/instagram/private-api/index.ts @@ -1,10 +1,12 @@ -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; -import { ig, login } from './utils'; -import logger from '@/utils/logger'; import { config } from '@/config'; -import { renderItems } from '../common-utils'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import logger from '@/utils/logger'; + +import { renderItems } from '../common-utils'; +import { ig, login } from './utils'; // loadContent pulls the desired user/tag/etc async function loadContent(category, nameOrId, tryGet) { diff --git a/lib/routes/instagram/private-api/utils.ts b/lib/routes/instagram/private-api/utils.ts index db481f2421..7121613a0d 100644 --- a/lib/routes/instagram/private-api/utils.ts +++ b/lib/routes/instagram/private-api/utils.ts @@ -1,7 +1,8 @@ import { IgApiClient } from 'instagram-private-api'; -import logger from '@/utils/logger'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import logger from '@/utils/logger'; const ig = new IgApiClient(); diff --git a/lib/routes/instagram/web-api/index.ts b/lib/routes/instagram/web-api/index.ts index cf80edef45..a51b461ab4 100644 --- a/lib/routes/instagram/web-api/index.ts +++ b/lib/routes/instagram/web-api/index.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { CookieJar } from 'tough-cookie'; + import { config } from '@/config'; -import { renderItems } from '../common-utils'; -import { baseUrl, COOKIE_URL, checkLogin, getUserInfo, getUserFeedItems, getTagsFeed, renderGuestItems } from './utils'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; + +import { renderItems } from '../common-utils'; +import { baseUrl, checkLogin, COOKIE_URL, getTagsFeed, getUserFeedItems, getUserInfo, renderGuestItems } from './utils'; export const route: Route = { path: '/2/:category/:key', diff --git a/lib/routes/instagram/web-api/utils.ts b/lib/routes/instagram/web-api/utils.ts index 062025ff7d..62b48eba1d 100644 --- a/lib/routes/instagram/web-api/utils.ts +++ b/lib/routes/instagram/web-api/utils.ts @@ -1,10 +1,11 @@ -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; const baseUrl = 'https://www.instagram.com'; const COOKIE_URL = baseUrl; @@ -195,4 +196,4 @@ const renderGuestItems = (items) => { }); }; -export { baseUrl, COOKIE_URL, checkLogin, getUserInfo, getUserFeedItems, getTagsFeed, renderGuestItems }; +export { baseUrl, checkLogin, COOKIE_URL, getTagsFeed, getUserFeedItems, getUserInfo, renderGuestItems }; diff --git a/lib/routes/instructables/projects.ts b/lib/routes/instructables/projects.ts index 5708fd6ed8..bf2b133746 100644 --- a/lib/routes/instructables/projects.ts +++ b/lib/routes/instructables/projects.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/investor/index.ts b/lib/routes/investor/index.ts index e1e3841b12..b482af2b09 100644 --- a/lib/routes/investor/index.ts +++ b/lib/routes/investor/index.ts @@ -1,13 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const { id = 'home/zxdt' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '20', 10); diff --git a/lib/routes/iplaysoft/category.ts b/lib/routes/iplaysoft/category.ts index 2fe4fe4963..de211f0c30 100644 --- a/lib/routes/iplaysoft/category.ts +++ b/lib/routes/iplaysoft/category.ts @@ -1,5 +1,7 @@ -import { Data, DataItem, Route, ViewType } from '@/types'; -import { fetchNewsItems, fetchCategory } from './utils'; +import type { Data, DataItem, Route} from '@/types'; +import { ViewType } from '@/types'; + +import { fetchCategory, fetchNewsItems } from './utils'; export const handler = async (ctx): Promise => { const slug = ctx.req.param('slug'); diff --git a/lib/routes/iplaysoft/index.ts b/lib/routes/iplaysoft/index.ts index 301569071e..1a5253b382 100644 --- a/lib/routes/iplaysoft/index.ts +++ b/lib/routes/iplaysoft/index.ts @@ -1,9 +1,11 @@ -import { Data, DataItem, Route, ViewType } from '@/types'; +import { load } from 'cheerio'; // html parser + +import type { Data, DataItem, Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import parser from '@/utils/rss-parser'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; // html parser +import parser from '@/utils/rss-parser'; export const handler = async (ctx): Promise => { const feed = await parser.parseURL('https://feed.iplaysoft.com'); diff --git a/lib/routes/iplaysoft/tag.ts b/lib/routes/iplaysoft/tag.ts index 16c8894714..803b3c6b8c 100644 --- a/lib/routes/iplaysoft/tag.ts +++ b/lib/routes/iplaysoft/tag.ts @@ -1,4 +1,6 @@ -import { Data, DataItem, Route, ViewType } from '@/types'; +import type { Data, DataItem, Route} from '@/types'; +import { ViewType } from '@/types'; + import { fetchNewsItems, fetchTag } from './utils'; export const handler = async (ctx): Promise => { diff --git a/lib/routes/iplaysoft/utils.ts b/lib/routes/iplaysoft/utils.ts index 0dec7ef6b0..a107ba993c 100644 --- a/lib/routes/iplaysoft/utils.ts +++ b/lib/routes/iplaysoft/utils.ts @@ -1,5 +1,5 @@ -import ofetch from '@/utils/ofetch'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; const rootUrl = 'https://www.iplaysoft.com/'; @@ -31,4 +31,4 @@ async function fetchNewsItems(apiUrl: string) { })); } -export { fetchCategory, fetchTag, fetchNewsItems }; +export { fetchCategory, fetchNewsItems, fetchTag }; diff --git a/lib/routes/ippa/rss.ts b/lib/routes/ippa/rss.ts index db65ffaf5c..6b2e5b631b 100644 --- a/lib/routes/ippa/rss.ts +++ b/lib/routes/ippa/rss.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Route } from '@/types'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/', diff --git a/lib/routes/ipsw.dev/index.ts b/lib/routes/ipsw.dev/index.ts index 7c82618356..d499cde88a 100644 --- a/lib/routes/ipsw.dev/index.ts +++ b/lib/routes/ipsw.dev/index.ts @@ -1,9 +1,11 @@ -import { Data, Route } from '@/types'; -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Data, Route } from '@/types'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + export const route: Route = { path: '/index/:productID', categories: ['program-update'], diff --git a/lib/routes/ipsw.dev/namespace.ts b/lib/routes/ipsw.dev/namespace.ts index 3beb11a3b1..c6aa0c69bd 100644 --- a/lib/routes/ipsw.dev/namespace.ts +++ b/lib/routes/ipsw.dev/namespace.ts @@ -1,4 +1,4 @@ -import { Namespace } from '@/types'; +import type { Namespace } from '@/types'; export const namespace: Namespace = { name: 'IPSW.dev', diff --git a/lib/routes/ipsw/index.ts b/lib/routes/ipsw/index.ts index fd6bed4d3c..3834f7932b 100644 --- a/lib/routes/ipsw/index.ts +++ b/lib/routes/ipsw/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; const host = 'https://ipsw.me/'; diff --git a/lib/routes/iqilu/program.ts b/lib/routes/iqilu/program.ts index f6adb066c0..931cee632a 100644 --- a/lib/routes/iqilu/program.ts +++ b/lib/routes/iqilu/program.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/v/:category{.+}?', diff --git a/lib/routes/iqiyi/album.ts b/lib/routes/iqiyi/album.ts index 58a3e233b5..b3f6393af8 100644 --- a/lib/routes/iqiyi/album.ts +++ b/lib/routes/iqiyi/album.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; export const route: Route = { path: '/album/:id', diff --git a/lib/routes/iqiyi/video.ts b/lib/routes/iqiyi/video.ts index 218b118cfe..e4bab38a59 100644 --- a/lib/routes/iqiyi/video.ts +++ b/lib/routes/iqiyi/video.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + import { config } from '@/config'; -import { parseDate } from '@/utils/parse-date'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import logger from '@/utils/logger'; +import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; // /iqiyi/user/video/:uid diff --git a/lib/routes/iqnew/latest.ts b/lib/routes/iqnew/latest.ts index dff3fb2f75..e8c18a223c 100644 --- a/lib/routes/iqnew/latest.ts +++ b/lib/routes/iqnew/latest.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/iresearch/report.ts b/lib/routes/iresearch/report.ts index 6820cf65cd..90dff3cc18 100644 --- a/lib/routes/iresearch/report.ts +++ b/lib/routes/iresearch/report.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; -import { type Context } from 'hono'; -import path from 'node:path'; - const types = { 1: { label: '最新报告', diff --git a/lib/routes/iresearch/weekly.ts b/lib/routes/iresearch/weekly.ts index 3eacd9001b..70cd0163db 100644 --- a/lib/routes/iresearch/weekly.ts +++ b/lib/routes/iresearch/weekly.ts @@ -1,7 +1,7 @@ -import { type Data, type Route, ViewType } from '@/types'; - import { type Context } from 'hono'; +import { type Data, type Route, ViewType } from '@/types'; + export const handler = (ctx: Context): Data | undefined => { const { id } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '20', 10); diff --git a/lib/routes/isct/news.ts b/lib/routes/isct/news.ts index 9d0e867735..6dbbc63ebd 100644 --- a/lib/routes/isct/news.ts +++ b/lib/routes/isct/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { decode } from 'entities'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { decode } from 'entities'; interface MediaItem { ID: string; diff --git a/lib/routes/issuehunt/funded.ts b/lib/routes/issuehunt/funded.ts index 792029abd0..0c110e51f4 100644 --- a/lib/routes/issuehunt/funded.ts +++ b/lib/routes/issuehunt/funded.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import MarkdownIt from 'markdown-it'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/funded/:username/:repo', categories: ['programming'], diff --git a/lib/routes/itc/collection.ts b/lib/routes/itc/collection.ts index 9487149d32..b92190757d 100644 --- a/lib/routes/itc/collection.ts +++ b/lib/routes/itc/collection.ts @@ -1,7 +1,8 @@ -import { DataItem, Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import type { DataItem, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + /** * OpenGithub - Github开源项目精选 * colType:0 | 1 | 2 | 3 diff --git a/lib/routes/itch/devlog.ts b/lib/routes/itch/devlog.ts index bf3b167a88..b82cb71363 100644 --- a/lib/routes/itch/devlog.ts +++ b/lib/routes/itch/devlog.ts @@ -1,14 +1,15 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; 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 path from 'node:path'; +import timezone from '@/utils/timezone'; import { isValidHost } from '@/utils/valid-host'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; export const route: Route = { path: '/devlog/:user/:id', diff --git a/lib/routes/itch/index.ts b/lib/routes/itch/index.ts index 539b9f6ffa..4dc4bbc71d 100644 --- a/lib/routes/itch/index.ts +++ b/lib/routes/itch/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; - -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + export const route: Route = { path: '*', name: 'Unknown', diff --git a/lib/routes/itch/posts.ts b/lib/routes/itch/posts.ts index f453acbfe3..515f9542a8 100644 --- a/lib/routes/itch/posts.ts +++ b/lib/routes/itch/posts.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ithome/index.ts b/lib/routes/ithome/index.ts index 1064ce2161..4253434677 100644 --- a/lib/routes/ithome/index.ts +++ b/lib/routes/ithome/index.ts @@ -1,8 +1,9 @@ +import { load } from 'cheerio'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; const get_url = (caty) => `https://${caty}.ithome.com/`; diff --git a/lib/routes/ithome/ranking.ts b/lib/routes/ithome/ranking.ts index a1b948a211..2ca38d824e 100644 --- a/lib/routes/ithome/ranking.ts +++ b/lib/routes/ithome/ranking.ts @@ -1,8 +1,9 @@ +import { load } from 'cheerio'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/ranking/:type', diff --git a/lib/routes/ithome/tag.ts b/lib/routes/ithome/tag.ts index e04e15c680..024d577d0f 100644 --- a/lib/routes/ithome/tag.ts +++ b/lib/routes/ithome/tag.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; const rootUrl = 'https://www.ithome.com/'; diff --git a/lib/routes/ithome/tw/feeds.ts b/lib/routes/ithome/tw/feeds.ts index 7d4fbd94d0..ce34c88e77 100644 --- a/lib/routes/ithome/tw/feeds.ts +++ b/lib/routes/ithome/tw/feeds.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ithome/zt.ts b/lib/routes/ithome/zt.ts index ebeb20ae3f..68a44745ca 100644 --- a/lib/routes/ithome/zt.ts +++ b/lib/routes/ithome/zt.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 path from 'node:path'; +import timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { id = 'xijiayi' } = ctx.req.param(); diff --git a/lib/routes/iwara/index.ts b/lib/routes/iwara/index.ts index 4f80ac364a..d54718be8b 100644 --- a/lib/routes/iwara/index.ts +++ b/lib/routes/iwara/index.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; const rootUrl = 'https://www.iwara.tv'; const apiRootUrl = 'https://api.iwara.tv'; diff --git a/lib/routes/iwara/subscriptions.ts b/lib/routes/iwara/subscriptions.ts index cd372a0ab9..d45e4a0375 100644 --- a/lib/routes/iwara/subscriptions.ts +++ b/lib/routes/iwara/subscriptions.ts @@ -1,13 +1,15 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import MarkdownIt from 'markdown-it'; + +import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { config } from '@/config'; -import { art } from '@/utils/render'; import { parseDate } from '@/utils/parse-date'; -import path from 'node:path'; -import MarkdownIt from 'markdown-it'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; +import { art } from '@/utils/render'; + const md = MarkdownIt({ html: true, }); diff --git a/lib/routes/ixigua/user-video.ts b/lib/routes/ixigua/user-video.ts index 71031fd0b0..86af9560fd 100644 --- a/lib/routes/ixigua/user-video.ts +++ b/lib/routes/ixigua/user-video.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; const host = 'https://www.ixigua.com'; diff --git a/lib/routes/j-test/news.ts b/lib/routes/j-test/news.ts index ab102eac10..a49aea97fe 100644 --- a/lib/routes/j-test/news.ts +++ b/lib/routes/j-test/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/jamesclear/book-summaries.ts b/lib/routes/jamesclear/book-summaries.ts index 9fa662a236..91dcfb91f5 100644 --- a/lib/routes/jamesclear/book-summaries.ts +++ b/lib/routes/jamesclear/book-summaries.ts @@ -1,5 +1,7 @@ -import { Data, Route, ViewType } from '@/types'; -import { rootUrl, fetchContent, processItem } from './utils'; +import type { Data, Route} from '@/types'; +import { ViewType } from '@/types'; + +import { fetchContent, processItem, rootUrl } from './utils'; export const route: Route = { path: '/book-summaries', diff --git a/lib/routes/jamesclear/great-speeches.ts b/lib/routes/jamesclear/great-speeches.ts index 46d6aa4629..8af078cbee 100644 --- a/lib/routes/jamesclear/great-speeches.ts +++ b/lib/routes/jamesclear/great-speeches.ts @@ -1,5 +1,7 @@ -import { Data, Route, ViewType } from '@/types'; -import { rootUrl, fetchContent, processItem } from './utils'; +import type { Data, Route} from '@/types'; +import { ViewType } from '@/types'; + +import { fetchContent, processItem, rootUrl } from './utils'; export const route: Route = { path: '/great-speeches', diff --git a/lib/routes/jamesclear/quotes.ts b/lib/routes/jamesclear/quotes.ts index 52e231ee5c..bdf6ac7ab2 100644 --- a/lib/routes/jamesclear/quotes.ts +++ b/lib/routes/jamesclear/quotes.ts @@ -1,5 +1,7 @@ -import { Data, Route, ViewType } from '@/types'; -import { rootUrl, fetchContent, processItem } from './utils'; +import type { Data, Route} from '@/types'; +import { ViewType } from '@/types'; + +import { fetchContent, processItem, rootUrl } from './utils'; export const route: Route = { path: '/quotes', diff --git a/lib/routes/jamesclear/three-two-one.ts b/lib/routes/jamesclear/three-two-one.ts index a3f0c9ed92..b32af1c736 100644 --- a/lib/routes/jamesclear/three-two-one.ts +++ b/lib/routes/jamesclear/three-two-one.ts @@ -1,5 +1,7 @@ -import { Data, Route, ViewType } from '@/types'; -import { rootUrl, fetchContent, processItem } from './utils'; +import type { Data, Route} from '@/types'; +import { ViewType } from '@/types'; + +import { fetchContent, processItem, rootUrl } from './utils'; export const route: Route = { path: '/3-2-1', diff --git a/lib/routes/jamesclear/utils.ts b/lib/routes/jamesclear/utils.ts index 47d7fed564..b43a36df35 100644 --- a/lib/routes/jamesclear/utils.ts +++ b/lib/routes/jamesclear/utils.ts @@ -1,6 +1,6 @@ +import type { DataItem } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { DataItem } from '@/types'; export const rootUrl = 'https://jamesclear.com'; export const apiUrl = `${rootUrl}/wp-json/wp/v2`; diff --git a/lib/routes/jandan/index.ts b/lib/routes/jandan/index.ts index 217da9e60c..6da1571f2c 100644 --- a/lib/routes/jandan/index.ts +++ b/lib/routes/jandan/index.ts @@ -1,7 +1,8 @@ -import { Route, DataItem } from '@/types'; +import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import parser from '@/utils/rss-parser'; export const route: Route = { diff --git a/lib/routes/jandan/section.ts b/lib/routes/jandan/section.ts index cb1b6c3910..bb9432cc35 100644 --- a/lib/routes/jandan/section.ts +++ b/lib/routes/jandan/section.ts @@ -1,5 +1,6 @@ -import { Route, DataItem } from '@/types'; -import { handleTopSection, handleForumSection, handleCommentSection } from './utils'; +import type { DataItem, Route } from '@/types'; + +import { handleCommentSection, handleForumSection, handleTopSection } from './utils'; export const route: Route = { path: '/:category/:type?', diff --git a/lib/routes/jandan/utils.ts b/lib/routes/jandan/utils.ts index ecdf9d3c39..1b37789c02 100644 --- a/lib/routes/jandan/utils.ts +++ b/lib/routes/jandan/utils.ts @@ -1,6 +1,7 @@ -import { DataItem } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { DataItem } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36'; diff --git a/lib/routes/japanpost/router.ts b/lib/routes/japanpost/router.ts index 616116dcf6..1449e8da20 100644 --- a/lib/routes/japanpost/router.ts +++ b/lib/routes/japanpost/router.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { track } from './track'; export const route: Route = { diff --git a/lib/routes/japanpost/track.ts b/lib/routes/japanpost/track.ts index d8d014e9f1..0022fcfa3d 100644 --- a/lib/routes/japanpost/track.ts +++ b/lib/routes/japanpost/track.ts @@ -1,7 +1,10 @@ +import path from 'node:path'; + +import { load } from 'cheerio'; + import got from '@/utils/got'; import { art } from '@/utils/render'; -import { load } from 'cheerio'; -import path from 'node:path'; + import utils from './utils'; let baseTitle = '日本郵便'; diff --git a/lib/routes/japanpost/utils.ts b/lib/routes/japanpost/utils.ts index a7261bd1b5..fe8fec4336 100644 --- a/lib/routes/japanpost/utils.ts +++ b/lib/routes/japanpost/utils.ts @@ -3,8 +3,9 @@ import crypto from 'node:crypto'; import cityTimezones from 'city-timezones'; import dayjs from 'dayjs'; import customParseFormat from 'dayjs/plugin/customParseFormat.js'; -import utc from 'dayjs/plugin/utc.js'; import timezone from 'dayjs/plugin/timezone.js'; +import utc from 'dayjs/plugin/utc.js'; + dayjs.extend(customParseFormat); dayjs.extend(utc); dayjs.extend(timezone); diff --git a/lib/routes/javbus/index.ts b/lib/routes/javbus/index.ts index f42579d975..1c9e975c12 100644 --- a/lib/routes/javbus/index.ts +++ b/lib/routes/javbus/index.ts @@ -1,14 +1,16 @@ -import { Route, ViewType } from '@/types'; - -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'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; const toSize = (raw) => { const matches = raw.match(/(\d+(\.\d+)?)(\w+)/); diff --git a/lib/routes/javdb/actors.ts b/lib/routes/javdb/actors.ts index 0bee34cde7..6f90acbd84 100644 --- a/lib/routes/javdb/actors.ts +++ b/lib/routes/javdb/actors.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/javdb/index.ts b/lib/routes/javdb/index.ts index c8629a50ab..33ee637d36 100644 --- a/lib/routes/javdb/index.ts +++ b/lib/routes/javdb/index.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/javdb/lists.ts b/lib/routes/javdb/lists.ts index dd065b4211..83a09d64f1 100644 --- a/lib/routes/javdb/lists.ts +++ b/lib/routes/javdb/lists.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/javdb/makers.ts b/lib/routes/javdb/makers.ts index eb2e207816..4fd03a830d 100644 --- a/lib/routes/javdb/makers.ts +++ b/lib/routes/javdb/makers.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/javdb/rankings.ts b/lib/routes/javdb/rankings.ts index 1eb21db21e..48f5d01724 100644 --- a/lib/routes/javdb/rankings.ts +++ b/lib/routes/javdb/rankings.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/javdb/search.ts b/lib/routes/javdb/search.ts index 910f71fbba..f02cfa756e 100644 --- a/lib/routes/javdb/search.ts +++ b/lib/routes/javdb/search.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/javdb/series.ts b/lib/routes/javdb/series.ts index de8bb45b65..9fac1055bf 100644 --- a/lib/routes/javdb/series.ts +++ b/lib/routes/javdb/series.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/javdb/tags.ts b/lib/routes/javdb/tags.ts index 3e8c7cc5df..ac77eccb88 100644 --- a/lib/routes/javdb/tags.ts +++ b/lib/routes/javdb/tags.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/javdb/utils.ts b/lib/routes/javdb/utils.ts index fc4b0b6171..133a22a148 100644 --- a/lib/routes/javdb/utils.ts +++ b/lib/routes/javdb/utils.ts @@ -1,11 +1,12 @@ -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; import { Cookie, CookieJar } from 'tough-cookie'; +import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + const allowDomain = new Set(['javdb.com', 'javdb36.com', 'javdb007.com', 'javdb521.com']); const ProcessItems = async (ctx, currentUrl, title) => { diff --git a/lib/routes/javdb/videocodes.ts b/lib/routes/javdb/videocodes.ts index bd8acccec0..b1d58d9941 100644 --- a/lib/routes/javdb/videocodes.ts +++ b/lib/routes/javdb/videocodes.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/javlibrary/bestrated.ts b/lib/routes/javlibrary/bestrated.ts index 1d26c643b5..e34f905b07 100644 --- a/lib/routes/javlibrary/bestrated.ts +++ b/lib/routes/javlibrary/bestrated.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { defaultMode, defaultLanguage, rootUrl, ProcessItems } from './utils'; + +import { defaultLanguage, defaultMode, ProcessItems, rootUrl } from './utils'; export const route: Route = { path: ['/videos/bestrated/:language?/:mode?', '/bestrated/:language?/:mode?'], diff --git a/lib/routes/javlibrary/bestreviews.ts b/lib/routes/javlibrary/bestreviews.ts index 2982af67f1..38b060de50 100644 --- a/lib/routes/javlibrary/bestreviews.ts +++ b/lib/routes/javlibrary/bestreviews.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { defaultMode, defaultLanguage, rootUrl, ProcessItems } from './utils'; + +import { defaultLanguage, defaultMode, ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/bestreviews/:language?/:mode?', diff --git a/lib/routes/javlibrary/genre.ts b/lib/routes/javlibrary/genre.ts index 2919c51d20..d02c0bdfad 100644 --- a/lib/routes/javlibrary/genre.ts +++ b/lib/routes/javlibrary/genre.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { defaultMode, defaultGenre, defaultLanguage, rootUrl, ProcessItems } from './utils'; + +import { defaultGenre, defaultLanguage, defaultMode, ProcessItems, rootUrl } from './utils'; export const route: Route = { path: ['/videos/genre/:genre?/:language?/:mode?', '/genre/:genre?/:language?/:mode?'], diff --git a/lib/routes/javlibrary/maker.ts b/lib/routes/javlibrary/maker.ts index f1f081ebad..1428158d35 100644 --- a/lib/routes/javlibrary/maker.ts +++ b/lib/routes/javlibrary/maker.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { defaultMode, defaultLanguage, defaultMaker, rootUrl, ProcessItems } from './utils'; + +import { defaultLanguage, defaultMaker, defaultMode, ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/videos/maker/:maker?/:language?/:mode?', diff --git a/lib/routes/javlibrary/mostwanted.ts b/lib/routes/javlibrary/mostwanted.ts index 974a2e3e63..7474ec4340 100644 --- a/lib/routes/javlibrary/mostwanted.ts +++ b/lib/routes/javlibrary/mostwanted.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { defaultMode, defaultLanguage, rootUrl, ProcessItems } from './utils'; + +import { defaultLanguage, defaultMode, ProcessItems, rootUrl } from './utils'; export const route: Route = { path: ['/videos/mostwanted/:language?/:mode?', '/mostwanted/:language?/:mode?'], diff --git a/lib/routes/javlibrary/newentries.ts b/lib/routes/javlibrary/newentries.ts index e7ce07d02f..6bc22aca1d 100644 --- a/lib/routes/javlibrary/newentries.ts +++ b/lib/routes/javlibrary/newentries.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { defaultLanguage, rootUrl, ProcessItems } from './utils'; + +import { defaultLanguage, ProcessItems, rootUrl } from './utils'; export const route: Route = { path: ['/videos/newentries/:language?', '/newentries/:language?'], diff --git a/lib/routes/javlibrary/newrelease.ts b/lib/routes/javlibrary/newrelease.ts index b3a0f9d98c..0bad12e3fa 100644 --- a/lib/routes/javlibrary/newrelease.ts +++ b/lib/routes/javlibrary/newrelease.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { defaultMode, defaultLanguage, rootUrl, ProcessItems } from './utils'; + +import { defaultLanguage, defaultMode, ProcessItems, rootUrl } from './utils'; export const route: Route = { path: ['/videos/newrelease/:language?/:mode?', '/newrelease/:language?/:mode?'], diff --git a/lib/routes/javlibrary/star.ts b/lib/routes/javlibrary/star.ts index 1ef2d2d3ec..32eca89f0d 100644 --- a/lib/routes/javlibrary/star.ts +++ b/lib/routes/javlibrary/star.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { defaultMode, defaultLanguage, rootUrl, ProcessItems } from './utils'; + +import { defaultLanguage, defaultMode, ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/star/:id/:language?/:mode?', diff --git a/lib/routes/javlibrary/update.ts b/lib/routes/javlibrary/update.ts index f545d0735a..5b75ed5129 100644 --- a/lib/routes/javlibrary/update.ts +++ b/lib/routes/javlibrary/update.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { defaultLanguage, rootUrl, ProcessItems } from './utils'; + +import { defaultLanguage, ProcessItems, rootUrl } from './utils'; export const route: Route = { path: ['/videos/update/:language?', '/update/:language?'], diff --git a/lib/routes/javlibrary/user.ts b/lib/routes/javlibrary/user.ts index 4fa6105a04..d64bb7f55c 100644 --- a/lib/routes/javlibrary/user.ts +++ b/lib/routes/javlibrary/user.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { defaultLanguage, rootUrl, ProcessItems } from './utils'; + +import { defaultLanguage, ProcessItems, rootUrl } from './utils'; export const route: Route = { path: ['/users/:id/:type/:language?', '/:type/:id/:language?'], diff --git a/lib/routes/javlibrary/utils.ts b/lib/routes/javlibrary/utils.ts index 7c473b00f8..fbd5d8a766 100644 --- a/lib/routes/javlibrary/utils.ts +++ b/lib/routes/javlibrary/utils.ts @@ -1,8 +1,10 @@ -import got from '@/utils/got'; +import path from 'node:path'; + import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const rootUrl = 'https://www.javlibrary.com'; const defaultMode = '1'; @@ -91,4 +93,4 @@ const ProcessItems = async (language, currentUrl, tryGet) => { }; }; -export { rootUrl, defaultMode, defaultGenre, defaultMaker, defaultLanguage, ProcessItems }; +export { defaultGenre, defaultLanguage, defaultMaker, defaultMode, ProcessItems, rootUrl }; diff --git a/lib/routes/javtiful/actress.ts b/lib/routes/javtiful/actress.ts index 053473f88a..b9d013c7b9 100644 --- a/lib/routes/javtiful/actress.ts +++ b/lib/routes/javtiful/actress.ts @@ -1,6 +1,8 @@ -import { Route, Data, DataItem } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Data, DataItem, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + import { parseItems } from './utils'; export const route: Route = { diff --git a/lib/routes/javtiful/channel.ts b/lib/routes/javtiful/channel.ts index f2b2f93805..1aa1a2e512 100644 --- a/lib/routes/javtiful/channel.ts +++ b/lib/routes/javtiful/channel.ts @@ -1,6 +1,8 @@ -import { Route, Data, DataItem } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Data, DataItem, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + import { parseItems } from './utils'; export const route: Route = { diff --git a/lib/routes/javtiful/utils.ts b/lib/routes/javtiful/utils.ts index 9408224d96..01c1ec4dd6 100644 --- a/lib/routes/javtiful/utils.ts +++ b/lib/routes/javtiful/utils.ts @@ -1,6 +1,7 @@ -import { art } from '@/utils/render'; import path from 'node:path'; + import { parseRelativeDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; const renderDescription = (data) => art(path.join(__dirname, 'templates/description.art'), data); diff --git a/lib/routes/javtrailers/casts.ts b/lib/routes/javtrailers/casts.ts index 822d8c550c..efc3420274 100644 --- a/lib/routes/javtrailers/casts.ts +++ b/lib/routes/javtrailers/casts.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + import { baseUrl, getItem, headers, parseList } from './utils'; export const route: Route = { diff --git a/lib/routes/javtrailers/categories.ts b/lib/routes/javtrailers/categories.ts index bf1dd2f5b0..929d6533e1 100644 --- a/lib/routes/javtrailers/categories.ts +++ b/lib/routes/javtrailers/categories.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + import { baseUrl, getItem, headers, parseList } from './utils'; export const route: Route = { diff --git a/lib/routes/javtrailers/studios.ts b/lib/routes/javtrailers/studios.ts index b92cb2fb2c..66788017a6 100644 --- a/lib/routes/javtrailers/studios.ts +++ b/lib/routes/javtrailers/studios.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + import { baseUrl, getItem, headers, parseList } from './utils'; export const route: Route = { diff --git a/lib/routes/javtrailers/utils.ts b/lib/routes/javtrailers/utils.ts index d4f05430ad..5283026222 100644 --- a/lib/routes/javtrailers/utils.ts +++ b/lib/routes/javtrailers/utils.ts @@ -1,9 +1,10 @@ -import { Video } from './types'; +import path from 'node:path'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; + +import type { Video } from './types'; export const baseUrl = 'https://javtrailers.com'; export const headers = { diff --git a/lib/routes/jbma/report.ts b/lib/routes/jbma/report.ts index d5a06a84de..3a1238c6a4 100644 --- a/lib/routes/jbma/report.ts +++ b/lib/routes/jbma/report.ts @@ -1,11 +1,10 @@ -import { type Data, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; - import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; +import { type Data, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + export const handler = async (ctx: Context): Promise => { const { filter } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '50', 10); diff --git a/lib/routes/jd/price.ts b/lib/routes/jd/price.ts index 95e664e255..aab4545cfe 100644 --- a/lib/routes/jd/price.ts +++ b/lib/routes/jd/price.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/price/:id', diff --git a/lib/routes/jetbrains/comments.ts b/lib/routes/jetbrains/comments.ts index 285cbac788..154532ce41 100644 --- a/lib/routes/jetbrains/comments.ts +++ b/lib/routes/jetbrains/comments.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import MarkdownIt from 'markdown-it'; const md = MarkdownIt({ html: true }); diff --git a/lib/routes/jewishmuseum/exhibitions.ts b/lib/routes/jewishmuseum/exhibitions.ts index 47caa13fdf..e92b79931e 100644 --- a/lib/routes/jewishmuseum/exhibitions.ts +++ b/lib/routes/jewishmuseum/exhibitions.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import buildData from '@/utils/common-config'; export const route: Route = { diff --git a/lib/routes/jianshu/collection.ts b/lib/routes/jianshu/collection.ts index 0c31627f93..d33a0d62c6 100644 --- a/lib/routes/jianshu/collection.ts +++ b/lib/routes/jianshu/collection.ts @@ -1,7 +1,10 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import util from './utils'; export const route: Route = { diff --git a/lib/routes/jianshu/home.ts b/lib/routes/jianshu/home.ts index faeb1e8a31..2e3bcaff8b 100644 --- a/lib/routes/jianshu/home.ts +++ b/lib/routes/jianshu/home.ts @@ -1,7 +1,10 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import util from './utils'; export const route: Route = { diff --git a/lib/routes/jianshu/user.ts b/lib/routes/jianshu/user.ts index 7224ad3401..8f3ee3c0ff 100644 --- a/lib/routes/jianshu/user.ts +++ b/lib/routes/jianshu/user.ts @@ -1,7 +1,10 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import util from './utils'; export const route: Route = { diff --git a/lib/routes/jianshu/utils.ts b/lib/routes/jianshu/utils.ts index f08c80abab..0b96cc1db8 100644 --- a/lib/routes/jianshu/utils.ts +++ b/lib/routes/jianshu/utils.ts @@ -1,5 +1,6 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/jiaoliudao/index.ts b/lib/routes/jiaoliudao/index.ts index 25495d07f1..8c45adc12a 100644 --- a/lib/routes/jiaoliudao/index.ts +++ b/lib/routes/jiaoliudao/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/jiemian/account.ts b/lib/routes/jiemian/account.ts index 641ada8374..fc12165f60 100644 --- a/lib/routes/jiemian/account.ts +++ b/lib/routes/jiemian/account.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import { handler } from './common'; diff --git a/lib/routes/jiemian/common.ts b/lib/routes/jiemian/common.ts index 8625e44975..d34a0208cb 100644 --- a/lib/routes/jiemian/common.ts +++ b/lib/routes/jiemian/common.ts @@ -1,11 +1,12 @@ -import { Data } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Data } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const handler = async (ctx): Promise => { const { category = '' } = ctx.req.param(); diff --git a/lib/routes/jiemian/lists.ts b/lib/routes/jiemian/lists.ts index 638d605f87..49909a574d 100644 --- a/lib/routes/jiemian/lists.ts +++ b/lib/routes/jiemian/lists.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import { handler } from './common'; diff --git a/lib/routes/jiemian/special.ts b/lib/routes/jiemian/special.ts index 0cbb139375..44aca401eb 100644 --- a/lib/routes/jiemian/special.ts +++ b/lib/routes/jiemian/special.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import { handler } from './common'; diff --git a/lib/routes/jiemian/video.ts b/lib/routes/jiemian/video.ts index 3579920031..6c6fa0619d 100644 --- a/lib/routes/jiemian/video.ts +++ b/lib/routes/jiemian/video.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import { handler } from './common'; diff --git a/lib/routes/jiemian/vip.ts b/lib/routes/jiemian/vip.ts index f0a7949c15..a044a9ca5d 100644 --- a/lib/routes/jiemian/vip.ts +++ b/lib/routes/jiemian/vip.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import { handler } from './common'; diff --git a/lib/routes/jike/topic-text.ts b/lib/routes/jike/topic-text.ts index 10300f2180..893559a933 100644 --- a/lib/routes/jike/topic-text.ts +++ b/lib/routes/jike/topic-text.ts @@ -1,5 +1,7 @@ -import { Route } from '@/types'; import dayjs from 'dayjs'; + +import type { Route } from '@/types'; + import { constructTopicEntry } from './utils'; export const route: Route = { diff --git a/lib/routes/jike/topic.ts b/lib/routes/jike/topic.ts index 7b98add5ae..507fc94fcd 100644 --- a/lib/routes/jike/topic.ts +++ b/lib/routes/jike/topic.ts @@ -1,10 +1,13 @@ -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; -import { topicDataHanding, constructTopicEntry } from './utils'; import { load } from 'cheerio'; import dayjs from 'dayjs'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + +import { constructTopicEntry, topicDataHanding } from './utils'; + const urlRegex = /(https?:\/\/[^\s"'<>]+)/g; export const route: Route = { diff --git a/lib/routes/jike/user.ts b/lib/routes/jike/user.ts index c90e45ae27..ec50350d0c 100644 --- a/lib/routes/jike/user.ts +++ b/lib/routes/jike/user.ts @@ -1,6 +1,8 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/jike/utils.ts b/lib/routes/jike/utils.ts index 747e0deca8..9fbe7b082d 100644 --- a/lib/routes/jike/utils.ts +++ b/lib/routes/jike/utils.ts @@ -1,8 +1,9 @@ -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; -import got from '@/utils/got'; import { load } from 'cheerio'; + import { config } from '@/config'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; const videoAPI = 'https://api.ruguoapp.com/1.0/mediaMeta/play?type=ORIGINAL_POST'; const topicDataHanding = (data, ctx) => @@ -193,4 +194,4 @@ const constructTopicEntry = async (ctx, url) => { return data; }; -export { topicDataHanding, constructTopicEntry }; +export { constructTopicEntry, topicDataHanding }; diff --git a/lib/routes/jimmyspa/books.ts b/lib/routes/jimmyspa/books.ts index 42f0fefd2a..fd7ba0c641 100644 --- a/lib/routes/jimmyspa/books.ts +++ b/lib/routes/jimmyspa/books.ts @@ -1,11 +1,14 @@ -import { Route, ViewType } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; -import cache from '@/utils/cache'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + export const route: Route = { path: '/books/:language', categories: ['design'], diff --git a/lib/routes/jimmyspa/news.ts b/lib/routes/jimmyspa/news.ts index 3ea920c174..fa30c5879b 100644 --- a/lib/routes/jimmyspa/news.ts +++ b/lib/routes/jimmyspa/news.ts @@ -1,10 +1,13 @@ -import { Route, ViewType } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + export const route: Route = { path: '/news/:language', categories: ['design'], diff --git a/lib/routes/jin10/category.ts b/lib/routes/jin10/category.ts index 752493f1cf..f71df3d0f6 100644 --- a/lib/routes/jin10/category.ts +++ b/lib/routes/jin10/category.ts @@ -1,12 +1,13 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { config } from '@/config'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/category/:id', diff --git a/lib/routes/jin10/index.ts b/lib/routes/jin10/index.ts index 637f9b9629..0e91283cf9 100644 --- a/lib/routes/jin10/index.ts +++ b/lib/routes/jin10/index.ts @@ -1,12 +1,13 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { config } from '@/config'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:important?', diff --git a/lib/routes/jin10/topic.ts b/lib/routes/jin10/topic.ts index 6b292dbf48..4d2ead2d0a 100644 --- a/lib/routes/jin10/topic.ts +++ b/lib/routes/jin10/topic.ts @@ -1,9 +1,10 @@ -import { Route, ViewType } from '@/types'; +import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { config } from '@/config'; export const route: Route = { path: '/topic/:id', diff --git a/lib/routes/jingzhengu/news.ts b/lib/routes/jingzhengu/news.ts index 6f434f9cec..8b32d905c8 100644 --- a/lib/routes/jingzhengu/news.ts +++ b/lib/routes/jingzhengu/news.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; -import { NewsInfo, NewsDetail } from './types'; - +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + +import type { NewsDetail, NewsInfo } from './types'; import { sign } from './utils'; export const route: Route = { diff --git a/lib/routes/jinritemai/docs.ts b/lib/routes/jinritemai/docs.ts index daffd9c418..4cffa0a464 100644 --- a/lib/routes/jinritemai/docs.ts +++ b/lib/routes/jinritemai/docs.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/jinse/catalogue.ts b/lib/routes/jinse/catalogue.ts index 94c5961d6a..166fceca3d 100644 --- a/lib/routes/jinse/catalogue.ts +++ b/lib/routes/jinse/catalogue.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const categories = { zhengce: '政策', diff --git a/lib/routes/jinse/lives.ts b/lib/routes/jinse/lives.ts index 6c6bf773c8..3e47a5fc88 100644 --- a/lib/routes/jinse/lives.ts +++ b/lib/routes/jinse/lives.ts @@ -1,10 +1,12 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const categories = { 0: '全部', diff --git a/lib/routes/jinse/timeline.ts b/lib/routes/jinse/timeline.ts index 62cef9d0ea..99b313337b 100644 --- a/lib/routes/jinse/timeline.ts +++ b/lib/routes/jinse/timeline.ts @@ -1,11 +1,13 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/timeline/:category?', diff --git a/lib/routes/jisilu/category.ts b/lib/routes/jisilu/category.ts index 528b8f090c..e90c12a780 100644 --- a/lib/routes/jisilu/category.ts +++ b/lib/routes/jisilu/category.ts @@ -1,12 +1,11 @@ import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; -import { type DataItem, type Route, type Data, ViewType } from '@/types'; - +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; -import { rootUrl, processItems } from './util'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; +import { processItems, rootUrl } from './util'; export const handler = async (ctx: Context): Promise => { const { id } = ctx.req.param(); diff --git a/lib/routes/jisilu/explore.ts b/lib/routes/jisilu/explore.ts index e88d2e8697..47c8637d86 100644 --- a/lib/routes/jisilu/explore.ts +++ b/lib/routes/jisilu/explore.ts @@ -1,11 +1,10 @@ import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; -import { type DataItem, type Route, type Data, ViewType } from '@/types'; - +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; -import { rootUrl, processItems } from './util'; +import { processItems, rootUrl } from './util'; export const handler = async (ctx: Context): Promise => { const { filter } = ctx.req.param(); diff --git a/lib/routes/jisilu/people.ts b/lib/routes/jisilu/people.ts index 875789e095..ed9f2bb354 100644 --- a/lib/routes/jisilu/people.ts +++ b/lib/routes/jisilu/people.ts @@ -1,12 +1,11 @@ import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; -import { type DataItem, type Route, type Data, ViewType } from '@/types'; - +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; -import { rootUrl, processItems } from './util'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; +import { processItems, rootUrl } from './util'; const actions: { [key: string]: string } = { questions: '101', diff --git a/lib/routes/jisilu/topic.ts b/lib/routes/jisilu/topic.ts index 9c66af1e0d..7520ae9c8f 100644 --- a/lib/routes/jisilu/topic.ts +++ b/lib/routes/jisilu/topic.ts @@ -1,11 +1,10 @@ import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; -import { type DataItem, type Route, type Data, ViewType } from '@/types'; - +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; -import { rootUrl, processItems } from './util'; +import { processItems, rootUrl } from './util'; export const handler = async (ctx: Context): Promise => { const { id } = ctx.req.param(); diff --git a/lib/routes/jisilu/util.ts b/lib/routes/jisilu/util.ts index fba4e3600f..099f7b1d64 100644 --- a/lib/routes/jisilu/util.ts +++ b/lib/routes/jisilu/util.ts @@ -1,8 +1,7 @@ -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type DataItem } from '@/types'; - import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; @@ -109,4 +108,4 @@ const processItems: ($: CheerioAPI, targetEl: Cheerio, limit: number) = .slice(0, limit); }; -export { rootUrl, processItems }; +export { processItems, rootUrl }; diff --git a/lib/routes/jiuyangongshe/community.ts b/lib/routes/jiuyangongshe/community.ts index 4b8d5a573e..c4426baa15 100644 --- a/lib/routes/jiuyangongshe/community.ts +++ b/lib/routes/jiuyangongshe/community.ts @@ -1,11 +1,14 @@ -import { Data, Route, ViewType } from '@/types'; +import path from 'node:path'; + import type { Context } from 'hono'; + +import type { Data, Route} from '@/types'; +import { ViewType } from '@/types'; +import md5 from '@/utils/md5'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; -import md5 from '@/utils/md5'; -import path from 'node:path'; import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; interface User { follow_type: number; diff --git a/lib/routes/jjwxc/author.ts b/lib/routes/jjwxc/author.ts index 99d32e746d..161715711e 100644 --- a/lib/routes/jjwxc/author.ts +++ b/lib/routes/jjwxc/author.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/author/:id?', diff --git a/lib/routes/jjwxc/book.ts b/lib/routes/jjwxc/book.ts index 152660b0a7..c8a773ec87 100644 --- a/lib/routes/jjwxc/book.ts +++ b/lib/routes/jjwxc/book.ts @@ -1,13 +1,15 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; -import timezone from '@/utils/timezone'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/book/:id?', diff --git a/lib/routes/jl1mall/forum.ts b/lib/routes/jl1mall/forum.ts index 977d3c3407..63be480abc 100644 --- a/lib/routes/jl1mall/forum.ts +++ b/lib/routes/jl1mall/forum.ts @@ -1,11 +1,10 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { type Context } from 'hono'; - type MainIdsResult = { name: string | undefined; racer2: string | undefined; diff --git a/lib/routes/jlu/ccst/xwzx/index.ts b/lib/routes/jlu/ccst/xwzx/index.ts index c46566b900..0105f006a8 100644 --- a/lib/routes/jlu/ccst/xwzx/index.ts +++ b/lib/routes/jlu/ccst/xwzx/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; // Custom got instance import { load } from 'cheerio'; // HTML parser with jQuery-like API +import type { Route } from '@/types'; +import got from '@/utils/got'; // Custom got instance + export const route: Route = { path: '/ccst/xwzx/:category', categories: ['university'], diff --git a/lib/routes/jlu/jwc.ts b/lib/routes/jlu/jwc.ts index b3056275e0..885aad094c 100644 --- a/lib/routes/jlu/jwc.ts +++ b/lib/routes/jlu/jwc.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; // 自订的 got import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 +import type { Route } from '@/types'; +import got from '@/utils/got'; // 自订的 got + export const route: Route = { path: '/jwc', categories: ['university'], diff --git a/lib/routes/jlu/phy/index.ts b/lib/routes/jlu/phy/index.ts index 4b0ed4ad4f..e0e71f8129 100644 --- a/lib/routes/jlu/phy/index.ts +++ b/lib/routes/jlu/phy/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/phy/:category/:column/:subcolumn?', categories: ['university'], diff --git a/lib/routes/joins/chinese.ts b/lib/routes/joins/chinese.ts index de858ad1e3..330250502e 100644 --- a/lib/routes/joins/chinese.ts +++ b/lib/routes/joins/chinese.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 path from 'node:path'; +import timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { category = '' } = ctx.req.param(); diff --git a/lib/routes/joneslanglasalle/index.ts b/lib/routes/joneslanglasalle/index.ts index df4e59cd46..fcf275aea7 100644 --- a/lib/routes/joneslanglasalle/index.ts +++ b/lib/routes/joneslanglasalle/index.ts @@ -1,15 +1,14 @@ import path from 'node:path'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type Context } from 'hono'; -import { type DataItem, type Route, type Data, ViewType } from '@/types'; - -import { art } from '@/utils/render'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; const cleanHtml = (html: string, preservedTags: string[]): string => { const $ = load(html); diff --git a/lib/routes/jornada/index.ts b/lib/routes/jornada/index.ts index f833b25fae..30703d43c0 100644 --- a/lib/routes/jornada/index.ts +++ b/lib/routes/jornada/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/joshwcomeau/latest.ts b/lib/routes/joshwcomeau/latest.ts index 2483403361..cafbe26b05 100644 --- a/lib/routes/joshwcomeau/latest.ts +++ b/lib/routes/joshwcomeau/latest.ts @@ -1,4 +1,5 @@ -import { Data, Route } from '@/types'; +import type { Data, Route } from '@/types'; + import { getRelativeUrlList, processList, rootUrl } from './utils'; export const route: Route = { diff --git a/lib/routes/joshwcomeau/popular.ts b/lib/routes/joshwcomeau/popular.ts index dd5c352ce0..ae4194f09a 100644 --- a/lib/routes/joshwcomeau/popular.ts +++ b/lib/routes/joshwcomeau/popular.ts @@ -1,4 +1,5 @@ -import { Data, Route } from '@/types'; +import type { Data, Route } from '@/types'; + import { getRelativeUrlList, processList, rootUrl } from './utils'; export const route: Route = { diff --git a/lib/routes/joshwcomeau/utils.ts b/lib/routes/joshwcomeau/utils.ts index 90a71a73ed..b864e9355a 100644 --- a/lib/routes/joshwcomeau/utils.ts +++ b/lib/routes/joshwcomeau/utils.ts @@ -1,8 +1,9 @@ -import { DataItem } from '@/types'; import { load } from 'cheerio'; + +import type { DataItem } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import cache from '@/utils/cache'; export const rootUrl = 'https://www.joshwcomeau.com'; diff --git a/lib/routes/jou/home.ts b/lib/routes/jou/home.ts index 599b87f662..7c9d147eba 100644 --- a/lib/routes/jou/home.ts +++ b/lib/routes/jou/home.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { getItems } from './utils'; const url = 'https://www.jou.edu.cn/index/tzgg.htm'; diff --git a/lib/routes/jou/utils/index.ts b/lib/routes/jou/utils/index.ts index ce72716b2e..6e1a09759f 100644 --- a/lib/routes/jou/utils/index.ts +++ b/lib/routes/jou/utils/index.ts @@ -1,6 +1,7 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; // 使用ofetch库 -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/jou/yz.ts b/lib/routes/jou/yz.ts index eb2eeb11dc..031c0c0311 100644 --- a/lib/routes/jou/yz.ts +++ b/lib/routes/jou/yz.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { getItems } from './utils'; const url = 'https://yz.jou.edu.cn/index/zxgg.htm'; diff --git a/lib/routes/jpmorganchase/research.ts b/lib/routes/jpmorganchase/research.ts index 19f93b3292..ece655603a 100644 --- a/lib/routes/jpmorganchase/research.ts +++ b/lib/routes/jpmorganchase/research.ts @@ -1,7 +1,8 @@ -import { Data, DataItem, Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Data, DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; const base = 'https://www.jpmorganchase.com'; diff --git a/lib/routes/jpxgmn/search.ts b/lib/routes/jpxgmn/search.ts index 14367c85ac..c558535bd4 100644 --- a/lib/routes/jpxgmn/search.ts +++ b/lib/routes/jpxgmn/search.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; -import { getOriginUrl, getArticleDesc } from './utils'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; +import { getArticleDesc, getOriginUrl } from './utils'; + export const route: Route = { path: '/search/:kw', categories: ['picture'], diff --git a/lib/routes/jpxgmn/tab.ts b/lib/routes/jpxgmn/tab.ts index c2c051a3ad..ccd5bbfd92 100644 --- a/lib/routes/jpxgmn/tab.ts +++ b/lib/routes/jpxgmn/tab.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; -import { getOriginUrl, getArticleDesc } from './utils'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; +import { getArticleDesc, getOriginUrl } from './utils'; + export const route: Route = { path: '/tab/:tab?', categories: ['picture'], diff --git a/lib/routes/jpxgmn/utils.ts b/lib/routes/jpxgmn/utils.ts index 79fde99648..97e370faf5 100644 --- a/lib/routes/jpxgmn/utils.ts +++ b/lib/routes/jpxgmn/utils.ts @@ -1,8 +1,10 @@ +import path from 'node:path'; + +import { load } from 'cheerio'; + +import cache from '@/utils/cache'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import { load } from 'cheerio'; -import cache from '@/utils/cache'; -import path from 'node:path'; const indexUrl = 'http://mei8.vip/'; @@ -38,4 +40,4 @@ const getArticleDesc = async (articleUrl) => { }); }; -export { getOriginUrl, getArticleDesc }; +export { getArticleDesc, getOriginUrl }; diff --git a/lib/routes/jpxgmn/weekly.ts b/lib/routes/jpxgmn/weekly.ts index e8f76ea39c..51e727cd5d 100644 --- a/lib/routes/jpxgmn/weekly.ts +++ b/lib/routes/jpxgmn/weekly.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; -import { getOriginUrl, getArticleDesc } from './utils'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; +import { getArticleDesc, getOriginUrl } from './utils'; + export const route: Route = { path: '/weekly', categories: ['picture'], diff --git a/lib/routes/jrj/index.ts b/lib/routes/jrj/index.ts index 6d3caa1aef..6162727dea 100644 --- a/lib/routes/jrj/index.ts +++ b/lib/routes/jrj/index.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; const options = { '103': '财经资讯', diff --git a/lib/routes/jseea/news.ts b/lib/routes/jseea/news.ts index 3df23bcba0..aba745372b 100644 --- a/lib/routes/jseea/news.ts +++ b/lib/routes/jseea/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/jsu/cxzx.ts b/lib/routes/jsu/cxzx.ts index a2a0dd2400..9b65d748d6 100644 --- a/lib/routes/jsu/cxzx.ts +++ b/lib/routes/jsu/cxzx.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 + +import type { Route } from '@/types'; import cache from '@/utils/cache'; // 导入必要的模组 import got from '@/utils/got'; // 自订的 got -import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 import { parseDate } from '@/utils/parse-date'; + import { getPageItemAndDate } from './utils/index'; export const route: Route = { diff --git a/lib/routes/jsu/jwc.ts b/lib/routes/jsu/jwc.ts index 2fad40add0..a0c48e68b5 100644 --- a/lib/routes/jsu/jwc.ts +++ b/lib/routes/jsu/jwc.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 + +import type { Route } from '@/types'; import cache from '@/utils/cache'; // 导入必要的模组 import got from '@/utils/got'; // 自订的 got -import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 import { parseDate } from '@/utils/parse-date'; + import { getPageItemAndDate } from './utils'; export const route: Route = { diff --git a/lib/routes/jsu/math.ts b/lib/routes/jsu/math.ts index f1f0d0d4f8..2c9d719abe 100644 --- a/lib/routes/jsu/math.ts +++ b/lib/routes/jsu/math.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 + +import type { Route } from '@/types'; import cache from '@/utils/cache'; // 导入必要的模组 import got from '@/utils/got'; // 自订的 got -import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 import { parseDate } from '@/utils/parse-date'; + import { getPageItemAndDate } from './utils'; export const route: Route = { diff --git a/lib/routes/jsu/rjxy.ts b/lib/routes/jsu/rjxy.ts index 206d04487a..bc455368f5 100644 --- a/lib/routes/jsu/rjxy.ts +++ b/lib/routes/jsu/rjxy.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 + +import type { Route } from '@/types'; import cache from '@/utils/cache'; // 导入必要的模组 import got from '@/utils/got'; // 自订的 got -import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 import { parseDate } from '@/utils/parse-date'; + import { getPageItemAndDate } from './utils'; export const route: Route = { diff --git a/lib/routes/jsu/universityindex.ts b/lib/routes/jsu/universityindex.ts index 80f5df07cb..d6b022cc7e 100644 --- a/lib/routes/jsu/universityindex.ts +++ b/lib/routes/jsu/universityindex.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 + +import type { Route } from '@/types'; import cache from '@/utils/cache'; // 导入必要的模组 import got from '@/utils/got'; // 自订的 got -import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 import { parseDate } from '@/utils/parse-date'; + import { getPageItemAndDate } from './utils'; export const route: Route = { diff --git a/lib/routes/jsu/utils/index.ts b/lib/routes/jsu/utils/index.ts index 82594e747d..cb228ec0a3 100644 --- a/lib/routes/jsu/utils/index.ts +++ b/lib/routes/jsu/utils/index.ts @@ -1,6 +1,7 @@ -import got from '@/utils/got'; // 自订的 got import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 +import got from '@/utils/got'; // 自订的 got + /** * 获取页面内容 * @param selector 正文CSS选择器 diff --git a/lib/routes/juejin/aicoding.ts b/lib/routes/juejin/aicoding.ts index c5300f5265..22a394422a 100644 --- a/lib/routes/juejin/aicoding.ts +++ b/lib/routes/juejin/aicoding.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; + +import type { Tag } from './types'; import { getTagList, parseList, ProcessFeed } from './utils'; -import { Tag } from './types'; export const route: Route = { path: '/aicoding/:tag?/:sort?', diff --git a/lib/routes/juejin/books.ts b/lib/routes/juejin/books.ts index 8bd1dccbe5..1605639322 100644 --- a/lib/routes/juejin/books.ts +++ b/lib/routes/juejin/books.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/juejin/category.ts b/lib/routes/juejin/category.ts index 15252a5d74..2bef6d0e0b 100644 --- a/lib/routes/juejin/category.ts +++ b/lib/routes/juejin/category.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; + import { getCategoryBrief, parseList, ProcessFeed } from './utils'; export const route: Route = { diff --git a/lib/routes/juejin/collection.ts b/lib/routes/juejin/collection.ts index bfac803772..6cd8630754 100644 --- a/lib/routes/juejin/collection.ts +++ b/lib/routes/juejin/collection.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { getCollection, parseList, ProcessFeed } from './utils'; export const route: Route = { diff --git a/lib/routes/juejin/collections.ts b/lib/routes/juejin/collections.ts index b28f1c2e08..04ae5395bc 100644 --- a/lib/routes/juejin/collections.ts +++ b/lib/routes/juejin/collections.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; + +import type { Article } from './types'; import { getCollection, parseList, ProcessFeed } from './utils'; -import { Article } from './types'; export const route: Route = { path: '/collections/:userId', diff --git a/lib/routes/juejin/column.ts b/lib/routes/juejin/column.ts index 2f8a89494c..5d6d142a63 100644 --- a/lib/routes/juejin/column.ts +++ b/lib/routes/juejin/column.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; + import { parseList, ProcessFeed } from './utils'; export const route: Route = { diff --git a/lib/routes/juejin/dynamic.ts b/lib/routes/juejin/dynamic.ts index d37bebcc8b..e0a000fe63 100644 --- a/lib/routes/juejin/dynamic.ts +++ b/lib/routes/juejin/dynamic.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/juejin/pins.ts b/lib/routes/juejin/pins.ts index 98dbd699ac..dc9187a959 100644 --- a/lib/routes/juejin/pins.ts +++ b/lib/routes/juejin/pins.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/juejin/posts.ts b/lib/routes/juejin/posts.ts index a35a4031d4..82366af7f8 100644 --- a/lib/routes/juejin/posts.ts +++ b/lib/routes/juejin/posts.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; + +import type { Article, AuthorUserInfo } from './types'; import { parseList, ProcessFeed } from './utils'; -import { Article, AuthorUserInfo } from './types'; export const route: Route = { path: '/posts/:id', diff --git a/lib/routes/juejin/tag.ts b/lib/routes/juejin/tag.ts index 072ce3cb78..85df1f3cb4 100644 --- a/lib/routes/juejin/tag.ts +++ b/lib/routes/juejin/tag.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; + import { getTag, parseList, ProcessFeed } from './utils'; export const route: Route = { diff --git a/lib/routes/juejin/trending.ts b/lib/routes/juejin/trending.ts index e4460ca4dd..282b57614e 100644 --- a/lib/routes/juejin/trending.ts +++ b/lib/routes/juejin/trending.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; + import { getCategoryBrief, parseList, ProcessFeed } from './utils'; export const route: Route = { diff --git a/lib/routes/juejin/utils.ts b/lib/routes/juejin/utils.ts index 4581fe3d72..6e7a836f25 100644 --- a/lib/routes/juejin/utils.ts +++ b/lib/routes/juejin/utils.ts @@ -1,9 +1,12 @@ -import ofetch from '@/utils/ofetch'; -import * as cheerio from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; import crypto from 'node:crypto'; + +import * as cheerio from 'cheerio'; + import cache from '@/utils/cache'; -import { Category, Collection, Tag } from './types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + +import type { Category, Collection, Tag } from './types'; const b64tou8a = (str) => Uint8Array.from(Buffer.from(str, 'base64')); const b64tohex = (str) => Buffer.from(str, 'base64').toString('hex'); diff --git a/lib/routes/jumeili/home.ts b/lib/routes/jumeili/home.ts index 96a7a1ce4f..7f98619432 100644 --- a/lib/routes/jumeili/home.ts +++ b/lib/routes/jumeili/home.ts @@ -1,8 +1,9 @@ +import { load } from 'cheerio'; + import { config } from '@/config'; -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; export const route: Route = { path: '/home/:column?', diff --git a/lib/routes/jump/discount.ts b/lib/routes/jump/discount.ts index da3082dc5f..2622c41a32 100644 --- a/lib/routes/jump/discount.ts +++ b/lib/routes/jump/discount.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; const discountUrl = 'https://switch.jumpvg.com/jump/discount/find4Discount/5/v2'; // const detailUrl = 'https://switch.jumpvg.com/jump/game/detail'; diff --git a/lib/routes/junhe/legal-updates.ts b/lib/routes/junhe/legal-updates.ts index 70f5e4a918..cd65ad8963 100644 --- a/lib/routes/junhe/legal-updates.ts +++ b/lib/routes/junhe/legal-updates.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const handler = async (ctx) => { diff --git a/lib/routes/kadokawa/blog.ts b/lib/routes/kadokawa/blog.ts index 1ea17d02c7..33b35ba044 100644 --- a/lib/routes/kadokawa/blog.ts +++ b/lib/routes/kadokawa/blog.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const handler = async (ctx) => { const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 10; diff --git a/lib/routes/kakuyomu/works.ts b/lib/routes/kakuyomu/works.ts index 6bedc75c54..9056767cbb 100644 --- a/lib/routes/kakuyomu/works.ts +++ b/lib/routes/kakuyomu/works.ts @@ -1,11 +1,13 @@ -import type { Data, DataItem, Route } from '@/types'; import { load } from 'cheerio'; import type { Context } from 'hono'; -import ofetch from '@/utils/ofetch'; + +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; -import type { NextDataEpisode } from './types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import type { NextDataEpisode } from './types'; + export const route: Route = { name: '投稿', categories: ['reading'], diff --git a/lib/routes/kamen-rider-official/news.ts b/lib/routes/kamen-rider-official/news.ts index 7f2d792417..d2222b1c1a 100644 --- a/lib/routes/kamen-rider-official/news.ts +++ b/lib/routes/kamen-rider-official/news.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/news/:category?', diff --git a/lib/routes/kantarworldpanel/index.ts b/lib/routes/kantarworldpanel/index.ts index 1efe290824..aea7380b71 100644 --- a/lib/routes/kantarworldpanel/index.ts +++ b/lib/routes/kantarworldpanel/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:region?/:category{.+}?', diff --git a/lib/routes/kanxue/topic.ts b/lib/routes/kanxue/topic.ts index fa7797bbc8..a4613d536c 100644 --- a/lib/routes/kanxue/topic.ts +++ b/lib/routes/kanxue/topic.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseRelativeDate, parseDate } from '@/utils/parse-date'; +import { parseDate, parseRelativeDate } from '@/utils/parse-date'; const baseUrl = 'https://bbs.kanxue.com/'; const categoryId = { diff --git a/lib/routes/kaopu/news.ts b/lib/routes/kaopu/news.ts index 7cc12c9fe2..e673801e1e 100644 --- a/lib/routes/kaopu/news.ts +++ b/lib/routes/kaopu/news.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/kbs/news.ts b/lib/routes/kbs/news.ts index 690516ba2b..cbce5f26dc 100644 --- a/lib/routes/kbs/news.ts +++ b/lib/routes/kbs/news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/news/:category?/:language?', diff --git a/lib/routes/kbs/today.ts b/lib/routes/kbs/today.ts index c1ab171eb6..d8df62d9dd 100644 --- a/lib/routes/kbs/today.ts +++ b/lib/routes/kbs/today.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/today/:language?', diff --git a/lib/routes/kcna/news.ts b/lib/routes/kcna/news.ts index 2e0bc0b6ca..d56b22ab3d 100644 --- a/lib/routes/kcna/news.ts +++ b/lib/routes/kcna/news.ts @@ -1,16 +1,18 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import pMap from 'p-map'; -import { art } from '@/utils/render'; -import { fixDesc, fetchPhoto, fetchVideo } from './utils'; -import path from 'node:path'; import sanitizeHtml from 'sanitize-html'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; +import { fetchPhoto, fetchVideo, fixDesc } from './utils'; + export const route: Route = { path: '/:lang/:category?', categories: ['traditional-media'], diff --git a/lib/routes/kcna/utils.ts b/lib/routes/kcna/utils.ts index fa7d3224af..daac0df10f 100644 --- a/lib/routes/kcna/utils.ts +++ b/lib/routes/kcna/utils.ts @@ -1,8 +1,9 @@ -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + const rootUrl = 'http://www.kcna.kp'; const parseJucheDate = (dateString) => { @@ -57,4 +58,4 @@ const fetchVideo = (ctx, url) => return ``; }); -export { parseJucheDate, fixDesc, fetchPhoto, fetchVideo }; +export { fetchPhoto, fetchVideo, fixDesc, parseJucheDate }; diff --git a/lib/routes/ke/results.ts b/lib/routes/ke/results.ts index 5c5acb2dd6..70b4e8cf6b 100644 --- a/lib/routes/ke/results.ts +++ b/lib/routes/ke/results.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Route } from '@/types'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/researchResults', diff --git a/lib/routes/keep/user.ts b/lib/routes/keep/user.ts index 03658e8cf4..9255155faf 100644 --- a/lib/routes/keep/user.ts +++ b/lib/routes/keep/user.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/user/:id', diff --git a/lib/routes/keepass/news.ts b/lib/routes/keepass/news.ts index 6bd468d541..a3fb705f03 100644 --- a/lib/routes/keepass/news.ts +++ b/lib/routes/keepass/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/kelownacapnews/news.ts b/lib/routes/kelownacapnews/news.ts index 71b1d680c2..8c5b761f33 100644 --- a/lib/routes/kelownacapnews/news.ts +++ b/lib/routes/kelownacapnews/news.ts @@ -1,7 +1,8 @@ -import { DataItem, Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/kemono/index.ts b/lib/routes/kemono/index.ts index 04fa7ecc3f..81625c629b 100644 --- a/lib/routes/kemono/index.ts +++ b/lib/routes/kemono/index.ts @@ -1,13 +1,15 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; + import { KEMONO_API_URL, KEMONO_ROOT_URL, MIME_TYPE_MAP } from './const'; -import { KemonoPost, KemonoFile, DiscordMessage } from './types'; +import type { DiscordMessage, KemonoFile, KemonoPost } from './types'; const headers = { Accept: 'text/css' }; diff --git a/lib/routes/kemono/types.ts b/lib/routes/kemono/types.ts index e640b04184..7f2b8c3d00 100644 --- a/lib/routes/kemono/types.ts +++ b/lib/routes/kemono/types.ts @@ -28,4 +28,4 @@ interface DiscordMessage { attachments?: any[]; } -export type { KemonoPost, KemonoFile, DiscordMessage }; +export type { DiscordMessage, KemonoFile, KemonoPost }; diff --git a/lib/routes/kepu/live.ts b/lib/routes/kepu/live.ts index dad47ff24c..b18531d8b6 100644 --- a/lib/routes/kepu/live.ts +++ b/lib/routes/kepu/live.ts @@ -1,11 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/live', diff --git a/lib/routes/keylol/index.ts b/lib/routes/keylol/index.ts index a77ce0299b..826be41862 100644 --- a/lib/routes/keylol/index.ts +++ b/lib/routes/keylol/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import { config } from '@/config'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; +import queryString from 'query-string'; + +import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; import parser from '@/utils/rss-parser'; -import queryString from 'query-string'; +import timezone from '@/utils/timezone'; const threadIdRegex = /(\d+)-\d+-\d+/; const header = { diff --git a/lib/routes/kimlaw/thesis.ts b/lib/routes/kimlaw/thesis.ts index 78e49dc14c..428cc460de 100644 --- a/lib/routes/kimlaw/thesis.ts +++ b/lib/routes/kimlaw/thesis.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/kiro/blog.ts b/lib/routes/kiro/blog.ts index d34ef5dc3b..ca9602e040 100644 --- a/lib/routes/kiro/blog.ts +++ b/lib/routes/kiro/blog.ts @@ -1,13 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/kiro/changelog.ts b/lib/routes/kiro/changelog.ts index a5edcd3703..747a6cec8b 100644 --- a/lib/routes/kiro/changelog.ts +++ b/lib/routes/kiro/changelog.ts @@ -1,13 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/kisskiss/blog.ts b/lib/routes/kisskiss/blog.ts index 15e0888a13..83891a695e 100644 --- a/lib/routes/kisskiss/blog.ts +++ b/lib/routes/kisskiss/blog.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/komiic/comic.ts b/lib/routes/komiic/comic.ts index 6f08fffda7..8f71776e62 100644 --- a/lib/routes/komiic/comic.ts +++ b/lib/routes/komiic/comic.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Route } from '@/types'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/comic/:id', diff --git a/lib/routes/konachan/post.ts b/lib/routes/konachan/post.ts index b9db016473..9c0559f766 100644 --- a/lib/routes/konachan/post.ts +++ b/lib/routes/konachan/post.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import queryString from 'query-string'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: [ '/post/popular_recent/:period?', // 对应 konachan.com diff --git a/lib/routes/konghq/blog-posts.ts b/lib/routes/konghq/blog-posts.ts index 9ba27898b8..7b33c5ddc7 100644 --- a/lib/routes/konghq/blog-posts.ts +++ b/lib/routes/konghq/blog-posts.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; // Get the lastest blog posts of https://konghq.com/ import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const BASE_URL = 'https://konghq.com'; diff --git a/lib/routes/koreaherald/index.ts b/lib/routes/koreaherald/index.ts index 95263bd12b..d03bb4da63 100644 --- a/lib/routes/koreaherald/index.ts +++ b/lib/routes/koreaherald/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/kovidgoyal/kitty/changelog.ts b/lib/routes/kovidgoyal/kitty/changelog.ts index 983acbb111..0b6febdeca 100644 --- a/lib/routes/kovidgoyal/kitty/changelog.ts +++ b/lib/routes/kovidgoyal/kitty/changelog.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/koyso/index.ts b/lib/routes/koyso/index.ts index 1bb18b0aae..207fcdf407 100644 --- a/lib/routes/koyso/index.ts +++ b/lib/routes/koyso/index.ts @@ -1,13 +1,13 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type Context } from 'hono'; -import path from 'node:path'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { category = '0', sort = 'latest' } = ctx.req.param(); diff --git a/lib/routes/kpmg/insights.ts b/lib/routes/kpmg/insights.ts index 087185af87..07f608dc0d 100644 --- a/lib/routes/kpmg/insights.ts +++ b/lib/routes/kpmg/insights.ts @@ -1,12 +1,14 @@ +import path from 'node:path'; + +import * as cheerio from 'cheerio'; +import type { Context } from 'hono'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import * as cheerio from 'cheerio'; -import { Context } from 'hono'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const baseUrl = 'https://kpmg.com'; const payload = { diff --git a/lib/routes/kpopping/kpics.ts b/lib/routes/kpopping/kpics.ts index a0e2c632de..f83494671b 100644 --- a/lib/routes/kpopping/kpics.ts +++ b/lib/routes/kpopping/kpics.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { filter } = ctx.req.param(); diff --git a/lib/routes/kpopping/news.ts b/lib/routes/kpopping/news.ts index 64a10eb3c9..4cec2f5303 100644 --- a/lib/routes/kpopping/news.ts +++ b/lib/routes/kpopping/news.ts @@ -1,16 +1,16 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; - export const handler = async (ctx: Context): Promise => { const { filter } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '2', 10); diff --git a/lib/routes/ktown4u/artist-brandlist.ts b/lib/routes/ktown4u/artist-brandlist.ts index f488becbe0..4ada52cbc5 100644 --- a/lib/routes/ktown4u/artist-brandlist.ts +++ b/lib/routes/ktown4u/artist-brandlist.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/kuaidi100/index.ts b/lib/routes/kuaidi100/index.ts index 434c1e6af0..6777a323b0 100644 --- a/lib/routes/kuaidi100/index.ts +++ b/lib/routes/kuaidi100/index.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/kuaidi100/supported-company.ts b/lib/routes/kuaidi100/supported-company.ts index 06562000fc..568101b9cd 100644 --- a/lib/routes/kuaidi100/supported-company.ts +++ b/lib/routes/kuaidi100/supported-company.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/kuaidi100/utils.ts b/lib/routes/kuaidi100/utils.ts index af1449b662..7d6bd38ac8 100644 --- a/lib/routes/kuaidi100/utils.ts +++ b/lib/routes/kuaidi100/utils.ts @@ -1,5 +1,6 @@ import cache from '@/utils/cache'; import got from '@/utils/got'; + const wwwid_key = 'kuaidi100-wwwid'; const csrf_key = 'kuaidi100-csrf'; const globacsrftoken_key = 'kuaidi100-globacsrftoken'; diff --git a/lib/routes/kuaishou/profile.ts b/lib/routes/kuaishou/profile.ts index fac8dfeede..e0eaf9e29e 100644 --- a/lib/routes/kuaishou/profile.ts +++ b/lib/routes/kuaishou/profile.ts @@ -1,6 +1,7 @@ -import { Route, Data } from '@/types'; -import puppeteer from '@/utils/puppeteer'; import { config } from '@/config'; +import type { Data, Route } from '@/types'; +import puppeteer from '@/utils/puppeteer'; + export const route: Route = { name: 'Profile', path: '/profile/:principalId', diff --git a/lib/routes/kunchengblog/essay.ts b/lib/routes/kunchengblog/essay.ts index 7161c508b7..3bb85f90f8 100644 --- a/lib/routes/kunchengblog/essay.ts +++ b/lib/routes/kunchengblog/essay.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; import { SourceMapConsumer } from 'source-map'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + export const route: Route = { path: '/essay', categories: ['blog'], diff --git a/lib/routes/kurogames/namespace.ts b/lib/routes/kurogames/namespace.ts index ec104a46cd..56bdd3ad8e 100644 --- a/lib/routes/kurogames/namespace.ts +++ b/lib/routes/kurogames/namespace.ts @@ -1,4 +1,4 @@ -import { Namespace } from '@/types'; +import type { Namespace } from '@/types'; export const namespace: Namespace = { name: '库洛游戏 | Kuro Games', diff --git a/lib/routes/kurogames/wutheringwaves/news.ts b/lib/routes/kurogames/wutheringwaves/news.ts index 0a734a6d78..aee57ca0b9 100644 --- a/lib/routes/kurogames/wutheringwaves/news.ts +++ b/lib/routes/kurogames/wutheringwaves/news.ts @@ -1,10 +1,13 @@ -import { DataItem, Route } from '@/types'; +import * as cheerio from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import * as cheerio from 'cheerio'; -import ofetch from '@/utils/ofetch'; -import { Article, Language, Parameter, SUPPORTED_LANGUAGES } from './constants'; + +import type { Article} from './constants'; +import { Language, Parameter, SUPPORTED_LANGUAGES } from './constants'; import { fetchArticles, getArticleContentLink, getArticleLink, getHandlerLanguage, isValidLanguage, parseInteger } from './utils'; export const route: Route = { diff --git a/lib/routes/kurogames/wutheringwaves/utils.ts b/lib/routes/kurogames/wutheringwaves/utils.ts index 0faaa4d179..fd70f315e3 100644 --- a/lib/routes/kurogames/wutheringwaves/utils.ts +++ b/lib/routes/kurogames/wutheringwaves/utils.ts @@ -1,6 +1,8 @@ +import type { Data } from '@/types'; import ofetch from '@/utils/ofetch'; -import { Data } from '@/types'; -import { Article, Language, SUPPORTED_LANGUAGES } from './constants'; + +import type { Article} from './constants'; +import { Language, SUPPORTED_LANGUAGES } from './constants'; /** * Parse a number or a number as string.\ diff --git a/lib/routes/kuwaitlocal/index.ts b/lib/routes/kuwaitlocal/index.ts index c17f3fa90d..a48480eb04 100644 --- a/lib/routes/kuwaitlocal/index.ts +++ b/lib/routes/kuwaitlocal/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/kyodonews/index.ts b/lib/routes/kyodonews/index.ts index f7a552f36c..328bfb1210 100644 --- a/lib/routes/kyodonews/index.ts +++ b/lib/routes/kyodonews/index.ts @@ -1,14 +1,15 @@ -import { Route } from '@/types'; - -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 path from 'node:path'; + +import { load } from 'cheerio'; + import ConfigNotFoundError from '@/errors/types/config-not-found'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; const resolveRelativeLink = (link, baseUrl) => (link.startsWith('http') ? link : `${baseUrl}${link}`); diff --git a/lib/routes/laimanhua/index.ts b/lib/routes/laimanhua/index.ts index c680c145ef..6e854f3999 100644 --- a/lib/routes/laimanhua/index.ts +++ b/lib/routes/laimanhua/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import iconv from 'iconv-lite'; import { load } from 'cheerio'; +import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/lala/rss.ts b/lib/routes/lala/rss.ts index add332e3f8..992b03dd92 100644 --- a/lib/routes/lala/rss.ts +++ b/lib/routes/lala/rss.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/', categories: ['blog'], diff --git a/lib/routes/landiannews/category.ts b/lib/routes/landiannews/category.ts index b660184a79..1235ea3fa2 100644 --- a/lib/routes/landiannews/category.ts +++ b/lib/routes/landiannews/category.ts @@ -1,5 +1,7 @@ -import { Data, DataItem, Route, ViewType } from '@/types'; -import { fetchNewsItems, fetchCategory } from './utils'; +import type { Data, DataItem, Route} from '@/types'; +import { ViewType } from '@/types'; + +import { fetchCategory, fetchNewsItems } from './utils'; export const handler = async (ctx): Promise => { const slug = ctx.req.param('slug'); diff --git a/lib/routes/landiannews/index.ts b/lib/routes/landiannews/index.ts index 641829ccda..78f2760966 100644 --- a/lib/routes/landiannews/index.ts +++ b/lib/routes/landiannews/index.ts @@ -1,4 +1,6 @@ -import { Data, DataItem, Route, ViewType } from '@/types'; +import type { Data, DataItem, Route} from '@/types'; +import { ViewType } from '@/types'; + import { fetchNewsItems } from './utils'; export const handler = async (): Promise => { diff --git a/lib/routes/landiannews/tag.ts b/lib/routes/landiannews/tag.ts index f7d225b832..0b30ee6b5b 100644 --- a/lib/routes/landiannews/tag.ts +++ b/lib/routes/landiannews/tag.ts @@ -1,4 +1,6 @@ -import { Data, DataItem, Route, ViewType } from '@/types'; +import type { Data, DataItem, Route} from '@/types'; +import { ViewType } from '@/types'; + import { fetchNewsItems, fetchTag } from './utils'; export const handler = async (ctx): Promise => { diff --git a/lib/routes/landiannews/utils.ts b/lib/routes/landiannews/utils.ts index 99f2137147..7507eed68f 100644 --- a/lib/routes/landiannews/utils.ts +++ b/lib/routes/landiannews/utils.ts @@ -1,5 +1,5 @@ -import ofetch from '@/utils/ofetch'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; const rootUrl = 'https://www.landiannews.com/'; @@ -31,4 +31,4 @@ async function fetchNewsItems(apiUrl: string) { })); } -export { fetchCategory, fetchTag, fetchNewsItems }; +export { fetchCategory, fetchNewsItems, fetchTag }; diff --git a/lib/routes/lang/room.ts b/lib/routes/lang/room.ts index ba0ca0e85d..046490eb05 100644 --- a/lib/routes/lang/room.ts +++ b/lib/routes/lang/room.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/live/room/:id', diff --git a/lib/routes/langchain/index.ts b/lib/routes/langchain/index.ts index 7dc1bf1ac9..4fc0038c64 100644 --- a/lib/routes/langchain/index.ts +++ b/lib/routes/langchain/index.ts @@ -1,7 +1,8 @@ -import { Route, DataItem } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; export const route: Route = { path: '/blog', diff --git a/lib/routes/lanqiao/author.ts b/lib/routes/lanqiao/author.ts index b1388938c0..ae94ac53c5 100644 --- a/lib/routes/lanqiao/author.ts +++ b/lib/routes/lanqiao/author.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; + import utils from './utils'; -import MarkdownIt from 'markdown-it'; async function getUserName(uid) { // 获取用户信息 diff --git a/lib/routes/lanqiao/courses.ts b/lib/routes/lanqiao/courses.ts index f05b5d1871..d8b4998c17 100644 --- a/lib/routes/lanqiao/courses.ts +++ b/lib/routes/lanqiao/courses.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; + import utils from './utils'; -import MarkdownIt from 'markdown-it'; export const route: Route = { path: '/courses/:sort/:tag', diff --git a/lib/routes/lanqiao/questions.ts b/lib/routes/lanqiao/questions.ts index e74aa2b6a2..fef0c6ffa9 100644 --- a/lib/routes/lanqiao/questions.ts +++ b/lib/routes/lanqiao/questions.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import MarkdownIt from 'markdown-it'; export const route: Route = { path: '/questions/:id', diff --git a/lib/routes/lanqiao/utils.ts b/lib/routes/lanqiao/utils.ts index 13e34d3163..2d53043a6b 100644 --- a/lib/routes/lanqiao/utils.ts +++ b/lib/routes/lanqiao/utils.ts @@ -1,6 +1,7 @@ -import { art } from '@/utils/render'; import path from 'node:path'; +import { art } from '@/utils/render'; + const courseDesc = (picurl, desc) => art(path.join(__dirname, 'templates/courseDesc.art'), { picurl, diff --git a/lib/routes/laohu8/personal.ts b/lib/routes/laohu8/personal.ts index 6ec6af91bd..0e102c7b43 100644 --- a/lib/routes/laohu8/personal.ts +++ b/lib/routes/laohu8/personal.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootUrl = 'https://www.laohu8.com'; diff --git a/lib/routes/last-origin/news.ts b/lib/routes/last-origin/news.ts index 6dacb38c94..16ed495c1d 100644 --- a/lib/routes/last-origin/news.ts +++ b/lib/routes/last-origin/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/latepost/index.ts b/lib/routes/latepost/index.ts index 8d01440409..2ac594cf86 100644 --- a/lib/routes/latepost/index.ts +++ b/lib/routes/latepost/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; /** * Convert an array into a dictionary object. diff --git a/lib/routes/layoffs/index.ts b/lib/routes/layoffs/index.ts index b3abfa689a..ab3e531003 100644 --- a/lib/routes/layoffs/index.ts +++ b/lib/routes/layoffs/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const ROW_COUNT = 100; diff --git a/lib/routes/leagueoflegends/patch-notes.ts b/lib/routes/leagueoflegends/patch-notes.ts index 4a32a07dd8..b57d295f0a 100644 --- a/lib/routes/leagueoflegends/patch-notes.ts +++ b/lib/routes/leagueoflegends/patch-notes.ts @@ -1,6 +1,7 @@ -import { DataItem, Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/learnblockchain/posts.ts b/lib/routes/learnblockchain/posts.ts index 6498548fe3..1dc455d530 100644 --- a/lib/routes/learnblockchain/posts.ts +++ b/lib/routes/learnblockchain/posts.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseRelativeDate } from '@/utils/parse-date'; diff --git a/lib/routes/learnku/topic.ts b/lib/routes/learnku/topic.ts index 938fcb8831..0285d66844 100644 --- a/lib/routes/learnku/topic.ts +++ b/lib/routes/learnku/topic.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; -import path from 'node:path'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; export const route: Route = { path: '/:community/:category?', diff --git a/lib/routes/leetcode/articles.ts b/lib/routes/leetcode/articles.ts index 2c6708231d..81ea8ab78b 100644 --- a/lib/routes/leetcode/articles.ts +++ b/lib/routes/leetcode/articles.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import MarkdownIt from 'markdown-it'; + const md = MarkdownIt({ html: true, breaks: true, diff --git a/lib/routes/leetcode/dailyquestion-cn.ts b/lib/routes/leetcode/dailyquestion-cn.ts index 34335a1bda..40632c3b01 100644 --- a/lib/routes/leetcode/dailyquestion-cn.ts +++ b/lib/routes/leetcode/dailyquestion-cn.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; const host = 'https://leetcode.cn'; diff --git a/lib/routes/leetcode/dailyquestion-en.ts b/lib/routes/leetcode/dailyquestion-en.ts index f0eddacbc9..02a014bb46 100644 --- a/lib/routes/leetcode/dailyquestion-en.ts +++ b/lib/routes/leetcode/dailyquestion-en.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; const host = 'https://leetcode.com'; diff --git a/lib/routes/leetcode/dailyquestion-solution-cn.ts b/lib/routes/leetcode/dailyquestion-solution-cn.ts index 66de788e16..8e573b10ef 100644 --- a/lib/routes/leetcode/dailyquestion-solution-cn.ts +++ b/lib/routes/leetcode/dailyquestion-solution-cn.ts @@ -1,12 +1,15 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; + const md = MarkdownIt({ html: true, breaks: true, }); -import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; + export const route: Route = { path: '/dailyquestion/solution/cn', radar: [ diff --git a/lib/routes/leetcode/dailyquestion-solution-en.ts b/lib/routes/leetcode/dailyquestion-solution-en.ts index 3405ec6894..478af48ba3 100644 --- a/lib/routes/leetcode/dailyquestion-solution-en.ts +++ b/lib/routes/leetcode/dailyquestion-solution-en.ts @@ -1,13 +1,16 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; +import path from 'node:path'; + import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; + const md = MarkdownIt({ html: true, breaks: true, }); -import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; -import path from 'node:path'; export const route: Route = { path: '/dailyquestion/solution/en', radar: [ diff --git a/lib/routes/leiphone/index.ts b/lib/routes/leiphone/index.ts index 48502a42e5..07c0262f20 100644 --- a/lib/routes/leiphone/index.ts +++ b/lib/routes/leiphone/index.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/leiphone/newsflash.ts b/lib/routes/leiphone/newsflash.ts index 13be02c1dd..0b8467e391 100644 --- a/lib/routes/leiphone/newsflash.ts +++ b/lib/routes/leiphone/newsflash.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; + import utils from './utils'; // import { load } from 'cheerio'; diff --git a/lib/routes/leiphone/utils.ts b/lib/routes/leiphone/utils.ts index 7fdaed9dcf..f219995f02 100644 --- a/lib/routes/leiphone/utils.ts +++ b/lib/routes/leiphone/utils.ts @@ -1,7 +1,9 @@ +import * as url from 'node:url'; + import { load } from 'cheerio'; + import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import * as url from 'node:url'; const ProcessFeed = async (list, cache) => { const host = 'https://www.leiphone.com'; diff --git a/lib/routes/lemmy/index.ts b/lib/routes/lemmy/index.ts index b83b17f521..5fa000cbab 100644 --- a/lib/routes/lemmy/index.ts +++ b/lib/routes/lemmy/index.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; +import MarkdownIt from 'markdown-it'; + +import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import MarkdownIt from 'markdown-it'; + const md = MarkdownIt({ html: true }); -import { config } from '@/config'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; export const route: Route = { path: '/:community/:sort?', diff --git a/lib/routes/lenovo/drive.ts b/lib/routes/lenovo/drive.ts index bbeb45652f..cf2cb94fbd 100644 --- a/lib/routes/lenovo/drive.ts +++ b/lib/routes/lenovo/drive.ts @@ -1,9 +1,10 @@ -import { Route, Data, DataItem } from '@/types'; import path from 'node:path'; -import { art } from '@/utils/render'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Data, DataItem, Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; export const route: Route = { path: '/drive/:selName', diff --git a/lib/routes/lens/profile.ts b/lib/routes/lens/profile.ts index ec7cb42f47..ac77628d15 100644 --- a/lib/routes/lens/profile.ts +++ b/lib/routes/lens/profile.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/letterboxd/index.ts b/lib/routes/letterboxd/index.ts index 37fbc35843..a1575deccf 100644 --- a/lib/routes/letterboxd/index.ts +++ b/lib/routes/letterboxd/index.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; -import { namespace } from './namespace'; -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; import type { Context } from 'hono'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + +import { namespace } from './namespace'; + const baseUrl = `https://${namespace.url}`; export const route: Route = { diff --git a/lib/routes/lfsyd/home.ts b/lib/routes/lfsyd/home.ts index 0b0f221b5c..00035ed7e9 100644 --- a/lib/routes/lfsyd/home.ts +++ b/lib/routes/lfsyd/home.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { ProcessForm, ProcessFeed } from './utils'; + +import { ProcessFeed, ProcessForm } from './utils'; export const route: Route = { path: '/home', diff --git a/lib/routes/lfsyd/old-home.ts b/lib/routes/lfsyd/old-home.ts index b75e8e3c6f..d22f0caac1 100644 --- a/lib/routes/lfsyd/old-home.ts +++ b/lib/routes/lfsyd/old-home.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { ProcessFeed } from './utils'; export const route: Route = { diff --git a/lib/routes/lfsyd/tag.ts b/lib/routes/lfsyd/tag.ts index cc0834af17..05ba52a51d 100644 --- a/lib/routes/lfsyd/tag.ts +++ b/lib/routes/lfsyd/tag.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { ProcessForm, ProcessFeed } from './utils'; + +import { ProcessFeed, ProcessForm } from './utils'; export const route: Route = { path: '/tag/:tagId?', diff --git a/lib/routes/lfsyd/user.ts b/lib/routes/lfsyd/user.ts index 1e3b0dea02..16a335a0ef 100644 --- a/lib/routes/lfsyd/user.ts +++ b/lib/routes/lfsyd/user.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { ProcessForm, ProcessFeed } from './utils'; + +import { ProcessFeed, ProcessForm } from './utils'; export const route: Route = { path: '/user/:id?', diff --git a/lib/routes/lfsyd/utils.ts b/lib/routes/lfsyd/utils.ts index d2cf59ae94..0c98e0d153 100644 --- a/lib/routes/lfsyd/utils.ts +++ b/lib/routes/lfsyd/utils.ts @@ -1,7 +1,9 @@ +import path from 'node:path'; + import { load } from 'cheerio'; + import got from '@/utils/got'; import md5 from '@/utils/md5'; -import path from 'node:path'; import { art } from '@/utils/render'; const rootUrl = 'https://www.iyingdi.com'; @@ -97,4 +99,4 @@ const cleanHtml = (htmlString) => { return $.html(); }; -export { ProcessForm, ProcessFeed }; +export { ProcessFeed, ProcessForm }; diff --git a/lib/routes/lhratings/research.ts b/lib/routes/lhratings/research.ts index 6a298a4c6c..e36c26afba 100644 --- a/lib/routes/lhratings/research.ts +++ b/lib/routes/lhratings/research.ts @@ -1,12 +1,11 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + export const handler = async (ctx: Context): Promise => { const { type = '1' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '20', 10); diff --git a/lib/routes/lianxh/index.ts b/lib/routes/lianxh/index.ts index 2b5bf096f7..033fc28377 100644 --- a/lib/routes/lianxh/index.ts +++ b/lib/routes/lianxh/index.ts @@ -1,11 +1,12 @@ -import { DataItem, Route } from '@/types'; -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; import * as cheerio from 'cheerio'; import type { Context } from 'hono'; import markdownit from 'markdown-it'; +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + const md = markdownit({ html: true, breaks: true, diff --git a/lib/routes/lifeweek/channel.ts b/lib/routes/lifeweek/channel.ts index 62451ca4ea..347234d7d7 100644 --- a/lib/routes/lifeweek/channel.ts +++ b/lib/routes/lifeweek/channel.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; + import getRssItem from './utils'; const rootApiUrl = 'https://www.lifeweek.com.cn/api/userWebFollow/getFollowTagContentList?type=3&sort=2&tagId'; diff --git a/lib/routes/lifeweek/tag.ts b/lib/routes/lifeweek/tag.ts index 9506c37e51..30b08d4397 100644 --- a/lib/routes/lifeweek/tag.ts +++ b/lib/routes/lifeweek/tag.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; + import getRssItem from './utils'; + const rootApiUrl = 'https://www.lifeweek.com.cn/api/userWebFollow/getFollowTagContentList?type=4&sort=2&tagId'; const rootUrl = 'https://www.lifeweek.com.cn/articleList'; const articleRootUrl = 'https://www.lifeweek.com.cn/article'; diff --git a/lib/routes/lifeweek/utils.ts b/lib/routes/lifeweek/utils.ts index b8eb6793b3..66fe313ece 100644 --- a/lib/routes/lifeweek/utils.ts +++ b/lib/routes/lifeweek/utils.ts @@ -1,6 +1,7 @@ import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; + const articleApiRootUrl = 'https://www.lifeweek.com.cn/api/article'; async function getRssItem(item, articleLink) { diff --git a/lib/routes/lightnovel/light-novel.ts b/lib/routes/lightnovel/light-novel.ts index db1c2bfbac..ea154ee984 100644 --- a/lib/routes/lightnovel/light-novel.ts +++ b/lib/routes/lightnovel/light-novel.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; -import got from '@/utils/got'; import { load } from 'cheerio'; + import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/:keywords/:security_key?', diff --git a/lib/routes/likeshop/index.ts b/lib/routes/likeshop/index.ts index 71e13756b1..b287ec8bfb 100644 --- a/lib/routes/likeshop/index.ts +++ b/lib/routes/likeshop/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/line/publisher.ts b/lib/routes/line/publisher.ts index 9307d761d1..b3cb2ede02 100644 --- a/lib/routes/line/publisher.ts +++ b/lib/routes/line/publisher.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; -import { baseUrl, parseList, parseItems } from './utils'; + +import { baseUrl, parseItems, parseList } from './utils'; export const route: Route = { path: '/today/:edition/publisher/:id', diff --git a/lib/routes/line/today.ts b/lib/routes/line/today.ts index 0488b91c01..fe5635e0e7 100644 --- a/lib/routes/line/today.ts +++ b/lib/routes/line/today.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import { baseUrl as rootUrl, parseList, parseItems } from './utils'; + +import { baseUrl as rootUrl, parseItems, parseList } from './utils'; export const route: Route = { path: '/today/:edition?/:tab?', diff --git a/lib/routes/line/utils.ts b/lib/routes/line/utils.ts index 2d4fde721b..087ddc3655 100644 --- a/lib/routes/line/utils.ts +++ b/lib/routes/line/utils.ts @@ -1,8 +1,10 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import logger from '@/utils/logger'; + import cache from '@/utils/cache'; +import got from '@/utils/got'; +import logger from '@/utils/logger'; +import { parseDate } from '@/utils/parse-date'; + const baseUrl = 'https://today.line.me'; const parseList = (items) => @@ -53,4 +55,4 @@ const parseItems = (list) => ) ); -export { baseUrl, parseList, parseItems }; +export { baseUrl, parseItems, parseList }; diff --git a/lib/routes/lineageos/changes.ts b/lib/routes/lineageos/changes.ts index c841fb313e..df761d66cb 100644 --- a/lib/routes/lineageos/changes.ts +++ b/lib/routes/lineageos/changes.ts @@ -1,11 +1,10 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; - import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/link3/events.ts b/lib/routes/link3/events.ts index 00cfcf1bbf..9bb4ac501b 100644 --- a/lib/routes/link3/events.ts +++ b/lib/routes/link3/events.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/events', diff --git a/lib/routes/link3/profile.ts b/lib/routes/link3/profile.ts index 906c810bc7..ec9a692065 100644 --- a/lib/routes/link3/profile.ts +++ b/lib/routes/link3/profile.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/profile/:handle', diff --git a/lib/routes/linkedin/cn/index.ts b/lib/routes/linkedin/cn/index.ts index 15916d8c29..ef3e425550 100644 --- a/lib/routes/linkedin/cn/index.ts +++ b/lib/routes/linkedin/cn/index.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; -import { parseSearchHit, parseJobPosting } from './utils'; +import type { Route } from '@/types'; + +import { parseJobPosting, parseSearchHit } from './utils'; const siteUrl = 'https://www.linkedin.cn/incareer/jobs/search'; diff --git a/lib/routes/linkedin/cn/utils.ts b/lib/routes/linkedin/cn/utils.ts index db63db0217..8ed987c56b 100644 --- a/lib/routes/linkedin/cn/utils.ts +++ b/lib/routes/linkedin/cn/utils.ts @@ -1,8 +1,10 @@ -import cache from '@/utils/cache'; import crypto from 'node:crypto'; import path from 'node:path'; -import { art } from '@/utils/render'; + +import cache from '@/utils/cache'; import got from '@/utils/got'; +import { art } from '@/utils/render'; + import { parseAttr } from './renderer'; const apiUrl = 'https://www.linkedin.cn/karpos/api/graphql'; @@ -117,4 +119,4 @@ const parseJobPosting = (ctx, jobPosting) => { }); }; -export { parseSearchHit, parseJobPosting }; +export { parseJobPosting, parseSearchHit }; diff --git a/lib/routes/linkedin/jobs.ts b/lib/routes/linkedin/jobs.ts index 0f8b79fa50..f733cc8abe 100644 --- a/lib/routes/linkedin/jobs.ts +++ b/lib/routes/linkedin/jobs.ts @@ -1,6 +1,8 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; + import { EXP_LEVELS, EXP_LEVELS_QUERY_KEY, JOB_TYPES, JOB_TYPES_QUERY_KEY, KEYWORDS_QUERY_KEY, parseJobSearch, parseParamsToSearchParams, parseParamsToString, parseRouteParam } from './utils'; const BASE_URL = 'https://www.linkedin.com/'; diff --git a/lib/routes/linkedin/posts.ts b/lib/routes/linkedin/posts.ts index 2f324fd192..def1e88e56 100644 --- a/lib/routes/linkedin/posts.ts +++ b/lib/routes/linkedin/posts.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import puppeteer from '@/utils/puppeteer'; import { load } from 'cheerio'; -import { parseCompanyName, parseCompanyPosts, BASE_URL } from './utils'; + +import type { Route } from '@/types'; import logger from '@/utils/logger'; +import puppeteer from '@/utils/puppeteer'; + +import { BASE_URL, parseCompanyName, parseCompanyPosts } from './utils'; export const route: Route = { path: '/company/:company_id/posts', diff --git a/lib/routes/linkedin/utils.ts b/lib/routes/linkedin/utils.ts index 33a8bf7ed8..9f698823c0 100644 --- a/lib/routes/linkedin/utils.ts +++ b/lib/routes/linkedin/utils.ts @@ -1,7 +1,8 @@ import { load } from 'cheerio'; -import { Job } from './models'; import dayjs from 'dayjs'; +import { Job } from './models'; + /** * Constants */ @@ -184,17 +185,17 @@ function parseRelativeShorthandDate(shorthand) { } export { - parseCompanyPosts, - parseCompanyName, - parseParamsToSearchParams, - parseParamsToString, - parseJobDetail, - parseJobSearch, - parseRouteParam, BASE_URL, - JOB_TYPES, - JOB_TYPES_QUERY_KEY, EXP_LEVELS, EXP_LEVELS_QUERY_KEY, + JOB_TYPES, + JOB_TYPES_QUERY_KEY, KEYWORDS_QUERY_KEY, + parseCompanyName, + parseCompanyPosts, + parseJobDetail, + parseJobSearch, + parseParamsToSearchParams, + parseParamsToString, + parseRouteParam, }; diff --git a/lib/routes/linkresearcher/index.ts b/lib/routes/linkresearcher/index.ts index a08136c346..7e7be473d7 100644 --- a/lib/routes/linkresearcher/index.ts +++ b/lib/routes/linkresearcher/index.ts @@ -1,13 +1,16 @@ -import { ViewType, type Data, type DataItem, type Route } from '@/types'; +import crypto from 'node:crypto'; +import path from 'node:path'; + +import type { Context } from 'hono'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; -import crypto from 'node:crypto'; -import type { Context } from 'hono'; -import type { DetailResponse, SearchResultItem } from './types'; -import cache from '@/utils/cache'; import { art } from '@/utils/render'; -import path from 'node:path'; + +import type { DetailResponse, SearchResultItem } from './types'; const templatePath = path.join(__dirname, 'templates/bilingual.art'); diff --git a/lib/routes/linovelib/novel.ts b/lib/routes/linovelib/novel.ts index e335917f2a..503b82f1aa 100644 --- a/lib/routes/linovelib/novel.ts +++ b/lib/routes/linovelib/novel.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/novel/:id', categories: ['reading'], diff --git a/lib/routes/linovelib/volume.ts b/lib/routes/linovelib/volume.ts index be962f55eb..3134b153ed 100644 --- a/lib/routes/linovelib/volume.ts +++ b/lib/routes/linovelib/volume.ts @@ -1,7 +1,8 @@ -import type { Route, Data } from '@/types'; -import type { Context } from 'hono'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { Data, Route } from '@/types'; +import got from '@/utils/got'; export const route: Route = { path: '/volume/:id', diff --git a/lib/routes/liquipedia/cs-matches.ts b/lib/routes/liquipedia/cs-matches.ts index 7b57b5b10d..0c0100725d 100644 --- a/lib/routes/liquipedia/cs-matches.ts +++ b/lib/routes/liquipedia/cs-matches.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + export const route: Route = { path: '/counterstrike/matches/:team', radar: [ diff --git a/lib/routes/liquipedia/dota2-matches.ts b/lib/routes/liquipedia/dota2-matches.ts index 1867165b5b..90b7cc0692 100644 --- a/lib/routes/liquipedia/dota2-matches.ts +++ b/lib/routes/liquipedia/dota2-matches.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/literotica/category.ts b/lib/routes/literotica/category.ts index 7831b4a758..dc4ade89ee 100644 --- a/lib/routes/literotica/category.ts +++ b/lib/routes/literotica/category.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/literotica/new.ts b/lib/routes/literotica/new.ts index d3d58f625c..fd1c10d558 100644 --- a/lib/routes/literotica/new.ts +++ b/lib/routes/literotica/new.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/liulinblog/index.ts b/lib/routes/liulinblog/index.ts index 5556aa97ab..5ac49c3971 100644 --- a/lib/routes/liulinblog/index.ts +++ b/lib/routes/liulinblog/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/liulinblog/itnews.ts b/lib/routes/liulinblog/itnews.ts index 155ad9060f..649e4adde6 100644 --- a/lib/routes/liulinblog/itnews.ts +++ b/lib/routes/liulinblog/itnews.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + export const route: Route = { path: '/itnews/:channel', name: 'Unknown', diff --git a/lib/routes/liveuamap/index.ts b/lib/routes/liveuamap/index.ts index cfa1ea48bd..b944e55ed9 100644 --- a/lib/routes/liveuamap/index.ts +++ b/lib/routes/liveuamap/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { isValidHost } from '@/utils/valid-host'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { isValidHost } from '@/utils/valid-host'; export const route: Route = { path: '/:region?', diff --git a/lib/routes/lkong/forum.ts b/lib/routes/lkong/forum.ts index df31bbe155..d79f313ce7 100644 --- a/lib/routes/lkong/forum.ts +++ b/lib/routes/lkong/forum.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; import { viewForum, viewThread } from './query'; diff --git a/lib/routes/lkong/query.ts b/lib/routes/lkong/query.ts index 6435583ac8..af0c0cf395 100644 --- a/lib/routes/lkong/query.ts +++ b/lib/routes/lkong/query.ts @@ -80,4 +80,4 @@ const countReplies = (id) => ({ }, }); -export { viewForum, viewThread, countReplies }; +export { countReplies, viewForum, viewThread }; diff --git a/lib/routes/lkong/thread.ts b/lib/routes/lkong/thread.ts index b6ac571723..ff458c64a2 100644 --- a/lib/routes/lkong/thread.ts +++ b/lib/routes/lkong/thread.ts @@ -1,11 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { viewThread, countReplies } from './query'; +import { countReplies, viewThread } from './query'; export const route: Route = { path: '/thread/:id', diff --git a/lib/routes/lmu/jobs.ts b/lib/routes/lmu/jobs.ts index 33c38f5982..5d84034076 100644 --- a/lib/routes/lmu/jobs.ts +++ b/lib/routes/lmu/jobs.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const apiUrl = 'https://jobs.b-ite.com/api/v1/postings/search'; diff --git a/lib/routes/lofter/collection.ts b/lib/routes/lofter/collection.ts index 7ec2784d80..adf90b2e02 100644 --- a/lib/routes/lofter/collection.ts +++ b/lib/routes/lofter/collection.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import cache from '@/utils/cache'; import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/lofter/tag.ts b/lib/routes/lofter/tag.ts index 0d6fba7aa7..d6ba124614 100644 --- a/lib/routes/lofter/tag.ts +++ b/lib/routes/lofter/tag.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import { config } from '@/config'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; import { JSDOM } from 'jsdom'; + +import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/tag/:name?/:type?', diff --git a/lib/routes/lofter/user.ts b/lib/routes/lofter/user.ts index c8547dd8e4..1112689817 100644 --- a/lib/routes/lofter/user.ts +++ b/lib/routes/lofter/user.ts @@ -1,5 +1,6 @@ import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { isValidHost } from '@/utils/valid-host'; diff --git a/lib/routes/logclub/index.ts b/lib/routes/logclub/index.ts index a3b1147174..9636f287a0 100644 --- a/lib/routes/logclub/index.ts +++ b/lib/routes/logclub/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:category{.+}?', diff --git a/lib/routes/logclub/report.ts b/lib/routes/logclub/report.ts index 7ee2b49256..62e1a54f20 100644 --- a/lib/routes/logclub/report.ts +++ b/lib/routes/logclub/report.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: ['/lc_report/:id?', '/report/:id?'], diff --git a/lib/routes/logonews/index.ts b/lib/routes/logonews/index.ts index 0302e81b53..1aeafe518e 100644 --- a/lib/routes/logonews/index.ts +++ b/lib/routes/logonews/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: ['/work/tags/:tag', '/tag/:tag', '*'], diff --git a/lib/routes/logrocket/index.ts b/lib/routes/logrocket/index.ts index 6c90e506cb..de91a6b2a7 100644 --- a/lib/routes/logrocket/index.ts +++ b/lib/routes/logrocket/index.ts @@ -1,8 +1,9 @@ -import { parseDate } from '@/utils/parse-date'; -import ofetch from '@/utils/ofetch'; // 统一使用的请求库 import { load } from 'cheerio'; // 类似 jQuery 的 API HTML 解析器 -import { Route } from '@/types'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; // 统一使用的请求库 +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/:type', diff --git a/lib/routes/loltw/news.ts b/lib/routes/loltw/news.ts index 3827a7fe26..af261ce9f7 100644 --- a/lib/routes/loltw/news.ts +++ b/lib/routes/loltw/news.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/news/:category?', diff --git a/lib/routes/loongarch/post.ts b/lib/routes/loongarch/post.ts index a0e1ad32ab..c1febec73e 100644 --- a/lib/routes/loongarch/post.ts +++ b/lib/routes/loongarch/post.ts @@ -1,6 +1,6 @@ -import { parseDate } from '@/utils/parse-date'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import { Route } from '@/types'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/post/:type?', diff --git a/lib/routes/lorientlejour/index.ts b/lib/routes/lorientlejour/index.ts index 4a1a5d4c7b..faee817602 100644 --- a/lib/routes/lorientlejour/index.ts +++ b/lib/routes/lorientlejour/index.ts @@ -1,13 +1,15 @@ -import { Route } from '@/types'; +import path from 'node:path'; + +import { load } from 'cheerio'; +import { FetchError } from 'ofetch'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { config } from '@/config'; -import { FetchError } from 'ofetch'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; -import path from 'node:path'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; const key = '3d5_f6A(S$G_FD=2S(Dr6%7BW_h37@rE'; diff --git a/lib/routes/lovelive-anime/news.ts b/lib/routes/lovelive-anime/news.ts index d8fbed3951..7e85ac6a4b 100644 --- a/lib/routes/lovelive-anime/news.ts +++ b/lib/routes/lovelive-anime/news.ts @@ -1,13 +1,15 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import path from 'node:path'; -import { art } from '@/utils/render'; import ofetch from '@/utils/ofetch'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; + const renderDescription = (desc) => art(path.join(__dirname, 'templates/description.art'), desc); export const route: Route = { diff --git a/lib/routes/lrepacks/index.ts b/lib/routes/lrepacks/index.ts index 2d54432c90..220c9ebf76 100644 --- a/lib/routes/lrepacks/index.ts +++ b/lib/routes/lrepacks/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const handler = async (ctx) => { const { category = '' } = ctx.req.param(); diff --git a/lib/routes/lsnu/jiaowc/tzgg.ts b/lib/routes/lsnu/jiaowc/tzgg.ts index 55c72b6f15..d8f6536501 100644 --- a/lib/routes/lsnu/jiaowc/tzgg.ts +++ b/lib/routes/lsnu/jiaowc/tzgg.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/jiaowc/tzgg/:category?', diff --git a/lib/routes/ltaaa/article.ts b/lib/routes/ltaaa/article.ts index 54100997b9..3b7687fb2b 100644 --- a/lib/routes/ltaaa/article.ts +++ b/lib/routes/ltaaa/article.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/luma/index.ts b/lib/routes/luma/index.ts index 795e34c981..0de68ca9ac 100644 --- a/lib/routes/luma/index.ts +++ b/lib/routes/luma/index.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/:url', diff --git a/lib/routes/luogu/contest.ts b/lib/routes/luogu/contest.ts index a50f398015..50d0bbbaa6 100644 --- a/lib/routes/luogu/contest.ts +++ b/lib/routes/luogu/contest.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import MarkdownIt from 'markdown-it'; +import pMap from 'p-map'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import MarkdownIt from 'markdown-it'; + const md = MarkdownIt(); -import pMap from 'p-map'; const baseUrl = 'https://www.luogu.com.cn'; diff --git a/lib/routes/luogu/daily.ts b/lib/routes/luogu/daily.ts index 09be4c19bc..552f76f9bc 100644 --- a/lib/routes/luogu/daily.ts +++ b/lib/routes/luogu/daily.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/luogu/user-article.ts b/lib/routes/luogu/user-article.ts index 401d59b034..733716ab78 100644 --- a/lib/routes/luogu/user-article.ts +++ b/lib/routes/luogu/user-article.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import * as cheerio from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import * as cheerio from 'cheerio'; -import { getUserInfoFromUID } from './utils'; import { parseDate } from '@/utils/parse-date'; +import { getUserInfoFromUID } from './utils'; + export const route: Route = { path: '/user/article/:uid', categories: ['programming'], diff --git a/lib/routes/luogu/user-blog.ts b/lib/routes/luogu/user-blog.ts index 51538cb453..6330cf4db8 100644 --- a/lib/routes/luogu/user-blog.ts +++ b/lib/routes/luogu/user-blog.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; export const route: Route = { path: '/user/blog/:name', diff --git a/lib/routes/luogu/user-feed.ts b/lib/routes/luogu/user-feed.ts index bde1cd4627..6c139e4623 100644 --- a/lib/routes/luogu/user-feed.ts +++ b/lib/routes/luogu/user-feed.ts @@ -1,8 +1,11 @@ -import { Route } from '@/types'; +import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import MarkdownIt from 'markdown-it'; + import { getUserInfoFromUID } from './utils'; + const md = MarkdownIt(); export const route: Route = { diff --git a/lib/routes/luolei/index.ts b/lib/routes/luolei/index.ts index 21ced6a7fa..91ffaf3d30 100644 --- a/lib/routes/luolei/index.ts +++ b/lib/routes/luolei/index.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { CheerioAPI} from 'cheerio'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { CheerioAPI, load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const unblurImages = ($: CheerioAPI) => { $('img[data-original-src]').each((_, el) => { diff --git a/lib/routes/luxiangdong/archive.ts b/lib/routes/luxiangdong/archive.ts index 0b24b1c59a..5fa54dc019 100644 --- a/lib/routes/luxiangdong/archive.ts +++ b/lib/routes/luxiangdong/archive.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/lvv2/news.ts b/lib/routes/lvv2/news.ts index d482697132..f2c2eb4ca9 100644 --- a/lib/routes/lvv2/news.ts +++ b/lib/routes/lvv2/news.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; const rootUrl = 'https://lvv2.com'; diff --git a/lib/routes/lvv2/top.ts b/lib/routes/lvv2/top.ts index 41d791e6bb..b1f12b0730 100644 --- a/lib/routes/lvv2/top.ts +++ b/lib/routes/lvv2/top.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; const rootUrl = 'https://lvv2.com'; diff --git a/lib/routes/lxixsxa/discography.ts b/lib/routes/lxixsxa/discography.ts index fab9f7d3c5..fdba89bb9f 100644 --- a/lib/routes/lxixsxa/discography.ts +++ b/lib/routes/lxixsxa/discography.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { parseJSONP } from './jsonp-helper'; import { art } from '@/utils/render'; -import path from 'node:path'; + +import { parseJSONP } from './jsonp-helper'; export const route: Route = { path: '/disco', diff --git a/lib/routes/lxixsxa/information.ts b/lib/routes/lxixsxa/information.ts index 4967a76583..761a7fe22c 100644 --- a/lib/routes/lxixsxa/information.ts +++ b/lib/routes/lxixsxa/information.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { parseJSONP } from './jsonp-helper'; import { art } from '@/utils/render'; -import path from 'node:path'; + +import { parseJSONP } from './jsonp-helper'; export const route: Route = { path: '/info', diff --git a/lib/routes/m-78/news.ts b/lib/routes/m-78/news.ts index 5eed7b6b84..7074d5c8ce 100644 --- a/lib/routes/m-78/news.ts +++ b/lib/routes/m-78/news.ts @@ -1,10 +1,12 @@ +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; import { type Data, type Route, ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; -import type { Context } from 'hono'; -import type { Post } from './types'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; + +import type { Post } from './types'; export const route: Route = { name: 'ニュース', diff --git a/lib/routes/m4/index.ts b/lib/routes/m4/index.ts index f10b132ab1..434245e4ba 100644 --- a/lib/routes/m4/index.ts +++ b/lib/routes/m4/index.ts @@ -1,14 +1,15 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { isValidHost } from '@/utils/valid-host'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; +import timezone from '@/utils/timezone'; +import { isValidHost } from '@/utils/valid-host'; export const route: Route = { path: '/:id?/:category{.+}?', diff --git a/lib/routes/maccms/index.ts b/lib/routes/maccms/index.ts index 37ea019245..ddc794a041 100644 --- a/lib/routes/maccms/index.ts +++ b/lib/routes/maccms/index.ts @@ -1,7 +1,8 @@ -import { Result, Vod } from '@/routes/maccms/type'; -import { DataItem, Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import path from 'node:path'; + +import type { Result, Vod } from '@/routes/maccms/type'; +import type { DataItem, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/macfilos/blog.ts b/lib/routes/macfilos/blog.ts index f79c4e5306..524bb2dc7a 100644 --- a/lib/routes/macfilos/blog.ts +++ b/lib/routes/macfilos/blog.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/macmenubar/recently.ts b/lib/routes/macmenubar/recently.ts index 685afdf83c..ca71e5f3ff 100644 --- a/lib/routes/macmenubar/recently.ts +++ b/lib/routes/macmenubar/recently.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; async function getCategoryId(categories) { diff --git a/lib/routes/macupdate/app.ts b/lib/routes/macupdate/app.ts index c7da81eecb..275e176592 100644 --- a/lib/routes/macupdate/app.ts +++ b/lib/routes/macupdate/app.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/magazinelib/latest-magazine.ts b/lib/routes/magazinelib/latest-magazine.ts index 7f50e5e84b..39ddb9d3ac 100644 --- a/lib/routes/magazinelib/latest-magazine.ts +++ b/lib/routes/magazinelib/latest-magazine.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + const host = 'https://magazinelib.com'; export const route: Route = { path: '/latest-magazine/:query?', diff --git a/lib/routes/magnumphotos/magazine.ts b/lib/routes/magnumphotos/magazine.ts index a0ae09f8ee..375785a2b6 100644 --- a/lib/routes/magnumphotos/magazine.ts +++ b/lib/routes/magnumphotos/magazine.ts @@ -1,8 +1,11 @@ -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; -import parser from '@/utils/rss-parser'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import parser from '@/utils/rss-parser'; + const host = 'https://www.magnumphotos.com'; export const route: Route = { path: '/magazine', diff --git a/lib/routes/mail/imap.ts b/lib/routes/mail/imap.ts index 4f476198bb..5ba9e0159d 100644 --- a/lib/routes/mail/imap.ts +++ b/lib/routes/mail/imap.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { ImapFlow } from 'imapflow'; -import { config } from '@/config'; import { simpleParser } from 'mailparser'; + +import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import logger from '@/utils/logger'; import { parseDate } from '@/utils/parse-date'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; export const route: Route = { path: '/imap/:email/:folder{.+}?', diff --git a/lib/routes/makerworld/contest.ts b/lib/routes/makerworld/contest.ts index 60f4770471..5633f9cee8 100644 --- a/lib/routes/makerworld/contest.ts +++ b/lib/routes/makerworld/contest.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import { baseUrl, getNextBuildId } from './utils'; -import { parseDate } from '@/utils/parse-date'; import { config } from '@/config'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + +import { baseUrl, getNextBuildId } from './utils'; export const route: Route = { path: '/contests', diff --git a/lib/routes/makerworld/trending.ts b/lib/routes/makerworld/trending.ts index cd01d26567..8ce6364c55 100644 --- a/lib/routes/makerworld/trending.ts +++ b/lib/routes/makerworld/trending.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import { baseUrl, getNextBuildId } from './utils'; -import { parseDate } from '@/utils/parse-date'; import { config } from '@/config'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + +import { baseUrl, getNextBuildId } from './utils'; export const route: Route = { path: '/trending', diff --git a/lib/routes/makerworld/user-upload.ts b/lib/routes/makerworld/user-upload.ts index 881193a33e..2bb0f09a91 100644 --- a/lib/routes/makerworld/user-upload.ts +++ b/lib/routes/makerworld/user-upload.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import { baseUrl, getNextBuildId } from './utils'; -import { parseDate } from '@/utils/parse-date'; import { config } from '@/config'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + +import { baseUrl, getNextBuildId } from './utils'; export const route: Route = { path: '/user/:handle/upload', diff --git a/lib/routes/makerworld/utils.ts b/lib/routes/makerworld/utils.ts index a9b02819a4..4930e63812 100644 --- a/lib/routes/makerworld/utils.ts +++ b/lib/routes/makerworld/utils.ts @@ -1,7 +1,8 @@ -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + import { config } from '@/config'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; export const baseUrl = 'https://makerworld.com'; diff --git a/lib/routes/malaysiakini/index.ts b/lib/routes/malaysiakini/index.ts index 666de39f04..e70ed97701 100644 --- a/lib/routes/malaysiakini/index.ts +++ b/lib/routes/malaysiakini/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { FetchError } from 'ofetch'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import parser from '@/utils/rss-parser'; -import { config } from '@/config'; -import { FetchError } from 'ofetch'; export const route: Route = { path: '/:lang/:category?', diff --git a/lib/routes/mangadex/_access.ts b/lib/routes/mangadex/_access.ts index f57f8b21e9..bcdf050d50 100644 --- a/lib/routes/mangadex/_access.ts +++ b/lib/routes/mangadex/_access.ts @@ -1,10 +1,11 @@ -import got from '@/utils/got'; -import cache from '@/utils/cache'; +import { FetchError } from 'ofetch'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import constants from './_constants'; -import { FetchError } from 'ofetch'; /** * Retrieves an access token. diff --git a/lib/routes/mangadex/_feed.ts b/lib/routes/mangadex/_feed.ts index b0b09705b0..9e8d72940f 100644 --- a/lib/routes/mangadex/_feed.ts +++ b/lib/routes/mangadex/_feed.ts @@ -1,10 +1,11 @@ -import got from '@/utils/got'; import { config } from '@/config'; import cache from '@/utils/cache'; +import got from '@/utils/got'; import md5 from '@/utils/md5'; -import { getFilteredLanguages } from './_profile'; -import { toQueryString, firstMatch } from './_utils'; + import constants from './_constants'; +import { getFilteredLanguages } from './_profile'; +import { firstMatch, toQueryString } from './_utils'; /** * Retrieves the title, description, and cover of a manga. @@ -181,4 +182,4 @@ const getMangaDetails = async (id: string, needCover: boolean = true, lang?: str return { ...meta, chapters }; }; -export { getMangaMeta, getMangaChapters, getMangaDetails }; +export { getMangaChapters, getMangaDetails, getMangaMeta }; diff --git a/lib/routes/mangadex/_profile.ts b/lib/routes/mangadex/_profile.ts index 975c3d18fa..0f6a0e439d 100644 --- a/lib/routes/mangadex/_profile.ts +++ b/lib/routes/mangadex/_profile.ts @@ -1,9 +1,9 @@ -import got from '@/utils/got'; import { config } from '@/config'; -import cache from '@/utils/cache'; import ConfigNotFoundError from '@/errors/types/config-not-found'; -import getToken from './_access'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import getToken from './_access'; import constants from './_constants'; const getSetting = async () => { diff --git a/lib/routes/mangadex/index.ts b/lib/routes/mangadex/index.ts index 5f880b7619..787d22b6f2 100644 --- a/lib/routes/mangadex/index.ts +++ b/lib/routes/mangadex/index.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { getMangaDetails } from './_feed'; export const route: Route = { diff --git a/lib/routes/mangadex/mdlist/feed.ts b/lib/routes/mangadex/mdlist/feed.ts index 69e1ac96a2..7d157deeb8 100644 --- a/lib/routes/mangadex/mdlist/feed.ts +++ b/lib/routes/mangadex/mdlist/feed.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import getToken from '../_access'; -import cache from '@/utils/cache'; import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + +import getToken from '../_access'; import constants from '../_constants'; -import { getFilteredLanguages } from '../_profile'; import { getMangaMetaByIds } from '../_feed'; +import { getFilteredLanguages } from '../_profile'; import { toQueryString } from '../_utils'; const DEFAULT_LIMIT = 25; diff --git a/lib/routes/mangadex/user/feed.ts b/lib/routes/mangadex/user/feed.ts index 0e88607af6..749312b0ce 100644 --- a/lib/routes/mangadex/user/feed.ts +++ b/lib/routes/mangadex/user/feed.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import getToken from '../_access'; -import cache from '@/utils/cache'; import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + +import getToken from '../_access'; import constants from '../_constants'; import { getMangaMetaByIds } from '../_feed'; import { getFilteredLanguages } from '../_profile'; diff --git a/lib/routes/mangadex/user/follows.ts b/lib/routes/mangadex/user/follows.ts index 6f27231496..e049deab78 100644 --- a/lib/routes/mangadex/user/follows.ts +++ b/lib/routes/mangadex/user/follows.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import getToken from '../_access'; -import cache from '@/utils/cache'; import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + +import getToken from '../_access'; import { getMangaChapters, getMangaMetaByIds } from '../_feed'; type FollowType = 'reading' | 'plan-to-read' | 'completed' | 'on-hold' | 're-reading' | 'dropped'; diff --git a/lib/routes/manhuagui/comic.ts b/lib/routes/manhuagui/comic.ts index ee42411698..55e99631f6 100644 --- a/lib/routes/manhuagui/comic.ts +++ b/lib/routes/manhuagui/comic.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; -import got from '@/utils/got'; import LZString from 'lz-string'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; let baseUrl = ''; diff --git a/lib/routes/manhuagui/subscribe.ts b/lib/routes/manhuagui/subscribe.ts index 79399b7d1f..efce8d8a9c 100644 --- a/lib/routes/manhuagui/subscribe.ts +++ b/lib/routes/manhuagui/subscribe.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { parseRelativeDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseRelativeDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + const web_url = 'https://www.manhuagui.com/user/book/shelf/1'; export const route: Route = { diff --git a/lib/routes/manus/blog.ts b/lib/routes/manus/blog.ts index 780e8e9683..d34eea3511 100644 --- a/lib/routes/manus/blog.ts +++ b/lib/routes/manus/blog.ts @@ -1,7 +1,9 @@ -import { Route, DataItem, Data, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Data, DataItem, Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; export const route: Route = { path: '/blog', diff --git a/lib/routes/manus/namespace.ts b/lib/routes/manus/namespace.ts index 76b0278460..23788399e2 100644 --- a/lib/routes/manus/namespace.ts +++ b/lib/routes/manus/namespace.ts @@ -1,4 +1,4 @@ -import { Namespace } from '@/types'; +import type { Namespace } from '@/types'; export const namespace: Namespace = { name: 'Manus', diff --git a/lib/routes/manyvids/video.ts b/lib/routes/manyvids/video.ts index d442e42161..810f248089 100644 --- a/lib/routes/manyvids/video.ts +++ b/lib/routes/manyvids/video.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; -import { UserProfile, Videos } from './types'; -import { art } from '@/utils/render'; import path from 'node:path'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { art } from '@/utils/render'; + +import type { UserProfile, Videos } from './types'; + export const route: Route = { path: '/profile/vids/:uid', radar: [ diff --git a/lib/routes/mashiro/index.ts b/lib/routes/mashiro/index.ts index 0c55ef8326..1a92e46866 100644 --- a/lib/routes/mashiro/index.ts +++ b/lib/routes/mashiro/index.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; -import { namespace } from './namespace'; -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { namespace } from './namespace'; + const baseUrl = `https://${namespace.url}`; export const route: Route = { diff --git a/lib/routes/mastodon/account-id.ts b/lib/routes/mastodon/account-id.ts index 39c5ce0dea..cbeb949bde 100644 --- a/lib/routes/mastodon/account-id.ts +++ b/lib/routes/mastodon/account-id.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; -import utils from './utils'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; + +import utils from './utils'; export const route: Route = { path: '/account_id/:site/:account_id/statuses/:only_media?', diff --git a/lib/routes/mastodon/acct.ts b/lib/routes/mastodon/acct.ts index be46c6cfcf..1edd69730a 100644 --- a/lib/routes/mastodon/acct.ts +++ b/lib/routes/mastodon/acct.ts @@ -1,4 +1,6 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/mastodon/tag.ts b/lib/routes/mastodon/tag.ts index 35d5a92aa1..f1164d197a 100644 --- a/lib/routes/mastodon/tag.ts +++ b/lib/routes/mastodon/tag.ts @@ -1,10 +1,12 @@ -import { Route, ViewType, Data } from '@/types'; +import type { Context } from 'hono'; -import got from '@/utils/got'; -import { Context } from 'hono'; -import utils from './utils'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Data, Route } from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; + +import utils from './utils'; export const route: Route = { path: '/tag/:site/:hashtag/:only_media?', diff --git a/lib/routes/mastodon/timeline-local.ts b/lib/routes/mastodon/timeline-local.ts index e671bca21d..9dee87c6e4 100644 --- a/lib/routes/mastodon/timeline-local.ts +++ b/lib/routes/mastodon/timeline-local.ts @@ -1,8 +1,10 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; -import utils from './utils'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; + +import utils from './utils'; export const route: Route = { path: '/timeline/:site/:only_media?', diff --git a/lib/routes/mastodon/timeline-remote.ts b/lib/routes/mastodon/timeline-remote.ts index 756b3382a9..5c8d3d4a48 100644 --- a/lib/routes/mastodon/timeline-remote.ts +++ b/lib/routes/mastodon/timeline-remote.ts @@ -1,8 +1,10 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; -import utils from './utils'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; + +import utils from './utils'; export const route: Route = { path: '/remote/:site/:only_media?', diff --git a/lib/routes/mastodon/utils.ts b/lib/routes/mastodon/utils.ts index d2beb9e334..0bebaab81c 100644 --- a/lib/routes/mastodon/utils.ts +++ b/lib/routes/mastodon/utils.ts @@ -1,8 +1,8 @@ +import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; const allowSiteList = ['mastodon.social', 'pawoo.net', 'fosstodon.org', config.mastodon.apiHost].filter(Boolean); diff --git a/lib/routes/mathpix/blog.ts b/lib/routes/mathpix/blog.ts index dffa0e5c9b..6ba391dc88 100644 --- a/lib/routes/mathpix/blog.ts +++ b/lib/routes/mathpix/blog.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/matters/author.ts b/lib/routes/matters/author.ts index 0526f437bb..60b73d9246 100644 --- a/lib/routes/matters/author.ts +++ b/lib/routes/matters/author.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; + import { baseUrl, gqlEndpoint, parseItem } from './utils'; const handler = async (ctx) => { diff --git a/lib/routes/matters/latest.ts b/lib/routes/matters/latest.ts index 86fb4260f4..3bfd12d702 100644 --- a/lib/routes/matters/latest.ts +++ b/lib/routes/matters/latest.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; + import { baseUrl, gqlEndpoint, parseItem } from './utils'; const handler = async (ctx) => { diff --git a/lib/routes/matters/tags.ts b/lib/routes/matters/tags.ts index 73d96f1146..1ecc26c7e3 100644 --- a/lib/routes/matters/tags.ts +++ b/lib/routes/matters/tags.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import * as cheerio from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + import { baseUrl, gqlEndpoint, parseItem } from './utils'; interface Tag { diff --git a/lib/routes/mckinsey/cn/index.ts b/lib/routes/mckinsey/cn/index.ts index b858818ccf..faaab5f5b5 100644 --- a/lib/routes/mckinsey/cn/index.ts +++ b/lib/routes/mckinsey/cn/index.ts @@ -1,9 +1,12 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; + import { categories } from './category-map'; -import { load } from 'cheerio'; -import cache from '@/utils/cache'; const baseUrl = 'https://www.mckinsey.com.cn'; diff --git a/lib/routes/mcmod/index.ts b/lib/routes/mcmod/index.ts index 2e1632f87e..f7ab6af52b 100644 --- a/lib/routes/mcmod/index.ts +++ b/lib/routes/mcmod/index.ts @@ -1,11 +1,13 @@ -import { DataItem, Route } from '@/types'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import ofetch from '@/utils/ofetch'; import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; -import timezone from '@/utils/timezone'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; const render = (mod) => art(path.join(__dirname, 'templates/mod.art'), { mod }); diff --git a/lib/routes/mdpi/journal.ts b/lib/routes/mdpi/journal.ts index 8845b63d84..ff92cbab57 100644 --- a/lib/routes/mdpi/journal.ts +++ b/lib/routes/mdpi/journal.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; import path from 'node:path'; + +import { load } from 'cheerio'; +import { CookieJar } from 'tough-cookie'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { art } from '@/utils/render'; -import { CookieJar } from 'tough-cookie'; const cookieJar = new CookieJar(); export const route: Route = { diff --git a/lib/routes/medieval-china/post.ts b/lib/routes/medieval-china/post.ts index 63b036ad89..c7ab792c85 100644 --- a/lib/routes/medieval-china/post.ts +++ b/lib/routes/medieval-china/post.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/medium/feed.ts b/lib/routes/medium/feed.ts index c1ab790f13..c289a75e66 100644 --- a/lib/routes/medium/feed.ts +++ b/lib/routes/medium/feed.ts @@ -1,7 +1,8 @@ -import { Route, ViewType } from '@/types'; -import parser from '@/utils/rss-parser'; -import { parseDate } from '@/utils/parse-date'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import { parseDate } from '@/utils/parse-date'; +import parser from '@/utils/rss-parser'; export const route: Route = { path: '/feed/:user', diff --git a/lib/routes/medium/following.ts b/lib/routes/medium/following.ts index 59bade5825..1664a2fe01 100644 --- a/lib/routes/medium/following.ts +++ b/lib/routes/medium/following.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; import { config } from '@/config'; - -import parseArticle from './parse-article.js'; -import { getFollowingFeedQuery } from './graphql.js'; import ConfigNotFoundError from '@/errors/types/config-not-found.js'; +import type { Route } from '@/types'; + +import { getFollowingFeedQuery } from './graphql.js'; +import parseArticle from './parse-article.js'; export const route: Route = { path: '/following/:user', diff --git a/lib/routes/medium/for-you.ts b/lib/routes/medium/for-you.ts index ddb8b4140c..0326e51d37 100644 --- a/lib/routes/medium/for-you.ts +++ b/lib/routes/medium/for-you.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; import { config } from '@/config'; - -import parseArticle from './parse-article.js'; -import { getWebInlineRecommendedFeedQuery } from './graphql.js'; import ConfigNotFoundError from '@/errors/types/config-not-found.js'; +import type { Route } from '@/types'; + +import { getWebInlineRecommendedFeedQuery } from './graphql.js'; +import parseArticle from './parse-article.js'; export const route: Route = { path: '/for-you/:user', diff --git a/lib/routes/medium/graphql.ts b/lib/routes/medium/graphql.ts index 13b825de76..4043e1f060 100644 --- a/lib/routes/medium/graphql.ts +++ b/lib/routes/medium/graphql.ts @@ -47,7 +47,7 @@ async function getUserCatalogMainContentQuery(user, catalogId, cookie, pagingLim return (await graphqlRequest(newUserCatalogMainContentQuery(catalogId, pagingLimit), cookie))?.catalogById; } -export { getWebInlineRecommendedFeedQuery, getFollowingFeedQuery, getWebInlineTopicFeedQuery, getUserCatalogMainContentQuery }; +export { getFollowingFeedQuery, getUserCatalogMainContentQuery, getWebInlineRecommendedFeedQuery, getWebInlineTopicFeedQuery }; function newFollowingFeedQuery(pagingLimit = 5) { return { diff --git a/lib/routes/medium/list.ts b/lib/routes/medium/list.ts index 3c5b95f590..15c116f51f 100644 --- a/lib/routes/medium/list.ts +++ b/lib/routes/medium/list.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; import { config } from '@/config'; - -import parseArticle from './parse-article.js'; -import { getUserCatalogMainContentQuery } from './graphql.js'; import ConfigNotFoundError from '@/errors/types/config-not-found.js'; import InvalidParameterError from '@/errors/types/invalid-parameter.js'; +import type { Route } from '@/types'; + +import { getUserCatalogMainContentQuery } from './graphql.js'; +import parseArticle from './parse-article.js'; export const route: Route = { path: '/list/:user/:catalogId', diff --git a/lib/routes/medium/parse-article.ts b/lib/routes/medium/parse-article.ts index 450eead6d9..cf92360607 100644 --- a/lib/routes/medium/parse-article.ts +++ b/lib/routes/medium/parse-article.ts @@ -1,8 +1,8 @@ -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import { config } from '@/config'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; async function parse(url, cookie = '') { const { data } = await got(url, { diff --git a/lib/routes/medium/tag.ts b/lib/routes/medium/tag.ts index 0f6472a61d..40eddb11c4 100644 --- a/lib/routes/medium/tag.ts +++ b/lib/routes/medium/tag.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; import { config } from '@/config'; - -import parseArticle from './parse-article.js'; -import { getWebInlineTopicFeedQuery } from './graphql.js'; import ConfigNotFoundError from '@/errors/types/config-not-found.js'; +import type { Route } from '@/types'; + +import { getWebInlineTopicFeedQuery } from './graphql.js'; +import parseArticle from './parse-article.js'; export const route: Route = { path: '/tag/:user/:tag', diff --git a/lib/routes/medsci/index.ts b/lib/routes/medsci/index.ts index d1ab5a757d..93e0c498fb 100644 --- a/lib/routes/medsci/index.ts +++ b/lib/routes/medsci/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/meishichina/index.ts b/lib/routes/meishichina/index.ts index b4b24b6186..4456d0716e 100644 --- a/lib/routes/meishichina/index.ts +++ b/lib/routes/meishichina/index.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const isChinese = (text: string): boolean => /^[\u4E00-\u9FA5]+$/.test(text); diff --git a/lib/routes/meituan/tech.ts b/lib/routes/meituan/tech.ts index a41d0d9421..7e1a05c49f 100644 --- a/lib/routes/meituan/tech.ts +++ b/lib/routes/meituan/tech.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; -import parser from '@/utils/rss-parser'; -import ofetch from '@/utils/ofetch'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import parser from '@/utils/rss-parser'; const rootUrl = 'https://tech.meituan.com/'; diff --git a/lib/routes/melonbooks/parser.ts b/lib/routes/melonbooks/parser.ts index 9cad45a2fc..fffb35d594 100644 --- a/lib/routes/melonbooks/parser.ts +++ b/lib/routes/melonbooks/parser.ts @@ -1,5 +1,7 @@ +import type { CheerioAPI} from 'cheerio'; +import { load } from 'cheerio'; + import { type DataItem } from '@/types'; -import { CheerioAPI, load } from 'cheerio'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; diff --git a/lib/routes/melonbooks/search.ts b/lib/routes/melonbooks/search.ts index 52502bb441..59b26a5500 100644 --- a/lib/routes/melonbooks/search.ts +++ b/lib/routes/melonbooks/search.ts @@ -1,10 +1,13 @@ -import { Data, Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; -import { parseItems } from './parser'; -import { Context } from 'hono'; import querystring from 'node:querystring'; +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { Data, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + +import { parseItems } from './parser'; + export const handler = async (ctx: Context): Promise => { const baseUrl = 'https://www.melonbooks.co.jp'; const query = ctx.req.param('query') ?? ''; diff --git a/lib/routes/mercari/keyword.ts b/lib/routes/mercari/keyword.ts index 195b411050..50d5f80c1e 100644 --- a/lib/routes/mercari/keyword.ts +++ b/lib/routes/mercari/keyword.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { fetchSearchItems, fetchItemDetail, MercariSort, MercariOrder, MercariStatus, formatItemDetail } from './util'; + +import { fetchItemDetail, fetchSearchItems, formatItemDetail, MercariOrder, MercariSort, MercariStatus } from './util'; export const route: Route = { path: '/:sort/:order/:status/:keyword', diff --git a/lib/routes/mercari/search.ts b/lib/routes/mercari/search.ts index 46ae42f856..69bb153bd5 100644 --- a/lib/routes/mercari/search.ts +++ b/lib/routes/mercari/search.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { fetchSearchItems, fetchItemDetail, formatItemDetail, MercariSort, MercariOrder, MercariStatus } from './util'; + +import { fetchItemDetail, fetchSearchItems, formatItemDetail, MercariOrder, MercariSort, MercariStatus } from './util'; export const route: Route = { path: '/search/:query', diff --git a/lib/routes/mercari/util.ts b/lib/routes/mercari/util.ts index ee2e4e2346..4389fa3435 100644 --- a/lib/routes/mercari/util.ts +++ b/lib/routes/mercari/util.ts @@ -1,12 +1,14 @@ -import crypto from 'node:crypto'; import { Buffer } from 'node:buffer'; +import crypto from 'node:crypto'; +import path from 'node:path'; + +import type { DataItem } from '@/types'; +import logger from '@/utils/logger'; import ofetch from '@/utils/ofetch'; -import { SearchResponse, ItemDetail, ShopItemDetail } from './types'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { DataItem } from '@/types'; -import logger from '@/utils/logger'; + +import type { ItemDetail, SearchResponse, ShopItemDetail } from './types'; const rootURL = 'https://api.mercari.jp/'; const rootProductURL = 'https://jp.mercari.com/item/'; @@ -319,4 +321,4 @@ const formatItemDetail = (detail: ItemDetail | ShopItemDetail): DataItem => { }; }; -export { fetchSearchItems, fetchItemDetail, formatItemDetail, MercariSort, MercariOrder, MercariStatus }; +export { fetchItemDetail, fetchSearchItems, formatItemDetail, MercariOrder, MercariSort, MercariStatus }; diff --git a/lib/routes/meta/ai-blog.ts b/lib/routes/meta/ai-blog.ts index 83949e74c3..ab308d5629 100644 --- a/lib/routes/meta/ai-blog.ts +++ b/lib/routes/meta/ai-blog.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/metacritic/index.ts b/lib/routes/metacritic/index.ts index 4763f6e26e..3193d46da6 100644 --- a/lib/routes/metacritic/index.ts +++ b/lib/routes/metacritic/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; import { sorts, types } from './util'; diff --git a/lib/routes/metacritic/release.ts b/lib/routes/metacritic/release.ts index b6e7a0f2b3..a5f2f37e33 100644 --- a/lib/routes/metacritic/release.ts +++ b/lib/routes/metacritic/release.ts @@ -1,7 +1,8 @@ -import got from '@/utils/got'; -import { toTitleCase } from '@/utils/common-utils'; import { load } from 'cheerio'; +import { toTitleCase } from '@/utils/common-utils'; +import got from '@/utils/got'; + const handler = async (ctx) => { let type = 'new-releases'; let title = 'New Releases'; diff --git a/lib/routes/meteoblue/weathernews.ts b/lib/routes/meteoblue/weathernews.ts index 42a9003fef..e960b64527 100644 --- a/lib/routes/meteoblue/weathernews.ts +++ b/lib/routes/meteoblue/weathernews.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/meteor/boards.ts b/lib/routes/meteor/boards.ts index a8835f5b4c..3a7181e0f4 100644 --- a/lib/routes/meteor/boards.ts +++ b/lib/routes/meteor/boards.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; + import { baseUrl, getBoards } from './utils'; export const route: Route = { diff --git a/lib/routes/meteor/index.ts b/lib/routes/meteor/index.ts index 5d83fdd402..a543db3836 100644 --- a/lib/routes/meteor/index.ts +++ b/lib/routes/meteor/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { baseUrl, getBoards, renderDesc } from './utils'; export const route: Route = { diff --git a/lib/routes/meteor/utils.ts b/lib/routes/meteor/utils.ts index 55a9529ee6..4facb1f542 100644 --- a/lib/routes/meteor/utils.ts +++ b/lib/routes/meteor/utils.ts @@ -1,6 +1,8 @@ +import path from 'node:path'; + import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; + const baseUrl = 'https://meteor.today'; const getBoards = (tryGet) => diff --git a/lib/routes/metmuseum/exhibitions.ts b/lib/routes/metmuseum/exhibitions.ts index e2d2594ee5..7f1253552b 100644 --- a/lib/routes/metmuseum/exhibitions.ts +++ b/lib/routes/metmuseum/exhibitions.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/metrics.ts b/lib/routes/metrics.ts index c762497485..1e17aa8cb5 100644 --- a/lib/routes/metrics.ts +++ b/lib/routes/metrics.ts @@ -1,4 +1,5 @@ import type { Handler } from 'hono'; + import { getContext } from '@/utils/otel'; const handler: Handler = (ctx) => diff --git a/lib/routes/mi/crowdfunding.ts b/lib/routes/mi/crowdfunding.ts index eeb805a6b7..487bbcd585 100644 --- a/lib/routes/mi/crowdfunding.ts +++ b/lib/routes/mi/crowdfunding.ts @@ -1,5 +1,7 @@ -import { Data, DataItem, Route, ViewType } from '@/types'; -import { CrowdfundingDetailInfo, CrowdfundingList } from './types'; +import type { Data, DataItem, Route} from '@/types'; +import { ViewType } from '@/types'; + +import type { CrowdfundingDetailInfo, CrowdfundingList } from './types'; import utils from './utils'; export const route: Route = { diff --git a/lib/routes/mi/golden.ts b/lib/routes/mi/golden.ts index 46ebb3006c..14d59029f7 100644 --- a/lib/routes/mi/golden.ts +++ b/lib/routes/mi/golden.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/mi/utils.ts b/lib/routes/mi/utils.ts index 99ea22646b..f5c3859bbb 100644 --- a/lib/routes/mi/utils.ts +++ b/lib/routes/mi/utils.ts @@ -1,13 +1,17 @@ -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; -import { art } from '@/utils/render'; -import dayjs from 'dayjs'; import 'dayjs/locale/zh-cn.js'; + +import path from 'node:path'; + +import dayjs from 'dayjs'; import localizedFormat from 'dayjs/plugin/localizedFormat.js'; import timezone from 'dayjs/plugin/timezone.js'; import utc from 'dayjs/plugin/utc.js'; -import path from 'node:path'; -import { CrowdfundingData, CrowdfundingDetailData, CrowdfundingDetailInfo, CrowdfundingItem, CrowdfundingList, DataResponse } from './types'; + +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { art } from '@/utils/render'; + +import type { CrowdfundingData, CrowdfundingDetailData, CrowdfundingDetailInfo, CrowdfundingItem, CrowdfundingList, DataResponse } from './types'; dayjs.extend(localizedFormat); dayjs.extend(timezone); diff --git a/lib/routes/microsoft/addon.ts b/lib/routes/microsoft/addon.ts index f10d9595c2..11d9080be4 100644 --- a/lib/routes/microsoft/addon.ts +++ b/lib/routes/microsoft/addon.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/microsoft/mcr.ts b/lib/routes/microsoft/mcr.ts index da12472916..7307a2ec8d 100644 --- a/lib/routes/microsoft/mcr.ts +++ b/lib/routes/microsoft/mcr.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/mihoyo/bbs/cache.ts b/lib/routes/mihoyo/bbs/cache.ts index 7c986a673c..1b7e8d4b1a 100644 --- a/lib/routes/mihoyo/bbs/cache.ts +++ b/lib/routes/mihoyo/bbs/cache.ts @@ -1,7 +1,7 @@ -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; const getUserFullInfo = (ctx, uid) => { if (!uid && !config.mihoyo.cookie) { diff --git a/lib/routes/mihoyo/bbs/follow-list.ts b/lib/routes/mihoyo/bbs/follow-list.ts index d2d6e5d7b9..e5e3a86cb9 100644 --- a/lib/routes/mihoyo/bbs/follow-list.ts +++ b/lib/routes/mihoyo/bbs/follow-list.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; + import cache from './cache'; const renderDescription = (description, images) => art(path.join(__dirname, '../templates/description.art'), { description, images }); diff --git a/lib/routes/mihoyo/bbs/img-ranking.ts b/lib/routes/mihoyo/bbs/img-ranking.ts index 75bc1abc88..89100492d8 100644 --- a/lib/routes/mihoyo/bbs/img-ranking.ts +++ b/lib/routes/mihoyo/bbs/img-ranking.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import { DATA_MAP, RANKING_TYPE_MAP } from './static-data'; import { post2item } from './utils'; diff --git a/lib/routes/mihoyo/bbs/official.ts b/lib/routes/mihoyo/bbs/official.ts index 48c28e9076..180f5489c2 100644 --- a/lib/routes/mihoyo/bbs/official.ts +++ b/lib/routes/mihoyo/bbs/official.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { art } from '@/utils/render'; -import path from 'node:path'; -import { parseDate } from '@/utils/parse-date'; import logger from '@/utils/logger'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; // 游戏id const GITS_MAP = { diff --git a/lib/routes/mihoyo/bbs/timeline.ts b/lib/routes/mihoyo/bbs/timeline.ts index c390636f12..8826d620a6 100644 --- a/lib/routes/mihoyo/bbs/timeline.ts +++ b/lib/routes/mihoyo/bbs/timeline.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import cache from './cache'; import { config } from '@/config'; -import { post2item } from './utils'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import cache from './cache'; +import { post2item } from './utils'; export const route: Route = { path: '/bbs/timeline', diff --git a/lib/routes/mihoyo/bbs/user-post.ts b/lib/routes/mihoyo/bbs/user-post.ts index 75793a90ff..f6361e8157 100644 --- a/lib/routes/mihoyo/bbs/user-post.ts +++ b/lib/routes/mihoyo/bbs/user-post.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import { post2item } from './utils'; export const route: Route = { diff --git a/lib/routes/mihoyo/bbs/utils.ts b/lib/routes/mihoyo/bbs/utils.ts index 745c5c46c9..f170fbe197 100644 --- a/lib/routes/mihoyo/bbs/utils.ts +++ b/lib/routes/mihoyo/bbs/utils.ts @@ -1,6 +1,7 @@ -import { art } from '@/utils/render'; import path from 'node:path'; + import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; const renderDescription = (description, images) => art(path.join(__dirname, '../templates/description.art'), { description, images }); diff --git a/lib/routes/mihoyo/sr/news.ts b/lib/routes/mihoyo/sr/news.ts index b187e57aa7..0a158fa01b 100644 --- a/lib/routes/mihoyo/sr/news.ts +++ b/lib/routes/mihoyo/sr/news.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/mihoyo/ys/news.ts b/lib/routes/mihoyo/ys/news.ts index 2ac35fb5c6..051918df7b 100644 --- a/lib/routes/mihoyo/ys/news.ts +++ b/lib/routes/mihoyo/ys/news.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/mihoyo/zzz/news.ts b/lib/routes/mihoyo/zzz/news.ts index f70471f797..0b99197d4b 100644 --- a/lib/routes/mihoyo/zzz/news.ts +++ b/lib/routes/mihoyo/zzz/news.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/mindmeister/example.ts b/lib/routes/mindmeister/example.ts index 842101642f..069d610283 100644 --- a/lib/routes/mindmeister/example.ts +++ b/lib/routes/mindmeister/example.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + const baseUrl = 'https://www.mindmeister.com'; export const route: Route = { diff --git a/lib/routes/minecraft/blockedservers.ts b/lib/routes/minecraft/blockedservers.ts index f787b6a13d..aaa898ad59 100644 --- a/lib/routes/minecraft/blockedservers.ts +++ b/lib/routes/minecraft/blockedservers.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/minecraft/java-runtime.ts b/lib/routes/minecraft/java-runtime.ts index 87bcbe7f8e..72be6ad092 100644 --- a/lib/routes/minecraft/java-runtime.ts +++ b/lib/routes/minecraft/java-runtime.ts @@ -1,6 +1,7 @@ -import { DataItem, Route } from '@/types'; +import type { Context } from 'hono'; + +import type { DataItem, Route } from '@/types'; import got from '@/utils/got'; -import { Context } from 'hono'; export const route: Route = { path: '/java-runtime/:arch?/:javaType?', diff --git a/lib/routes/minecraft/version.ts b/lib/routes/minecraft/version.ts index 9010549199..bc445aabc6 100644 --- a/lib/routes/minecraft/version.ts +++ b/lib/routes/minecraft/version.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Context } from 'hono'; + +import type { Route } from '@/types'; import got from '@/utils/got'; -import { Context } from 'hono'; export const route: Route = { path: '/version/:versionType?/:linkType?', diff --git a/lib/routes/mingpao/index.ts b/lib/routes/mingpao/index.ts index 161766ea46..b79613afb4 100644 --- a/lib/routes/mingpao/index.ts +++ b/lib/routes/mingpao/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import * as cheerio from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import parser from '@/utils/rss-parser'; -import * as cheerio from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import parser from '@/utils/rss-parser'; const renderFanBox = (media) => art(path.join(__dirname, 'templates/fancybox.art'), { diff --git a/lib/routes/miniflux/entry.ts b/lib/routes/miniflux/entry.ts index 8fffd2c048..ce65857876 100644 --- a/lib/routes/miniflux/entry.ts +++ b/lib/routes/miniflux/entry.ts @@ -1,7 +1,7 @@ -import { Route, Data } from '@/types'; -import got from '@/utils/got'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Data, Route } from '@/types'; +import got from '@/utils/got'; export const route: Route = { path: '/entry/:feeds/:parameters?', diff --git a/lib/routes/miniflux/subscription.ts b/lib/routes/miniflux/subscription.ts index 1085bbac19..cca3823451 100644 --- a/lib/routes/miniflux/subscription.ts +++ b/lib/routes/miniflux/subscription.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import got from '@/utils/got'; export const route: Route = { path: '/subscription/:parameters?', diff --git a/lib/routes/mirror/index.ts b/lib/routes/mirror/index.ts index 9025647795..658715621d 100644 --- a/lib/routes/mirror/index.ts +++ b/lib/routes/mirror/index.ts @@ -1,13 +1,15 @@ -import { Route } from '@/types'; +import MarkdownIt from 'markdown-it'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import MarkdownIt from 'markdown-it'; +import { isValidHost } from '@/utils/valid-host'; + const md = MarkdownIt({ html: true, linkify: true, }); -import { isValidHost } from '@/utils/valid-host'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; export const route: Route = { path: '/:id', diff --git a/lib/routes/mirrormedia/category.ts b/lib/routes/mirrormedia/category.ts index b9f2e67f8b..cb08c0bc44 100644 --- a/lib/routes/mirrormedia/category.ts +++ b/lib/routes/mirrormedia/category.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; - -import { parseDate } from '@/utils/parse-date'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + import { getArticle } from './utils'; export const route: Route = { diff --git a/lib/routes/mirrormedia/index.ts b/lib/routes/mirrormedia/index.ts index 75d14b6d2f..759823683f 100644 --- a/lib/routes/mirrormedia/index.ts +++ b/lib/routes/mirrormedia/index.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; - -import { parseDate } from '@/utils/parse-date'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + import { getArticle } from './utils'; export const route: Route = { diff --git a/lib/routes/mirrormedia/utils.ts b/lib/routes/mirrormedia/utils.ts index 6af24b14ba..47a1b20d06 100644 --- a/lib/routes/mirrormedia/utils.ts +++ b/lib/routes/mirrormedia/utils.ts @@ -1,4 +1,5 @@ import { load } from 'cheerio'; + import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; diff --git a/lib/routes/missav/new.ts b/lib/routes/missav/new.ts index 88a2e1fb5a..d8c1706543 100644 --- a/lib/routes/missav/new.ts +++ b/lib/routes/missav/new.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; // import ofetch from '@/utils/ofetch'; import * as cheerio from 'cheerio'; -import { art } from '@/utils/render'; -import path from 'node:path'; + +import type { Route } from '@/types'; // import { config } from '@/config'; import puppeteer from '@/utils/puppeteer'; +import { art } from '@/utils/render'; const urlPath = 'dm514/new'; diff --git a/lib/routes/misskey/featured-notes.ts b/lib/routes/misskey/featured-notes.ts index 085081f0de..03f3175954 100644 --- a/lib/routes/misskey/featured-notes.ts +++ b/lib/routes/misskey/featured-notes.ts @@ -1,8 +1,10 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; -import utils from './utils'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; + +import utils from './utils'; export const route: Route = { path: '/notes/featured/:site', diff --git a/lib/routes/misskey/home-timeline.ts b/lib/routes/misskey/home-timeline.ts index c869e93594..c80bb75020 100644 --- a/lib/routes/misskey/home-timeline.ts +++ b/lib/routes/misskey/home-timeline.ts @@ -1,9 +1,12 @@ +import querystring from 'node:querystring'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { queryToBoolean } from '@/utils/readable-social'; -import querystring from 'node:querystring'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/misskey/user-timeline.ts b/lib/routes/misskey/user-timeline.ts index 703e90a8bc..3c69ff4950 100644 --- a/lib/routes/misskey/user-timeline.ts +++ b/lib/routes/misskey/user-timeline.ts @@ -1,9 +1,12 @@ +import querystring from 'node:querystring'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { Data, Route, ViewType } from '@/types'; +import type { Data, Route} from '@/types'; +import { ViewType } from '@/types'; import { fallback, queryToBoolean } from '@/utils/readable-social'; -import querystring from 'node:querystring'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/misskey/utils.ts b/lib/routes/misskey/utils.ts index 9ad087eb59..db788ab6df 100644 --- a/lib/routes/misskey/utils.ts +++ b/lib/routes/misskey/utils.ts @@ -1,10 +1,11 @@ +import path from 'node:path'; + import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { MisskeyNote, MisskeyUser } from './types'; +import type { MisskeyNote, MisskeyUser } from './types'; const allowSiteList = ['misskey.io', 'madost.one', 'mk.nixnet.social']; diff --git a/lib/routes/misskon/posts.ts b/lib/routes/misskon/posts.ts index 0df94fb28a..ebd6b43b90 100644 --- a/lib/routes/misskon/posts.ts +++ b/lib/routes/misskon/posts.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { ENDPOINT, getPosts } from './utils'; export const route: Route = { diff --git a/lib/routes/misskon/tag.ts b/lib/routes/misskon/tag.ts index 5a59855acc..923425f27b 100644 --- a/lib/routes/misskon/tag.ts +++ b/lib/routes/misskon/tag.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { getPosts, getTags } from './utils'; export const route: Route = { diff --git a/lib/routes/misskon/top.ts b/lib/routes/misskon/top.ts index 7b9ba020c9..bb117dff0b 100644 --- a/lib/routes/misskon/top.ts +++ b/lib/routes/misskon/top.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + import { getPosts } from './utils'; export const route: Route = { diff --git a/lib/routes/misskon/utils.ts b/lib/routes/misskon/utils.ts index 7445fa20a3..ad01798d47 100644 --- a/lib/routes/misskon/utils.ts +++ b/lib/routes/misskon/utils.ts @@ -1,5 +1,6 @@ -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/mit/hanlab.ts b/lib/routes/mit/hanlab.ts index fc0c21da0a..41472da306 100644 --- a/lib/routes/mit/hanlab.ts +++ b/lib/routes/mit/hanlab.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; export const route: Route = { path: '/hanlab/blog', diff --git a/lib/routes/mittrchina/index.ts b/lib/routes/mittrchina/index.ts index 3c9631f783..b4fba8b5c7 100644 --- a/lib/routes/mittrchina/index.ts +++ b/lib/routes/mittrchina/index.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:type?', diff --git a/lib/routes/miui/community/user.ts b/lib/routes/miui/community/user.ts index 49f47bb755..958f75c528 100644 --- a/lib/routes/miui/community/user.ts +++ b/lib/routes/miui/community/user.ts @@ -1,4 +1,4 @@ -import { Route, Data } from '@/types'; +import type { Data, Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/miui/firmware/index.ts b/lib/routes/miui/firmware/index.ts index df911f5494..d330712c27 100644 --- a/lib/routes/miui/firmware/index.ts +++ b/lib/routes/miui/firmware/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import queryString from 'query-string'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/firmware/:device/:type?/:region?', categories: ['program-update'], diff --git a/lib/routes/mixcloud/index.ts b/lib/routes/mixcloud/index.ts index 07517ca2b4..9dd16235e1 100644 --- a/lib/routes/mixcloud/index.ts +++ b/lib/routes/mixcloud/index.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import CryptoJS from 'crypto-js'; -import { parseDate } from '@/utils/parse-date'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { MIXCLOUD_CONFIG, TYPE_CONFIG, TYPE_NAMES, getObjectFields } from './config'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + +import { getObjectFields, MIXCLOUD_CONFIG, TYPE_CONFIG, TYPE_NAMES } from './config'; export const route: Route = { path: '/:username/:type?', diff --git a/lib/routes/mixcloud/user-playlist.ts b/lib/routes/mixcloud/user-playlist.ts index e68c1fbdcb..dcb6fa7b40 100644 --- a/lib/routes/mixcloud/user-playlist.ts +++ b/lib/routes/mixcloud/user-playlist.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { handler } from './index'; export const route: Route = { diff --git a/lib/routes/mixi2/community.ts b/lib/routes/mixi2/community.ts index cd053668cd..69759d2b31 100644 --- a/lib/routes/mixi2/community.ts +++ b/lib/routes/mixi2/community.ts @@ -1,5 +1,7 @@ -import { type Data, type Route, ViewType } from '@/types'; import type { Context } from 'hono'; + +import { type Data, type Route, ViewType } from '@/types'; + import { CONFIG_OPTIONS, generatePostDataItem, getClient, postFilter } from './utils'; const handler = async (ctx: Context) => { diff --git a/lib/routes/mixi2/discovery.ts b/lib/routes/mixi2/discovery.ts index 8c2e9ede27..32157d0ec6 100644 --- a/lib/routes/mixi2/discovery.ts +++ b/lib/routes/mixi2/discovery.ts @@ -1,5 +1,7 @@ -import { type Data, type Route, ViewType } from '@/types'; import type { Context } from 'hono'; + +import { type Data, type Route, ViewType } from '@/types'; + import { CONFIG_OPTIONS, generatePostDataItem, getClient, postFilter } from './utils'; const handler = async (ctx: Context) => { diff --git a/lib/routes/mixi2/home.ts b/lib/routes/mixi2/home.ts index ec2d31f04d..5797802642 100644 --- a/lib/routes/mixi2/home.ts +++ b/lib/routes/mixi2/home.ts @@ -1,5 +1,7 @@ -import { type Data, type Route, ViewType } from '@/types'; import type { Context } from 'hono'; + +import { type Data, type Route, ViewType } from '@/types'; + import { CONFIG_OPTIONS, generatePostDataItem, getClient, postFilter } from './utils'; const handler = async (ctx: Context) => { diff --git a/lib/routes/mixi2/user.ts b/lib/routes/mixi2/user.ts index 1594beb62e..538c34ea6e 100644 --- a/lib/routes/mixi2/user.ts +++ b/lib/routes/mixi2/user.ts @@ -1,8 +1,10 @@ -import { type Data, type Route, ViewType } from '@/types'; import type { Context } from 'hono'; -import { CONFIG_OPTIONS, getClient, parsePost, postFilter } from './utils'; -import { parseDate } from '@/utils/parse-date'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import { type Data, type Route, ViewType } from '@/types'; +import { parseDate } from '@/utils/parse-date'; + +import { CONFIG_OPTIONS, getClient, parsePost, postFilter } from './utils'; const handler = async (ctx: Context) => { const limit = Number.parseInt(ctx.req.query('limit') ?? '20', 10); diff --git a/lib/routes/mixi2/utils.ts b/lib/routes/mixi2/utils.ts index fa3a01fae2..934be9e1a1 100644 --- a/lib/routes/mixi2/utils.ts +++ b/lib/routes/mixi2/utils.ts @@ -1,4 +1,5 @@ -import { Category, MixiClient, Persona, type Post } from 'mixi2'; +import type { Category, MixiClient, Persona, type Post } from 'mixi2'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; import ofetch from '@/utils/ofetch'; diff --git a/lib/routes/miyuki/news.ts b/lib/routes/miyuki/news.ts index 0be106f921..3ed4b50c13 100644 --- a/lib/routes/miyuki/news.ts +++ b/lib/routes/miyuki/news.ts @@ -1,7 +1,8 @@ -import type { DataItem, Route } from '@/types'; import { load } from 'cheerio'; -import ofetch from '@/utils/ofetch'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/modb/topic.ts b/lib/routes/modb/topic.ts index d577d71bd0..30e0039056 100644 --- a/lib/routes/modb/topic.ts +++ b/lib/routes/modb/topic.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; -import ofetch from '@/utils/ofetch'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import logger from '@/utils/logger'; -import timezone from '@/utils/timezone'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/topic/:id', diff --git a/lib/routes/modelscope/community.ts b/lib/routes/modelscope/community.ts index c0db0a9771..5f0db57471 100644 --- a/lib/routes/modelscope/community.ts +++ b/lib/routes/modelscope/community.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; -import { load } from 'cheerio'; -import got from '@/utils/got'; import path from 'node:path'; -import timezone from '@/utils/timezone'; -import { art } from '@/utils/render'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/community', diff --git a/lib/routes/modelscope/datasets.ts b/lib/routes/modelscope/datasets.ts index eae2c42948..e8910596c8 100644 --- a/lib/routes/modelscope/datasets.ts +++ b/lib/routes/modelscope/datasets.ts @@ -1,15 +1,17 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import MarkdownIt from 'markdown-it'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + const md = MarkdownIt({ html: true, linkify: true, }); -import path from 'node:path'; -import { art } from '@/utils/render'; -import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/datasets', diff --git a/lib/routes/modelscope/learn.ts b/lib/routes/modelscope/learn.ts index 395dca2fe1..3d1c780bac 100644 --- a/lib/routes/modelscope/learn.ts +++ b/lib/routes/modelscope/learn.ts @@ -1,5 +1,4 @@ -import { Route } from '@/types'; - +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/modelscope/models.ts b/lib/routes/modelscope/models.ts index d23ccd954d..c3c3d6df1c 100644 --- a/lib/routes/modelscope/models.ts +++ b/lib/routes/modelscope/models.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; +import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import MarkdownIt from 'markdown-it'; +import { parseDate } from '@/utils/parse-date'; + const md = MarkdownIt({ html: true, linkify: true, }); -import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/models', diff --git a/lib/routes/modelscope/studios.ts b/lib/routes/modelscope/studios.ts index 5262cf1e9a..46b5faacb9 100644 --- a/lib/routes/modelscope/studios.ts +++ b/lib/routes/modelscope/studios.ts @@ -1,15 +1,17 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import MarkdownIt from 'markdown-it'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + const md = MarkdownIt({ html: true, linkify: true, }); -import path from 'node:path'; -import { art } from '@/utils/render'; -import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/studios', diff --git a/lib/routes/modian/zhongchou.ts b/lib/routes/modian/zhongchou.ts index bb5559a857..eece4feca3 100644 --- a/lib/routes/modian/zhongchou.ts +++ b/lib/routes/modian/zhongchou.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/zhongchou/:category?/:sort?/:status?', diff --git a/lib/routes/modrinth/versions.ts b/lib/routes/modrinth/versions.ts index 97880bb29d..887be99bbd 100644 --- a/lib/routes/modrinth/versions.ts +++ b/lib/routes/modrinth/versions.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; +import path from 'node:path'; + +import type { Context } from 'hono'; +import MarkdownIt from 'markdown-it'; + +import { config } from '@/config'; +import type { Author, Project, Version } from '@/routes/modrinth/api'; +import type { Route } from '@/types'; +import _ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { config } from '@/config'; -import _ofetch from '@/utils/ofetch'; -import MarkdownIt from 'markdown-it'; -import type { Author, Project, Version } from '@/routes/modrinth/api'; -import type { Context } from 'hono'; const ofetch = _ofetch.create({ headers: { diff --git a/lib/routes/mohw/clarification.ts b/lib/routes/mohw/clarification.ts index 627847973f..3152fb69c4 100644 --- a/lib/routes/mohw/clarification.ts +++ b/lib/routes/mohw/clarification.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/moodysmismicrosite/report.ts b/lib/routes/moodysmismicrosite/report.ts index 2cc1caa9f2..6b956e937d 100644 --- a/lib/routes/moodysmismicrosite/report.ts +++ b/lib/routes/moodysmismicrosite/report.ts @@ -1,6 +1,7 @@ -import { Route, ViewType } from '@/types'; -import { parseRelativeDate } from '@/utils/parse-date'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; +import { parseRelativeDate } from '@/utils/parse-date'; export const route: Route = { path: '/report/:industry?', diff --git a/lib/routes/mox/index.ts b/lib/routes/mox/index.ts index ce3afb137d..784e10a26b 100644 --- a/lib/routes/mox/index.ts +++ b/lib/routes/mox/index.ts @@ -1,8 +1,9 @@ -import { DataItem, Route } from '@/types'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { config } from '@/config'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/mpaypass/main.ts b/lib/routes/mpaypass/main.ts index 73f069e63d..345574a64a 100644 --- a/lib/routes/mpaypass/main.ts +++ b/lib/routes/mpaypass/main.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/mpaypass/news.ts b/lib/routes/mpaypass/news.ts index c656f31b8a..9551023337 100644 --- a/lib/routes/mpaypass/news.ts +++ b/lib/routes/mpaypass/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/mrdx/daily.ts b/lib/routes/mrdx/daily.ts index e5861efe5e..a75b1b207b 100644 --- a/lib/routes/mrdx/daily.ts +++ b/lib/routes/mrdx/daily.ts @@ -1,13 +1,15 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import { getElementChildrenInnerText } from './utils'; import dayjs from 'dayjs'; import utc from 'dayjs/plugin/utc.js'; -dayjs.extend(utc); +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + +import { getElementChildrenInnerText } from './utils'; + +dayjs.extend(utc); export const route: Route = { path: '/today', diff --git a/lib/routes/mrm/index.ts b/lib/routes/mrm/index.ts index 913ae0db87..fd3e6dbf04 100644 --- a/lib/routes/mrm/index.ts +++ b/lib/routes/mrm/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/msn/index.ts b/lib/routes/msn/index.ts index edbd542128..67349229de 100644 --- a/lib/routes/msn/index.ts +++ b/lib/routes/msn/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import cache from '@/utils/cache'; -import { load } from 'cheerio'; const apiKey = '0QfOX3Vn51YCzitbLaRkTTBadtWpgTN8NZLW0C1SEM'; const fetchedArticleContentHtmlImgRegex = //; diff --git a/lib/routes/musify/index.ts b/lib/routes/musify/index.ts index 4913593742..4accf4d682 100644 --- a/lib/routes/musify/index.ts +++ b/lib/routes/musify/index.ts @@ -1,11 +1,10 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; + export const handler = async (ctx: Context): Promise => { const { language = '' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/musikguru/news.ts b/lib/routes/musikguru/news.ts index 4ad1141e3c..864b142d90 100644 --- a/lib/routes/musikguru/news.ts +++ b/lib/routes/musikguru/news.ts @@ -1,16 +1,16 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; - export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '10', 10); diff --git a/lib/routes/mwm/index.ts b/lib/routes/mwm/index.ts index 3847b37081..a3747b47c3 100644 --- a/lib/routes/mwm/index.ts +++ b/lib/routes/mwm/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/my-formosa/index.ts b/lib/routes/my-formosa/index.ts index 231f414fb4..dcddb57944 100644 --- a/lib/routes/my-formosa/index.ts +++ b/lib/routes/my-formosa/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/mycard520/news.ts b/lib/routes/mycard520/news.ts index 7ecf503c57..241f656dc1 100644 --- a/lib/routes/mycard520/news.ts +++ b/lib/routes/mycard520/news.ts @@ -1,13 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const { category = 'cardgame' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '18', 10); diff --git a/lib/routes/mydrivers/cid.ts b/lib/routes/mydrivers/cid.ts index 028dbeb080..f68f28c34e 100644 --- a/lib/routes/mydrivers/cid.ts +++ b/lib/routes/mydrivers/cid.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; import parser from '@/utils/rss-parser'; -import { rootUrl, rootRSSUrl, title, categories, getInfo, processItems } from './util'; +import { categories, getInfo, processItems, rootRSSUrl, rootUrl, title } from './util'; export const route: Route = { path: '/cid/:id?', diff --git a/lib/routes/mydrivers/index.ts b/lib/routes/mydrivers/index.ts index 5e7859c7cf..ef18a37217 100644 --- a/lib/routes/mydrivers/index.ts +++ b/lib/routes/mydrivers/index.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; - -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 path from 'node:path'; -import { rootUrl, title, categories, convertToQueryString, getInfo, processItems } from './util'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; + +import { categories, convertToQueryString, getInfo, processItems, rootUrl, title } from './util'; export const route: Route = { path: '/:category{.+}?', diff --git a/lib/routes/mydrivers/rank.ts b/lib/routes/mydrivers/rank.ts index 95c3fc081e..7f5f115cce 100644 --- a/lib/routes/mydrivers/rank.ts +++ b/lib/routes/mydrivers/rank.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { rootUrl, getInfo, processItems } from './util'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import { getInfo, processItems, rootUrl } from './util'; export const route: Route = { path: '/rank/:range?', diff --git a/lib/routes/mydrivers/util.ts b/lib/routes/mydrivers/util.ts index e24f6a9d78..49da4ddd64 100644 --- a/lib/routes/mydrivers/util.ts +++ b/lib/routes/mydrivers/util.ts @@ -1,8 +1,9 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; -import { parseDate } from '@/utils/parse-date'; + import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const domain = 'mydrivers.com'; const rootUrl = `https://m.${domain}`; @@ -110,4 +111,4 @@ const processItems = async (items) => ) ); -export { rootUrl, rootRSSUrl, title, categories, convertToQueryString, getInfo, processItems }; +export { categories, convertToQueryString, getInfo, processItems, rootRSSUrl, rootUrl, title }; diff --git a/lib/routes/myfans/post.ts b/lib/routes/myfans/post.ts index 74bb9a3927..14aafa7c7c 100644 --- a/lib/routes/myfans/post.ts +++ b/lib/routes/myfans/post.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import { showByUsername, getPostByAccountId, baseUrl } from './utils'; import path from 'node:path'; + +import type { Route } from '@/types'; +import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; +import { baseUrl, getPostByAccountId, showByUsername } from './utils'; + export const route: Route = { path: '/user/:username', categories: ['multimedia'], diff --git a/lib/routes/myfans/utils.ts b/lib/routes/myfans/utils.ts index df49d22a50..e2b4c9b1be 100644 --- a/lib/routes/myfans/utils.ts +++ b/lib/routes/myfans/utils.ts @@ -1,7 +1,8 @@ -import ofetch from '@/utils/ofetch'; import InvalidParameterError from '@/errors/types/invalid-parameter'; import cache from '@/utils/cache'; -import { Post, UserProfile } from './types'; +import ofetch from '@/utils/ofetch'; + +import type { Post, UserProfile } from './types'; const apiBaseUrl = 'https://api.myfans.jp'; export const baseUrl = 'https://myfans.jp'; diff --git a/lib/routes/myfigurecollection/activity.ts b/lib/routes/myfigurecollection/activity.ts index f09101c4db..8a488e60cd 100644 --- a/lib/routes/myfigurecollection/activity.ts +++ b/lib/routes/myfigurecollection/activity.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; import { isValidHost } from '@/utils/valid-host'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; export const route: Route = { path: '/activity/:category?/:language?/:latestAdditions?/:latestEdits?/:latestAlerts?/:latestPictures?', diff --git a/lib/routes/myfigurecollection/index.ts b/lib/routes/myfigurecollection/index.ts index b2278b6633..3c81d92a4c 100644 --- a/lib/routes/myfigurecollection/index.ts +++ b/lib/routes/myfigurecollection/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { art } from '@/utils/render'; -import path from 'node:path'; import { isValidHost } from '@/utils/valid-host'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const shortcuts = { potd: 'picture/browse/potd/', diff --git a/lib/routes/mygopen/index.ts b/lib/routes/mygopen/index.ts index d53212369e..8c227784d3 100644 --- a/lib/routes/mygopen/index.ts +++ b/lib/routes/mygopen/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/mymusicsheet/usersheets.ts b/lib/routes/mymusicsheet/usersheets.ts index 1cfc0a5e9b..caaa5b8f6b 100644 --- a/lib/routes/mymusicsheet/usersheets.ts +++ b/lib/routes/mymusicsheet/usersheets.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; export const route: Route = { path: '/user/sheets/:username/:iso?/:freeOnly?', diff --git a/lib/routes/mysql/release.ts b/lib/routes/mysql/release.ts index 29bb810306..10b2791702 100644 --- a/lib/routes/mysql/release.ts +++ b/lib/routes/mysql/release.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { config } from '@/config'; -import { load } from 'cheerio'; export const route: Route = { path: '/release/:version?', diff --git a/lib/routes/nankai/ai-notice.ts b/lib/routes/nankai/ai-notice.ts index f04bf8a7f9..f922af5a2e 100644 --- a/lib/routes/nankai/ai-notice.ts +++ b/lib/routes/nankai/ai-notice.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/nankai/cc-notice.ts b/lib/routes/nankai/cc-notice.ts index 992da52b7c..3b216b0578 100644 --- a/lib/routes/nankai/cc-notice.ts +++ b/lib/routes/nankai/cc-notice.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/nankai/graduate-notice.ts b/lib/routes/nankai/graduate-notice.ts index 1dd8896ee3..26fc68bbef 100644 --- a/lib/routes/nankai/graduate-notice.ts +++ b/lib/routes/nankai/graduate-notice.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/nankai/jwc.ts b/lib/routes/nankai/jwc.ts index e2c9ce5236..16598e8e2f 100644 --- a/lib/routes/nankai/jwc.ts +++ b/lib/routes/nankai/jwc.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/nankai/notice.ts b/lib/routes/nankai/notice.ts index 582d0303db..68cc1e3fdf 100644 --- a/lib/routes/nankai/notice.ts +++ b/lib/routes/nankai/notice.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/nankai/yzb.ts b/lib/routes/nankai/yzb.ts index 85551817c0..cb6b2e6bea 100644 --- a/lib/routes/nankai/yzb.ts +++ b/lib/routes/nankai/yzb.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/nasa/apod-cn.ts b/lib/routes/nasa/apod-cn.ts index 5081685911..cb372a8ea1 100644 --- a/lib/routes/nasa/apod-cn.ts +++ b/lib/routes/nasa/apod-cn.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/nasa/apod-ncku.ts b/lib/routes/nasa/apod-ncku.ts index c16e9ed66c..0b31acad6c 100644 --- a/lib/routes/nasa/apod-ncku.ts +++ b/lib/routes/nasa/apod-ncku.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/nasa/apod.ts b/lib/routes/nasa/apod.ts index 07409441bd..1d676743f0 100644 --- a/lib/routes/nasa/apod.ts +++ b/lib/routes/nasa/apod.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/natgeo/dailyphoto.ts b/lib/routes/natgeo/dailyphoto.ts index c87253b2ad..e313daf1c1 100644 --- a/lib/routes/natgeo/dailyphoto.ts +++ b/lib/routes/natgeo/dailyphoto.ts @@ -1,12 +1,14 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { config } from '@/config'; export const route: Route = { path: '/dailyphoto', diff --git a/lib/routes/natgeo/dailyselection.ts b/lib/routes/natgeo/dailyselection.ts index 49977d845b..9e4a94ab4c 100644 --- a/lib/routes/natgeo/dailyselection.ts +++ b/lib/routes/natgeo/dailyselection.ts @@ -1,7 +1,8 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/dailyselection', diff --git a/lib/routes/natgeo/natgeo.ts b/lib/routes/natgeo/natgeo.ts index 3de1833343..b2bd3811ab 100644 --- a/lib/routes/natgeo/natgeo.ts +++ b/lib/routes/natgeo/natgeo.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/nationalgeographic/latest-stories.ts b/lib/routes/nationalgeographic/latest-stories.ts index fb29acb1e2..27bdd37937 100644 --- a/lib/routes/nationalgeographic/latest-stories.ts +++ b/lib/routes/nationalgeographic/latest-stories.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const findNatgeo = ($) => JSON.parse( diff --git a/lib/routes/naturalism/new.ts b/lib/routes/naturalism/new.ts index 189e41a744..4a1c5ccc11 100644 --- a/lib/routes/naturalism/new.ts +++ b/lib/routes/naturalism/new.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; export const route: Route = { path: '/', diff --git a/lib/routes/nature/cover.ts b/lib/routes/nature/cover.ts index cb6458f49d..1ad509eb1c 100644 --- a/lib/routes/nature/cover.ts +++ b/lib/routes/nature/cover.ts @@ -1,4 +1,7 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import { CookieJar } from 'tough-cookie'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; // The content is generateed by undocumentated API of nature journals // This router has **just** been tested in: @@ -15,12 +18,10 @@ import cache from '@/utils/cache'; // nplants: Nature Plants // natastron: Nature Astronomy // nphys Nature Physics - import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + import { baseUrl, journalMap } from './utils'; -import { CookieJar } from 'tough-cookie'; export const route: Route = { path: '/cover', diff --git a/lib/routes/nature/highlight.ts b/lib/routes/nature/highlight.ts index fe2b843ed7..d42e1ac23c 100644 --- a/lib/routes/nature/highlight.ts +++ b/lib/routes/nature/highlight.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; -import { baseUrl, cookieJar, getArticleList, getArticle } from './utils'; + +import { baseUrl, cookieJar, getArticle, getArticleList } from './utils'; export const route: Route = { path: '/highlight/:journal?', diff --git a/lib/routes/nature/news-and-comment.ts b/lib/routes/nature/news-and-comment.ts index 7a21030993..71c6d3ff08 100644 --- a/lib/routes/nature/news-and-comment.ts +++ b/lib/routes/nature/news-and-comment.ts @@ -1,4 +1,3 @@ -import { Route } from '@/types'; // example usage: `/nature/news-and-comment/ng` // The journals from NPG are run by different group of people, // and the website of may not be consitent for all the journals @@ -12,10 +11,12 @@ import { Route } from '@/types'; // nchem: Nature Chemistry // nmat: Nature Materials // natmachintell: Nature Machine Intelligence - import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; -import { baseUrl, cookieJar, getArticleList, getArticle } from './utils'; + +import { baseUrl, cookieJar, getArticle, getArticleList } from './utils'; export const route: Route = { path: '/news-and-comment/:journal?', diff --git a/lib/routes/nature/news.ts b/lib/routes/nature/news.ts index 953ea2c4c5..73a4533c58 100644 --- a/lib/routes/nature/news.ts +++ b/lib/routes/nature/news.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { baseUrl, cookieJar, getArticle } from './utils'; export const route: Route = { diff --git a/lib/routes/nature/research.ts b/lib/routes/nature/research.ts index 9a7b05fe9c..f95bbaae75 100644 --- a/lib/routes/nature/research.ts +++ b/lib/routes/nature/research.ts @@ -1,4 +1,3 @@ -import { Route } from '@/types'; // example usage: `/nature/research/ng` // The journals from NPG are run by different group of people, // and the website of may not be consitent for all the journals @@ -13,10 +12,12 @@ import { Route } from '@/types'; // nchem: Nature Chemistry // nmat: Nature Materials // natmachintell: Nature Machine Intelligence - import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; -import { baseUrl, cookieJar, getArticleList, getDataLayer, getArticle } from './utils'; + +import { baseUrl, cookieJar, getArticle, getArticleList, getDataLayer } from './utils'; export const route: Route = { path: '/research/:journal?', diff --git a/lib/routes/nature/siteindex.ts b/lib/routes/nature/siteindex.ts index d927800dd8..0666710d27 100644 --- a/lib/routes/nature/siteindex.ts +++ b/lib/routes/nature/siteindex.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import { baseUrl, cookieJar } from './utils'; export const route: Route = { diff --git a/lib/routes/nature/utils.ts b/lib/routes/nature/utils.ts index cf77094328..bebefabc07 100644 --- a/lib/routes/nature/utils.ts +++ b/lib/routes/nature/utils.ts @@ -1,8 +1,10 @@ +import { load } from 'cheerio'; +import { CookieJar } from 'tough-cookie'; + import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { CookieJar } from 'tough-cookie'; + const baseUrl = 'https://www.nature.com'; const fixFigure = (html) => { diff --git a/lib/routes/nautil/topics.ts b/lib/routes/nautil/topics.ts index b635eb9415..437f8b6e71 100644 --- a/lib/routes/nautil/topics.ts +++ b/lib/routes/nautil/topics.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; + const baseUrl = 'https://nautil.us'; export const route: Route = { diff --git a/lib/routes/nautiljon/manga-releases.ts b/lib/routes/nautiljon/manga-releases.ts index 7eb6974ef3..0a7d65a3c7 100644 --- a/lib/routes/nautiljon/manga-releases.ts +++ b/lib/routes/nautiljon/manga-releases.ts @@ -1,6 +1,7 @@ import { load } from 'cheerio'; + import { config } from '@/config'; -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/nbd/daily.ts b/lib/routes/nbd/daily.ts index 49c554967a..325b645e3d 100644 --- a/lib/routes/nbd/daily.ts +++ b/lib/routes/nbd/daily.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + export const route: Route = { path: '/daily', categories: ['finance'], diff --git a/lib/routes/nbd/index.ts b/lib/routes/nbd/index.ts index 854ce8c4da..4257ea1f73 100644 --- a/lib/routes/nbd/index.ts +++ b/lib/routes/nbd/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/:id?', diff --git a/lib/routes/nber/all.ts b/lib/routes/nber/all.ts index 93c438691e..28fae63342 100644 --- a/lib/routes/nber/all.ts +++ b/lib/routes/nber/all.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { handler } from './common'; export const route: Route = { diff --git a/lib/routes/nber/common.ts b/lib/routes/nber/common.ts index cf4789970d..dc57d5eef5 100644 --- a/lib/routes/nber/common.ts +++ b/lib/routes/nber/common.ts @@ -1,11 +1,13 @@ -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import path from 'node:path'; -import { art } from '@/utils/render'; -import { parseDate } from '@/utils/parse-date'; + +import { load } from 'cheerio'; + import { config } from '@/config'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; async function getData(url) { const response = await ofetch(url); diff --git a/lib/routes/nber/new.ts b/lib/routes/nber/new.ts index 0fe6d061b5..102885a661 100644 --- a/lib/routes/nber/new.ts +++ b/lib/routes/nber/new.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { handler } from './common'; export const route: Route = { diff --git a/lib/routes/ncc-cma/cmdp.ts b/lib/routes/ncc-cma/cmdp.ts index 6f38836c63..2dafbe79fa 100644 --- a/lib/routes/ncc-cma/cmdp.ts +++ b/lib/routes/ncc-cma/cmdp.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import iconv from 'iconv-lite'; export const handler = async (ctx) => { const { id = 'RPJQWQYZ' } = ctx.req.param(); diff --git a/lib/routes/ncepu/master/masterinfo.ts b/lib/routes/ncepu/master/masterinfo.ts index 8e96d26f37..858156bc5a 100644 --- a/lib/routes/ncepu/master/masterinfo.ts +++ b/lib/routes/ncepu/master/masterinfo.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; const title_map = { tzgg: '通知公告', diff --git a/lib/routes/ncku/csie.ts b/lib/routes/ncku/csie.ts index a8178d74af..3278086324 100644 --- a/lib/routes/ncku/csie.ts +++ b/lib/routes/ncku/csie.ts @@ -1,5 +1,7 @@ +import type { CheerioAPI} from 'cheerio'; +import { load } from 'cheerio'; + import type { Route } from '@/types'; -import { CheerioAPI, load } from 'cheerio'; import ofetch from '@/utils/ofetch'; const currentURL = (catagory: string, page: number) => (catagory === '_all' ? `https://www.csie.ncku.edu.tw/zh-hant/news?page=${page}` : `https://www.csie.ncku.edu.tw/zh-hant/news/${catagory}?page=${page}`); diff --git a/lib/routes/ncku/phys.ts b/lib/routes/ncku/phys.ts index 1230d0cd78..dcffc513df 100644 --- a/lib/routes/ncku/phys.ts +++ b/lib/routes/ncku/phys.ts @@ -1,5 +1,7 @@ +import type { CheerioAPI} from 'cheerio'; +import { load } from 'cheerio'; + import type { Route } from '@/types'; -import { CheerioAPI, load } from 'cheerio'; import ofetch from '@/utils/ofetch'; const currentURL = (catagory: string) => `https://phys.ncku.edu.tw/news/${catagory === '_all' ? '' : catagory}`; diff --git a/lib/routes/ncpssd/newlist.ts b/lib/routes/ncpssd/newlist.ts index f90d80c181..8201212a2b 100644 --- a/lib/routes/ncpssd/newlist.ts +++ b/lib/routes/ncpssd/newlist.ts @@ -1,8 +1,9 @@ +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { Route } from '@/types'; export const route: Route = { path: '/newlist', diff --git a/lib/routes/ncu/jwc.ts b/lib/routes/ncu/jwc.ts index 9d03e549f1..7da9318a1e 100644 --- a/lib/routes/ncu/jwc.ts +++ b/lib/routes/ncu/jwc.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; // 自订的 got import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 + +import type { Route } from '@/types'; +import got from '@/utils/got'; // 自订的 got import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ncwu/notice.ts b/lib/routes/ncwu/notice.ts index 09e49c1e85..45477174e0 100644 --- a/lib/routes/ncwu/notice.ts +++ b/lib/routes/ncwu/notice.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; + const baseUrl = 'https://www.ncwu.edu.cn/xxtz.htm'; export const route: Route = { diff --git a/lib/routes/ndss-symposium/ndss.ts b/lib/routes/ndss-symposium/ndss.ts index 598194c6ee..1634bf2253 100644 --- a/lib/routes/ndss-symposium/ndss.ts +++ b/lib/routes/ndss-symposium/ndss.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -const url = 'https://www.ndss-symposium.org'; import { parseDate } from '@/utils/parse-date'; +const url = 'https://www.ndss-symposium.org'; + export const route: Route = { path: '/ndss', categories: ['journal'], diff --git a/lib/routes/neatdownloadmanager/download.ts b/lib/routes/neatdownloadmanager/download.ts index f7bf6b948c..5e6575b77a 100644 --- a/lib/routes/neatdownloadmanager/download.ts +++ b/lib/routes/neatdownloadmanager/download.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/download/:os?', categories: ['program-update'], diff --git a/lib/routes/neea/index.ts b/lib/routes/neea/index.ts index e3245da0e4..5a0c95c59b 100644 --- a/lib/routes/neea/index.ts +++ b/lib/routes/neea/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/neea/jlpt.ts b/lib/routes/neea/jlpt.ts index 27618481e8..c54452e2af 100644 --- a/lib/routes/neea/jlpt.ts +++ b/lib/routes/neea/jlpt.ts @@ -1,13 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/nenu/sohac.ts b/lib/routes/nenu/sohac.ts index 4181dc3353..b9eb34cbf3 100644 --- a/lib/routes/nenu/sohac.ts +++ b/lib/routes/nenu/sohac.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/nenu/yjsy.ts b/lib/routes/nenu/yjsy.ts index 498b96d3e6..8b60a548d2 100644 --- a/lib/routes/nenu/yjsy.ts +++ b/lib/routes/nenu/yjsy.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/netflav/index.ts b/lib/routes/netflav/index.ts index 9951994fdb..d8db0403ec 100644 --- a/lib/routes/netflav/index.ts +++ b/lib/routes/netflav/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/', diff --git a/lib/routes/netflix/newsroom.ts b/lib/routes/netflix/newsroom.ts index 2956719c79..5799099d77 100644 --- a/lib/routes/netflix/newsroom.ts +++ b/lib/routes/netflix/newsroom.ts @@ -1,7 +1,6 @@ -import { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/netflix/research.ts b/lib/routes/netflix/research.ts index 6500ca109f..a398254178 100644 --- a/lib/routes/netflix/research.ts +++ b/lib/routes/netflix/research.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/neu/bmie.ts b/lib/routes/neu/bmie.ts index 1e16b5c6eb..66d8c72436 100644 --- a/lib/routes/neu/bmie.ts +++ b/lib/routes/neu/bmie.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'http://www.bmie.neu.edu.cn'; diff --git a/lib/routes/neu/news.ts b/lib/routes/neu/news.ts index 9948c64d08..62104890f4 100644 --- a/lib/routes/neu/news.ts +++ b/lib/routes/neu/news.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const baseUrl = 'https://neunews.neu.edu.cn'; export const route: Route = { diff --git a/lib/routes/neu/yz.ts b/lib/routes/neu/yz.ts index b0811e4ae9..3bfb13a484 100644 --- a/lib/routes/neu/yz.ts +++ b/lib/routes/neu/yz.ts @@ -1,7 +1,8 @@ -import { DataItem, Route } from '@/types'; +import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/newmuseum/exhibitions.ts b/lib/routes/newmuseum/exhibitions.ts index c72aded67f..975dac84a5 100644 --- a/lib/routes/newmuseum/exhibitions.ts +++ b/lib/routes/newmuseum/exhibitions.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import buildData from '@/utils/common-config'; export const route: Route = { diff --git a/lib/routes/newrank/douyin.ts b/lib/routes/newrank/douyin.ts index 6e799e77e5..f6692be1df 100644 --- a/lib/routes/newrank/douyin.ts +++ b/lib/routes/newrank/douyin.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import utils from './utils'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import utils from './utils'; export const route: Route = { path: '/douyin/:dyid', diff --git a/lib/routes/newrank/utils.ts b/lib/routes/newrank/utils.ts index 6abdf1169a..1a5f093153 100644 --- a/lib/routes/newrank/utils.ts +++ b/lib/routes/newrank/utils.ts @@ -1,7 +1,8 @@ -import cache from '@/utils/cache'; -import md5 from '@/utils/md5'; -import got from '@/utils/got'; import { config } from '@/config'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import md5 from '@/utils/md5'; + const newrank_cookie_token = 'newrank_cookie_token'; const query_count = 'newrank_cookie_count'; const max_query_count = 30; diff --git a/lib/routes/newrank/wechat.ts b/lib/routes/newrank/wechat.ts index a87822aef7..9704e6860d 100644 --- a/lib/routes/newrank/wechat.ts +++ b/lib/routes/newrank/wechat.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import { finishArticleItem } from '@/utils/wechat-mp'; import { load } from 'cheerio'; -import utils from './utils'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { finishArticleItem } from '@/utils/wechat-mp'; + +import utils from './utils'; export const route: Route = { path: '/wechat/:wxid', diff --git a/lib/routes/news/xhsxw.ts b/lib/routes/news/xhsxw.ts index bc80aee0e9..85d7a074c9 100644 --- a/lib/routes/news/xhsxw.ts +++ b/lib/routes/news/xhsxw.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: ['/xhsxw', '/whxw'], diff --git a/lib/routes/newseed/index.ts b/lib/routes/newseed/index.ts index 03b4906d61..9e3c79af92 100644 --- a/lib/routes/newseed/index.ts +++ b/lib/routes/newseed/index.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/latest', diff --git a/lib/routes/newslaundry/explainer.ts b/lib/routes/newslaundry/explainer.ts index dfa4f3bddd..5cc2240ab9 100644 --- a/lib/routes/newslaundry/explainer.ts +++ b/lib/routes/newslaundry/explainer.ts @@ -1,4 +1,6 @@ -import { Data, Route, ViewType } from '@/types'; +import type { Data, Route} from '@/types'; +import { ViewType } from '@/types'; + import { fetchCollection, rootUrl } from './utils'; export const route: Route = { diff --git a/lib/routes/newslaundry/nl-cheatsheet.ts b/lib/routes/newslaundry/nl-cheatsheet.ts index 416dfb72d2..bff21586d7 100644 --- a/lib/routes/newslaundry/nl-cheatsheet.ts +++ b/lib/routes/newslaundry/nl-cheatsheet.ts @@ -1,4 +1,6 @@ -import { Data, Route, ViewType } from '@/types'; +import type { Data, Route} from '@/types'; +import { ViewType } from '@/types'; + import { fetchCollection, rootUrl } from './utils'; export const route: Route = { diff --git a/lib/routes/newslaundry/nl-collaborations.ts b/lib/routes/newslaundry/nl-collaborations.ts index 7c661b0b8f..6c453641ed 100644 --- a/lib/routes/newslaundry/nl-collaborations.ts +++ b/lib/routes/newslaundry/nl-collaborations.ts @@ -1,4 +1,6 @@ -import { Data, Route, ViewType } from '@/types'; +import type { Data, Route} from '@/types'; +import { ViewType } from '@/types'; + import { fetchCollection, rootUrl } from './utils'; export const route: Route = { diff --git a/lib/routes/newslaundry/podcast.ts b/lib/routes/newslaundry/podcast.ts index fa6422de58..85ea43e90d 100644 --- a/lib/routes/newslaundry/podcast.ts +++ b/lib/routes/newslaundry/podcast.ts @@ -1,4 +1,6 @@ -import { Data, Route, ViewType } from '@/types'; +import type { Data, Route} from '@/types'; +import { ViewType } from '@/types'; + import { fetchCollection, rootUrl } from './utils'; export const route: Route = { diff --git a/lib/routes/newslaundry/reports.ts b/lib/routes/newslaundry/reports.ts index f0d9e59bff..7906f519c0 100644 --- a/lib/routes/newslaundry/reports.ts +++ b/lib/routes/newslaundry/reports.ts @@ -1,4 +1,6 @@ -import { Data, Route, ViewType } from '@/types'; +import type { Data, Route} from '@/types'; +import { ViewType } from '@/types'; + import { fetchCollection } from './utils'; export const route: Route = { diff --git a/lib/routes/newslaundry/shot.ts b/lib/routes/newslaundry/shot.ts index b25943a55d..44be2aff07 100644 --- a/lib/routes/newslaundry/shot.ts +++ b/lib/routes/newslaundry/shot.ts @@ -1,4 +1,6 @@ -import { Data, Route, ViewType } from '@/types'; +import type { Data, Route} from '@/types'; +import { ViewType } from '@/types'; + import { fetchCollection } from './utils'; export const route: Route = { diff --git a/lib/routes/newslaundry/subscriber-only.ts b/lib/routes/newslaundry/subscriber-only.ts index 3218cffa4b..f0c815fff7 100644 --- a/lib/routes/newslaundry/subscriber-only.ts +++ b/lib/routes/newslaundry/subscriber-only.ts @@ -1,4 +1,6 @@ -import { Data, Route, ViewType } from '@/types'; +import type { Data, Route} from '@/types'; +import { ViewType } from '@/types'; + import { fetchCollection } from './utils'; export const route: Route = { diff --git a/lib/routes/newslaundry/utils.ts b/lib/routes/newslaundry/utils.ts index 479e7db31f..c8843657b4 100644 --- a/lib/routes/newslaundry/utils.ts +++ b/lib/routes/newslaundry/utils.ts @@ -1,8 +1,9 @@ -import { Data, DataItem } from '@/types'; +import path from 'node:path'; + +import type { Data, DataItem } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const rootUrl = 'https://www.newslaundry.com'; diff --git a/lib/routes/newsmarket/index.ts b/lib/routes/newsmarket/index.ts index a8625c6280..835502b069 100644 --- a/lib/routes/newsmarket/index.ts +++ b/lib/routes/newsmarket/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/newswav/latest.ts b/lib/routes/newswav/latest.ts index 954024ce4b..f0a35072e6 100644 --- a/lib/routes/newswav/latest.ts +++ b/lib/routes/newswav/latest.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/newyorker/news.ts b/lib/routes/newyorker/news.ts index 57bfb9e585..b567817880 100644 --- a/lib/routes/newyorker/news.ts +++ b/lib/routes/newyorker/news.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; const host = 'https://www.newyorker.com'; export const route: Route = { diff --git a/lib/routes/newzmz/index.ts b/lib/routes/newzmz/index.ts index 6473393593..30aad5800b 100644 --- a/lib/routes/newzmz/index.ts +++ b/lib/routes/newzmz/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { rootUrl, getItems, getItemInfo, processItems } from './util'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + +import { getItemInfo, getItems, processItems, rootUrl } from './util'; export const route: Route = { path: '/:id?/:downLinkType?', diff --git a/lib/routes/newzmz/util.ts b/lib/routes/newzmz/util.ts index a8fadfe2b4..8dfc1405c4 100644 --- a/lib/routes/newzmz/util.ts +++ b/lib/routes/newzmz/util.ts @@ -1,8 +1,10 @@ -import got from '@/utils/got'; +import path from 'node:path'; + import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const rootUrl = 'https://nzmz.xyz'; @@ -157,4 +159,4 @@ const processItems = async (i, downLinkType, itemSelector, categorySelector, dow }); }; -export { rootUrl, getItems, getItemInfo, processItems }; +export { getItemInfo, getItems, processItems, rootUrl }; diff --git a/lib/routes/nextapple/realtime.ts b/lib/routes/nextapple/realtime.ts index 607268152b..281789c1f2 100644 --- a/lib/routes/nextapple/realtime.ts +++ b/lib/routes/nextapple/realtime.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import pMap from 'p-map'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; -import pMap from 'p-map'; export const route: Route = { path: '/realtime/:category?', diff --git a/lib/routes/nextjs/blog.ts b/lib/routes/nextjs/blog.ts index 00b5c6ffe9..2bf401cb30 100644 --- a/lib/routes/nextjs/blog.ts +++ b/lib/routes/nextjs/blog.ts @@ -1,8 +1,9 @@ -import type { DataItem, Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; const handler: Route['handler'] = async () => { const data = await ofetch('https://nextjs.org/blog'); diff --git a/lib/routes/nga/forum.ts b/lib/routes/nga/forum.ts index 25db7eb0e7..9588c7fa05 100644 --- a/lib/routes/nga/forum.ts +++ b/lib/routes/nga/forum.ts @@ -1,7 +1,8 @@ -import { Route, ViewType } from '@/types'; +import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { config } from '@/config'; import { parseDate } from '@/utils/parse-date'; const X_UA = 'NGA_skull/6.0.5(iPhone10,3;iOS 12.0.1)'; diff --git a/lib/routes/nga/post.ts b/lib/routes/nga/post.ts index ae4dd72af1..6f0a7782f2 100644 --- a/lib/routes/nga/post.ts +++ b/lib/routes/nga/post.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; + +import { config } from '@/config'; +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { config } from '@/config'; export const route: Route = { path: '/post/:tid/:authorId?', diff --git a/lib/routes/ngocn2/index.ts b/lib/routes/ngocn2/index.ts index 1741c30ff2..7a1ea58190 100644 --- a/lib/routes/ngocn2/index.ts +++ b/lib/routes/ngocn2/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/nhentai/index.ts b/lib/routes/nhentai/index.ts index 3464c5ef88..043f0fe107 100644 --- a/lib/routes/nhentai/index.ts +++ b/lib/routes/nhentai/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import { getSimple, getDetails, getTorrents } from './util'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; + +import { getDetails, getSimple, getTorrents } from './util'; const supportedKeys = new Set(['parody', 'character', 'tag', 'artist', 'group', 'language', 'category']); diff --git a/lib/routes/nhentai/search.ts b/lib/routes/nhentai/search.ts index 7e17a50fa2..9d354e225a 100644 --- a/lib/routes/nhentai/search.ts +++ b/lib/routes/nhentai/search.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { getSimple, getDetails, getTorrents } from './util'; + +import { getDetails, getSimple, getTorrents } from './util'; export const route: Route = { path: '/search/:keyword/:mode?', diff --git a/lib/routes/nhentai/util.ts b/lib/routes/nhentai/util.ts index 6c068b9225..3bd5d9bb4f 100644 --- a/lib/routes/nhentai/util.ts +++ b/lib/routes/nhentai/util.ts @@ -1,11 +1,13 @@ +import path from 'node:path'; + import { load } from 'cheerio'; + +import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; import got from '@/utils/got'; import ofetch from '@/utils/ofetch'; -import { config } from '@/config'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; const baseUrl = 'https://nhentai.net'; @@ -145,4 +147,4 @@ const getDetail = async (simple) => { }; }; -export { baseUrl, getSimple, getDetails, getTorrents }; +export { baseUrl, getDetails, getSimple, getTorrents }; diff --git a/lib/routes/nhk/news-web-easy.ts b/lib/routes/nhk/news-web-easy.ts index ba642e19f9..da6912faa1 100644 --- a/lib/routes/nhk/news-web-easy.ts +++ b/lib/routes/nhk/news-web-easy.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/news_web_easy', diff --git a/lib/routes/nhk/news.ts b/lib/routes/nhk/news.ts index cc33dcb891..4c5be8d30c 100644 --- a/lib/routes/nhk/news.ts +++ b/lib/routes/nhk/news.ts @@ -1,10 +1,12 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; + const baseUrl = 'https://www3.nhk.or.jp'; const apiUrl = 'https://api.nhkworld.jp'; diff --git a/lib/routes/niaogebiji/cat.ts b/lib/routes/niaogebiji/cat.ts index 0058f059b7..a6e1e6e694 100644 --- a/lib/routes/niaogebiji/cat.ts +++ b/lib/routes/niaogebiji/cat.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/niaogebiji/index.ts b/lib/routes/niaogebiji/index.ts index ded707e0bc..121418e7ea 100644 --- a/lib/routes/niaogebiji/index.ts +++ b/lib/routes/niaogebiji/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/niaogebiji/today.ts b/lib/routes/niaogebiji/today.ts index 5f6e02c334..c5d8175e4b 100644 --- a/lib/routes/niaogebiji/today.ts +++ b/lib/routes/niaogebiji/today.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/nicovideo/mylist.ts b/lib/routes/nicovideo/mylist.ts index 2b47b8d372..6dd697e94e 100644 --- a/lib/routes/nicovideo/mylist.ts +++ b/lib/routes/nicovideo/mylist.ts @@ -1,7 +1,7 @@ -import { DataItem, Route } from '@/types'; +import type { DataItem, Route } from '@/types'; +import { parseDate } from '@/utils/parse-date'; import { getMylist, renderVideo } from './utils'; -import { parseDate } from '@/utils/parse-date'; export const route: Route = { name: 'Mylist', diff --git a/lib/routes/nicovideo/utils.ts b/lib/routes/nicovideo/utils.ts index 2761ebc9e6..d23fe8ae08 100644 --- a/lib/routes/nicovideo/utils.ts +++ b/lib/routes/nicovideo/utils.ts @@ -1,11 +1,12 @@ -import { Essential, Mylist, UserInfo, VideoItem } from './types'; - -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; -import { config } from '@/config'; import path from 'node:path'; + +import { config } from '@/config'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { art } from '@/utils/render'; +import type { Essential, Mylist, UserInfo, VideoItem } from './types'; + export const getUserInfoById = (id: string) => cache.tryGet(`nicovideo:user:${id}`, () => ofetch(`https://embed.nicovideo.jp/users/${id}`)) as Promise; export const getUserVideosById = (id: string) => diff --git a/lib/routes/nicovideo/video.ts b/lib/routes/nicovideo/video.ts index d09959386f..80184d3fd5 100644 --- a/lib/routes/nicovideo/video.ts +++ b/lib/routes/nicovideo/video.ts @@ -1,8 +1,9 @@ import type { Context } from 'hono'; -import { DataItem, Route } from '@/types'; -import { UserInfo, VideoItem } from './types'; +import type { DataItem, Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; + +import type { UserInfo, VideoItem } from './types'; import { getUserInfoById, getUserVideosById, renderVideo } from './utils'; const handler = async (ctx: Context) => { diff --git a/lib/routes/nielsberglund/index.ts b/lib/routes/nielsberglund/index.ts index 5f4122948a..0ffab274e5 100644 --- a/lib/routes/nielsberglund/index.ts +++ b/lib/routes/nielsberglund/index.ts @@ -1,8 +1,9 @@ -import { Route, DataItem } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/blog', diff --git a/lib/routes/nifd/research.ts b/lib/routes/nifd/research.ts index 9759210eb3..cbd28b540e 100644 --- a/lib/routes/nifd/research.ts +++ b/lib/routes/nifd/research.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootUrl = 'http://www.nifd.cn'; diff --git a/lib/routes/nikkei/asia/index.ts b/lib/routes/nikkei/asia/index.ts index 0c705551fd..90209de9ce 100644 --- a/lib/routes/nikkei/asia/index.ts +++ b/lib/routes/nikkei/asia/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/nikkei/cn/index.ts b/lib/routes/nikkei/cn/index.ts index 8b6bc4f2ee..4489347f71 100644 --- a/lib/routes/nikkei/cn/index.ts +++ b/lib/routes/nikkei/cn/index.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; -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 { config } from '@/config'; import Parser from 'rss-parser'; +import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; + const parser = new Parser({ customFields: { item: ['magnet'], diff --git a/lib/routes/nikkei/index.ts b/lib/routes/nikkei/index.ts index ae0cb2f576..d031da259e 100644 --- a/lib/routes/nikkei/index.ts +++ b/lib/routes/nikkei/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/index', name: 'Home', diff --git a/lib/routes/nikkei/news.ts b/lib/routes/nikkei/news.ts index 5b5fed3243..a1415723d7 100644 --- a/lib/routes/nikkei/news.ts +++ b/lib/routes/nikkei/news.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/news/:category/:article_type?', diff --git a/lib/routes/nintendo/direct.ts b/lib/routes/nintendo/direct.ts index 587d71edd1..f725c3d9cb 100644 --- a/lib/routes/nintendo/direct.ts +++ b/lib/routes/nintendo/direct.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/direct', diff --git a/lib/routes/nintendo/eshop-cn.ts b/lib/routes/nintendo/eshop-cn.ts index 1ad97ada38..cebe08c06b 100644 --- a/lib/routes/nintendo/eshop-cn.ts +++ b/lib/routes/nintendo/eshop-cn.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import util from './utils'; -const software_url = 'https://www.nintendoswitch.com.cn/software/'; import { parseDate } from '@/utils/parse-date'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; + +import util from './utils'; + +const software_url = 'https://www.nintendoswitch.com.cn/software/'; export const route: Route = { path: '/eshop/cn', diff --git a/lib/routes/nintendo/eshop-hk.ts b/lib/routes/nintendo/eshop-hk.ts index 3c11663015..5a34d4d530 100644 --- a/lib/routes/nintendo/eshop-hk.ts +++ b/lib/routes/nintendo/eshop-hk.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/eshop/hk', diff --git a/lib/routes/nintendo/eshop-jp.ts b/lib/routes/nintendo/eshop-jp.ts index 70e85451e9..fe5d94e0ff 100644 --- a/lib/routes/nintendo/eshop-jp.ts +++ b/lib/routes/nintendo/eshop-jp.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/eshop/jp', diff --git a/lib/routes/nintendo/eshop-us.ts b/lib/routes/nintendo/eshop-us.ts index 322ff668bb..24665098dc 100644 --- a/lib/routes/nintendo/eshop-us.ts +++ b/lib/routes/nintendo/eshop-us.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; - -import { art } from '@/utils/render'; -import got from '@/utils/got'; import path from 'node:path'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + export const route: Route = { path: '/eshop/us', radar: [ diff --git a/lib/routes/nintendo/news-china.ts b/lib/routes/nintendo/news-china.ts index ba30267ffe..45c4a42c48 100644 --- a/lib/routes/nintendo/news-china.ts +++ b/lib/routes/nintendo/news-china.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; + import util from './utils'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; + const news_url = 'https://www.nintendoswitch.com.cn'; export const route: Route = { diff --git a/lib/routes/nintendo/news.ts b/lib/routes/nintendo/news.ts index 49169ce9a1..f45071df32 100644 --- a/lib/routes/nintendo/news.ts +++ b/lib/routes/nintendo/news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import util from './utils'; import { parseDate } from '@/utils/parse-date'; +import util from './utils'; + export const route: Route = { path: '/news', categories: ['game'], diff --git a/lib/routes/nintendo/system-update.ts b/lib/routes/nintendo/system-update.ts index dff78f7535..c4fdb27667 100644 --- a/lib/routes/nintendo/system-update.ts +++ b/lib/routes/nintendo/system-update.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/system-update', categories: ['game'], diff --git a/lib/routes/nintendo/utils.ts b/lib/routes/nintendo/utils.ts index 8d87323d04..c05e4222b7 100644 --- a/lib/routes/nintendo/utils.ts +++ b/lib/routes/nintendo/utils.ts @@ -1,12 +1,16 @@ -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { JSDOM } from 'jsdom'; -import { parseDate } from '@/utils/parse-date'; -import { art } from '@/utils/render'; +import 'dayjs/locale/zh-cn.js'; + import path from 'node:path'; + +import { load } from 'cheerio'; import dayjs from 'dayjs'; import localizedFormat from 'dayjs/plugin/localizedFormat.js'; -import 'dayjs/locale/zh-cn.js'; +import { JSDOM } from 'jsdom'; + +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + dayjs.extend(localizedFormat); function nuxtReader(data) { diff --git a/lib/routes/nio/nioradio.ts b/lib/routes/nio/nioradio.ts index 4c03173d37..1adc7c38f0 100644 --- a/lib/routes/nio/nioradio.ts +++ b/lib/routes/nio/nioradio.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { URLSearchParams } from 'node:url'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { URLSearchParams } from 'node:url'; export const route: Route = { path: '/nioradio/:albumid', diff --git a/lib/routes/nippon/index.ts b/lib/routes/nippon/index.ts index f66fe927f3..7b0db2dfd7 100644 --- a/lib/routes/nippon/index.ts +++ b/lib/routes/nippon/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/njglyy/utils/index.ts b/lib/routes/njglyy/utils/index.ts index 0aef709feb..1dbb4d81e4 100644 --- a/lib/routes/njglyy/utils/index.ts +++ b/lib/routes/njglyy/utils/index.ts @@ -1,6 +1,7 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/njglyy/ygbjypx.ts b/lib/routes/njglyy/ygbjypx.ts index 7c758b35c4..3c752dcd05 100644 --- a/lib/routes/njglyy/ygbjypx.ts +++ b/lib/routes/njglyy/ygbjypx.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { getNoticeList } from './utils'; const url = 'https://njglyy.com/ygb/jypx/jypx.aspx'; diff --git a/lib/routes/njit/jwc.ts b/lib/routes/njit/jwc.ts index 9ac34831e6..f1e1656be2 100644 --- a/lib/routes/njit/jwc.ts +++ b/lib/routes/njit/jwc.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const host = 'https://jwc.njit.edu.cn'; diff --git a/lib/routes/njit/tzgg.ts b/lib/routes/njit/tzgg.ts index 875110559e..66a7ef61dc 100644 --- a/lib/routes/njit/tzgg.ts +++ b/lib/routes/njit/tzgg.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const url = 'https://www.njit.edu.cn/index/tzgg.htm'; diff --git a/lib/routes/njnu/ceai/ceai.ts b/lib/routes/njnu/ceai/ceai.ts index a7f1812967..fc9b6af101 100644 --- a/lib/routes/njnu/ceai/ceai.ts +++ b/lib/routes/njnu/ceai/ceai.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import util from './utils'; export const route: Route = { diff --git a/lib/routes/njnu/ceai/utils.ts b/lib/routes/njnu/ceai/utils.ts index 33f931a154..06aad5b0c1 100644 --- a/lib/routes/njnu/ceai/utils.ts +++ b/lib/routes/njnu/ceai/utils.ts @@ -1,5 +1,6 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/njnu/jwc/jwc.ts b/lib/routes/njnu/jwc/jwc.ts index e43b68f41c..63141e6bcd 100644 --- a/lib/routes/njnu/jwc/jwc.ts +++ b/lib/routes/njnu/jwc/jwc.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import { ProcessFeed } from './utils'; export const route: Route = { diff --git a/lib/routes/njnu/jwc/utils.ts b/lib/routes/njnu/jwc/utils.ts index 86eba25e3a..d727ed95e7 100644 --- a/lib/routes/njnu/jwc/utils.ts +++ b/lib/routes/njnu/jwc/utils.ts @@ -1,5 +1,6 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/nju/admission.ts b/lib/routes/nju/admission.ts index dcf9e1e243..4fecc0a4a1 100644 --- a/lib/routes/nju/admission.ts +++ b/lib/routes/nju/admission.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/nju/dafls.ts b/lib/routes/nju/dafls.ts index 57b4faa523..3b188f0f7e 100644 --- a/lib/routes/nju/dafls.ts +++ b/lib/routes/nju/dafls.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/nju/exchangesys.ts b/lib/routes/nju/exchangesys.ts index 8583be71bf..f4a2d2c744 100644 --- a/lib/routes/nju/exchangesys.ts +++ b/lib/routes/nju/exchangesys.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import dayjs from 'dayjs'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/exchangesys/:type', categories: ['university'], diff --git a/lib/routes/nju/gra.ts b/lib/routes/nju/gra.ts index 731b788f84..5fbfe5d38f 100644 --- a/lib/routes/nju/gra.ts +++ b/lib/routes/nju/gra.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/nju/hosptial.ts b/lib/routes/nju/hosptial.ts index 3b244217fe..c8b20e757d 100644 --- a/lib/routes/nju/hosptial.ts +++ b/lib/routes/nju/hosptial.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/nju/hqjt.ts b/lib/routes/nju/hqjt.ts index dc3bdad104..3b7dd8c103 100644 --- a/lib/routes/nju/hqjt.ts +++ b/lib/routes/nju/hqjt.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/nju/itsc.ts b/lib/routes/nju/itsc.ts index 4b9d7661d3..fa280aa45a 100644 --- a/lib/routes/nju/itsc.ts +++ b/lib/routes/nju/itsc.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/nju/jjc.ts b/lib/routes/nju/jjc.ts index 6d29f0424e..8e33e83806 100644 --- a/lib/routes/nju/jjc.ts +++ b/lib/routes/nju/jjc.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/nju/jw.ts b/lib/routes/nju/jw.ts index c5f200ce28..aeb43cd902 100644 --- a/lib/routes/nju/jw.ts +++ b/lib/routes/nju/jw.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import queryString from 'query-string'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import queryString from 'query-string'; export const route: Route = { path: '/jw/:type', diff --git a/lib/routes/nju/rczp.ts b/lib/routes/nju/rczp.ts index 74f3762e5d..5260cade69 100644 --- a/lib/routes/nju/rczp.ts +++ b/lib/routes/nju/rczp.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; export const route: Route = { path: '/rczp/:type', diff --git a/lib/routes/nju/scit.ts b/lib/routes/nju/scit.ts index 8665db7569..99290a5e61 100644 --- a/lib/routes/nju/scit.ts +++ b/lib/routes/nju/scit.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/nju/zbb.ts b/lib/routes/nju/zbb.ts index f717d601b8..cf3a1e7072 100644 --- a/lib/routes/nju/zbb.ts +++ b/lib/routes/nju/zbb.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/nju/zcc.ts b/lib/routes/nju/zcc.ts index 4937a6e90f..96a7043a07 100644 --- a/lib/routes/nju/zcc.ts +++ b/lib/routes/nju/zcc.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + export const route: Route = { path: '/zcc', categories: ['university'], diff --git a/lib/routes/njucm/grabs.ts b/lib/routes/njucm/grabs.ts index f87fa8e473..d9b2271eb1 100644 --- a/lib/routes/njucm/grabs.ts +++ b/lib/routes/njucm/grabs.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { getNoticeList } from './utils'; const url = 'https://gra.njucm.edu.cn/2899/list.htm'; diff --git a/lib/routes/njucm/utils/index.ts b/lib/routes/njucm/utils/index.ts index 80ab76af49..2b10053e09 100644 --- a/lib/routes/njucm/utils/index.ts +++ b/lib/routes/njucm/utils/index.ts @@ -1,6 +1,7 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/njuferret/blog.ts b/lib/routes/njuferret/blog.ts index 1014f6515f..2dc1e01931 100644 --- a/lib/routes/njuferret/blog.ts +++ b/lib/routes/njuferret/blog.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/njupt/jwc.ts b/lib/routes/njupt/jwc.ts index 385e6df19d..bc14d79c1b 100644 --- a/lib/routes/njupt/jwc.ts +++ b/lib/routes/njupt/jwc.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const host = 'https://jwc.njupt.edu.cn'; diff --git a/lib/routes/njust/cs.ts b/lib/routes/njust/cs.ts index 69de3542cb..da5346ad8b 100644 --- a/lib/routes/njust/cs.ts +++ b/lib/routes/njust/cs.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { getContent } from './utils'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const map = new Map([ ['xyxw', { title: '南京理工大学计算机学院 -- 学院新闻', id: '/1817' }], diff --git a/lib/routes/njust/cwc.ts b/lib/routes/njust/cwc.ts index 45ac542c37..075847a7ce 100644 --- a/lib/routes/njust/cwc.ts +++ b/lib/routes/njust/cwc.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { getContent } from './utils'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const map = new Map([ ['tzgg', { title: '南京理工大学财务处 -- 通知公告', id: '/12432' }], diff --git a/lib/routes/njust/dgxg.ts b/lib/routes/njust/dgxg.ts index f5db81b536..df18fe8cbe 100644 --- a/lib/routes/njust/dgxg.ts +++ b/lib/routes/njust/dgxg.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { getContent } from './utils'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const map = new Map([ ['gstz', { title: '南京理工大学电光学院研学网 -- 公示通知', id: '/6509' }], diff --git a/lib/routes/njust/eo.ts b/lib/routes/njust/eo.ts index 828ad5e455..7031f84d4c 100644 --- a/lib/routes/njust/eo.ts +++ b/lib/routes/njust/eo.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { getContent } from './utils'; const map = new Map([ diff --git a/lib/routes/njust/eoe.ts b/lib/routes/njust/eoe.ts index 7f7771a98b..3d82276983 100644 --- a/lib/routes/njust/eoe.ts +++ b/lib/routes/njust/eoe.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { getContent } from './utils'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const map = new Map([ ['tzgg', { title: '南京理工大学电子工程与光电技术学院 -- 通知公告', id: '/1920' }], diff --git a/lib/routes/njust/gs.ts b/lib/routes/njust/gs.ts index 40fd55027f..5e430eb92b 100644 --- a/lib/routes/njust/gs.ts +++ b/lib/routes/njust/gs.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { getContent } from './utils'; const host = 'https://gs.njust.edu.cn'; diff --git a/lib/routes/njust/jwc.ts b/lib/routes/njust/jwc.ts index 1df1697cea..a177220028 100644 --- a/lib/routes/njust/jwc.ts +++ b/lib/routes/njust/jwc.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { getContent } from './utils'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const map = new Map([ ['jstz', { title: '南京理工大学教务处 -- 教师通知', id: '/1216' }], diff --git a/lib/routes/njxzc/home.ts b/lib/routes/njxzc/home.ts index edccce1f35..5975c6f22c 100644 --- a/lib/routes/njxzc/home.ts +++ b/lib/routes/njxzc/home.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { getNoticeList } from './utils'; const url = 'https://www.njxzc.edu.cn/89/list.htm'; diff --git a/lib/routes/njxzc/lib.ts b/lib/routes/njxzc/lib.ts index 962e5ff6b4..986c176597 100644 --- a/lib/routes/njxzc/lib.ts +++ b/lib/routes/njxzc/lib.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { getNoticeList } from './utils'; const url = 'https://lib.njxzc.edu.cn/pxyhd/list.htm'; diff --git a/lib/routes/njxzc/utils/index.ts b/lib/routes/njxzc/utils/index.ts index cd75ff25fe..0d2cdeeb53 100644 --- a/lib/routes/njxzc/utils/index.ts +++ b/lib/routes/njxzc/utils/index.ts @@ -1,8 +1,9 @@ -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; // 使用默认导出的方式导入ofetch import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import ofetch from '@/utils/ofetch'; // 使用默认导出的方式导入ofetch async function getNoticeList(ctx, url, host, titleSelector, dateSelector, contentSelector, listSelector) { const response = await ofetch(url); diff --git a/lib/routes/nlc/read.ts b/lib/routes/nlc/read.ts index 1e4483211d..1a63b960b5 100644 --- a/lib/routes/nlc/read.ts +++ b/lib/routes/nlc/read.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + export const route: Route = { path: '/read/:type?', categories: ['other'], diff --git a/lib/routes/nltimes/news.ts b/lib/routes/nltimes/news.ts index 0d361183ee..7bb18f0b30 100644 --- a/lib/routes/nltimes/news.ts +++ b/lib/routes/nltimes/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/nmc/weatheralarm.ts b/lib/routes/nmc/weatheralarm.ts index e568606b40..61d9e58f0b 100644 --- a/lib/routes/nmc/weatheralarm.ts +++ b/lib/routes/nmc/weatheralarm.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import * as cheerio from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import * as cheerio from 'cheerio'; export const route: Route = { path: '/weatheralarm/:province?', diff --git a/lib/routes/nmtv/column.ts b/lib/routes/nmtv/column.ts index 8545e979bf..4a23a2cda3 100644 --- a/lib/routes/nmtv/column.ts +++ b/lib/routes/nmtv/column.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/column/:id?', diff --git a/lib/routes/nodejs/blog.ts b/lib/routes/nodejs/blog.ts index 54b5340d13..15ddf85826 100644 --- a/lib/routes/nodejs/blog.ts +++ b/lib/routes/nodejs/blog.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/nogizaka46/blog.ts b/lib/routes/nogizaka46/blog.ts index 1d42cad8c7..394a81c371 100644 --- a/lib/routes/nogizaka46/blog.ts +++ b/lib/routes/nogizaka46/blog.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/nogizaka46/news.ts b/lib/routes/nogizaka46/news.ts index e145302aeb..e6c80ae5ce 100644 --- a/lib/routes/nogizaka46/news.ts +++ b/lib/routes/nogizaka46/news.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/nosec/index.ts b/lib/routes/nosec/index.ts index 4b69098a53..75751dac4c 100644 --- a/lib/routes/nosec/index.ts +++ b/lib/routes/nosec/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; const baseUrl = 'https://nosec.org/home/ajaxindexdata'; const keykinds = { diff --git a/lib/routes/notateslaapp/update.ts b/lib/routes/notateslaapp/update.ts index 8d76ce1990..fb3c17c5dd 100644 --- a/lib/routes/notateslaapp/update.ts +++ b/lib/routes/notateslaapp/update.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/ota', categories: ['program-update'], diff --git a/lib/routes/notefolio/search.ts b/lib/routes/notefolio/search.ts index 8e5e3afba4..b041a7ec32 100644 --- a/lib/routes/notefolio/search.ts +++ b/lib/routes/notefolio/search.ts @@ -1,10 +1,12 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import dayjs from 'dayjs'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; // 导入所需模组 import got from '@/utils/got'; // 自订的 got import { parseDate } from '@/utils/parse-date'; -import dayjs from 'dayjs'; -import path from 'node:path'; import { art } from '@/utils/render'; // 分类 diff --git a/lib/routes/notion/database.ts b/lib/routes/notion/database.ts index cd83c0753a..5ab8597c96 100644 --- a/lib/routes/notion/database.ts +++ b/lib/routes/notion/database.ts @@ -1,15 +1,17 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import { Client, isNotionClientError, APIErrorCode } from '@notionhq/client'; -import logger from '@/utils/logger'; -import { config } from '@/config'; -import { parseDate } from '@/utils/parse-date'; -import got from '@/utils/got'; -import { NotionToMarkdown } from 'notion-to-md'; +import { APIErrorCode, Client, isNotionClientError } from '@notionhq/client'; import { load } from 'cheerio'; import MarkdownIt from 'markdown-it'; +import { NotionToMarkdown } from 'notion-to-md'; + +import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import logger from '@/utils/logger'; +import { parseDate } from '@/utils/parse-date'; + const md = MarkdownIt({ html: true, linkify: true, diff --git a/lib/routes/notion/release.ts b/lib/routes/notion/release.ts index 840afbc68b..06324cb84e 100644 --- a/lib/routes/notion/release.ts +++ b/lib/routes/notion/release.ts @@ -1,9 +1,10 @@ -import type { DataItem, Route } from '@/types'; import { load } from 'cheerio'; +import day from 'dayjs'; + +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import cache from '@/utils/cache'; -import day from 'dayjs'; const handler: Route['handler'] = async () => { const data = await ofetch('https://notion.so/releases', { diff --git a/lib/routes/now/news.ts b/lib/routes/now/news.ts index 7d306c6ae9..916c30f993 100644 --- a/lib/routes/now/news.ts +++ b/lib/routes/now/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const mainCategories = { diff --git a/lib/routes/nowcoder/discuss.ts b/lib/routes/nowcoder/discuss.ts index 9bfe9cede8..458af09267 100644 --- a/lib/routes/nowcoder/discuss.ts +++ b/lib/routes/nowcoder/discuss.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/nowcoder/experience.ts b/lib/routes/nowcoder/experience.ts index 68f3f28275..b44e74726e 100644 --- a/lib/routes/nowcoder/experience.ts +++ b/lib/routes/nowcoder/experience.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/nowcoder/jobcenter.ts b/lib/routes/nowcoder/jobcenter.ts index 8571e9cc17..b075446808 100644 --- a/lib/routes/nowcoder/jobcenter.ts +++ b/lib/routes/nowcoder/jobcenter.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import * as url from 'node:url'; -import got from '@/utils/got'; + import { load } from 'cheerio'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + export const route: Route = { path: '/jobcenter/:recruitType?/:city?/:type?/:order?/:latest?', categories: ['bbs'], diff --git a/lib/routes/nowcoder/recommend.ts b/lib/routes/nowcoder/recommend.ts index ffcd0ea14a..267f3403da 100644 --- a/lib/routes/nowcoder/recommend.ts +++ b/lib/routes/nowcoder/recommend.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/nowcoder/schedule.ts b/lib/routes/nowcoder/schedule.ts index f392d5d199..fa67bc84e8 100644 --- a/lib/routes/nowcoder/schedule.ts +++ b/lib/routes/nowcoder/schedule.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/npm/package.ts b/lib/routes/npm/package.ts index 15b3f1b4ae..6afb0fc577 100644 --- a/lib/routes/npm/package.ts +++ b/lib/routes/npm/package.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/package/:name{(@[a-z0-9-~][a-z0-9-._~]*/)?[a-z0-9-~][a-z0-9-._~]*}', diff --git a/lib/routes/npr/full.ts b/lib/routes/npr/full.ts index 700399c9c6..0cbdb2cf07 100644 --- a/lib/routes/npr/full.ts +++ b/lib/routes/npr/full.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import parser from '@/utils/rss-parser'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import parser from '@/utils/rss-parser'; + const getArticleDetail = (link) => cache.tryGet(link, async () => { const response = await got(link); diff --git a/lib/routes/ntdm/video.ts b/lib/routes/ntdm/video.ts index 53188ffc4d..13c3e19852 100644 --- a/lib/routes/ntdm/video.ts +++ b/lib/routes/ntdm/video.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import { rootUrl } from './utils'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import { rootUrl } from './utils'; + export const route: Route = { path: '/video/:id', categories: ['anime'], diff --git a/lib/routes/ntdtv/channel.ts b/lib/routes/ntdtv/channel.ts index f5556390fa..f10c1f5cb9 100644 --- a/lib/routes/ntdtv/channel.ts +++ b/lib/routes/ntdtv/channel.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ntrblog/articles.ts b/lib/routes/ntrblog/articles.ts index 5ffe9360b7..94baad8f95 100644 --- a/lib/routes/ntrblog/articles.ts +++ b/lib/routes/ntrblog/articles.ts @@ -1,9 +1,10 @@ -import { Route, Data, DataItem } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import Parser from 'rss-parser'; +import type { Data, DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + type CustomItem = { issued: string }; const parser = new Parser({ customFields: { diff --git a/lib/routes/nua/dc.ts b/lib/routes/nua/dc.ts index e7ab373d22..9b0fe244ee 100644 --- a/lib/routes/nua/dc.ts +++ b/lib/routes/nua/dc.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import util from './utils'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; + +import util from './utils'; export const route: Route = { path: '/dc/:type', diff --git a/lib/routes/nua/gra.ts b/lib/routes/nua/gra.ts index c7e48e7cd9..76c7ee595c 100644 --- a/lib/routes/nua/gra.ts +++ b/lib/routes/nua/gra.ts @@ -1,5 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import util from './utils'; + const baseUrl = 'https://grad.nua.edu.cn'; export const route: Route = { diff --git a/lib/routes/nua/index.ts b/lib/routes/nua/index.ts index 48fffe9c4d..0e8f39d21a 100644 --- a/lib/routes/nua/index.ts +++ b/lib/routes/nua/index.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import util from './utils'; export const route: Route = { diff --git a/lib/routes/nua/lib.ts b/lib/routes/nua/lib.ts index 12711f0734..f2656110c2 100644 --- a/lib/routes/nua/lib.ts +++ b/lib/routes/nua/lib.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; -import util from './utils'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; + +import util from './utils'; + const baseUrl = 'https://lib.nua.edu.cn'; export const route: Route = { diff --git a/lib/routes/nua/sxw.ts b/lib/routes/nua/sxw.ts index e5cf7f81a0..133d20814d 100644 --- a/lib/routes/nua/sxw.ts +++ b/lib/routes/nua/sxw.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import util from './utils'; export const route: Route = { diff --git a/lib/routes/nua/utils.ts b/lib/routes/nua/utils.ts index dedfc96822..9e00603a9b 100644 --- a/lib/routes/nua/utils.ts +++ b/lib/routes/nua/utils.ts @@ -1,6 +1,7 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; import { fetchArticle } from '@/utils/wechat-mp'; diff --git a/lib/routes/nuaa/college/cae.ts b/lib/routes/nuaa/college/cae.ts index 44469ecc81..0fa65fb8a8 100644 --- a/lib/routes/nuaa/college/cae.ts +++ b/lib/routes/nuaa/college/cae.ts @@ -1,9 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + import getCookie from '../utils/pypasswaf'; + const host = 'https://cae.nuaa.edu.cn/'; const map = new Map([ diff --git a/lib/routes/nuaa/college/cs.ts b/lib/routes/nuaa/college/cs.ts index f83504bd06..8a95f767ce 100644 --- a/lib/routes/nuaa/college/cs.ts +++ b/lib/routes/nuaa/college/cs.ts @@ -1,9 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + import getCookie from '../utils/pypasswaf'; + const host = 'https://cs.nuaa.edu.cn/'; const map = new Map([ diff --git a/lib/routes/nuaa/jwc/jwc.ts b/lib/routes/nuaa/jwc/jwc.ts index d83b09fd17..afc8b4ef26 100644 --- a/lib/routes/nuaa/jwc/jwc.ts +++ b/lib/routes/nuaa/jwc/jwc.ts @@ -1,9 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + import getCookie from '../utils/pypasswaf'; + const host = 'http://aao.nuaa.edu.cn/'; const map = new Map([ diff --git a/lib/routes/nuaa/utils/pypasswaf.ts b/lib/routes/nuaa/utils/pypasswaf.ts index 0c38881d87..b10bbfcfba 100644 --- a/lib/routes/nuaa/utils/pypasswaf.ts +++ b/lib/routes/nuaa/utils/pypasswaf.ts @@ -1,5 +1,5 @@ -import { getCookies } from '@/utils/puppeteer-utils'; import puppeteer from '@/utils/puppeteer'; +import { getCookies } from '@/utils/puppeteer-utils'; /** * async function 获取cookie diff --git a/lib/routes/nuaa/yjsy/yjsy.ts b/lib/routes/nuaa/yjsy/yjsy.ts index 066279f0fe..3a2e630504 100644 --- a/lib/routes/nuaa/yjsy/yjsy.ts +++ b/lib/routes/nuaa/yjsy/yjsy.ts @@ -1,9 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + import getCookie from '../utils/pypasswaf'; + const host = 'http://www.graduate.nuaa.edu.cn/'; const map = new Map([ diff --git a/lib/routes/nudt/yjszs.ts b/lib/routes/nudt/yjszs.ts index db2eb0ce10..d75d82e572 100644 --- a/lib/routes/nudt/yjszs.ts +++ b/lib/routes/nudt/yjszs.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; /* 研究生院 */ diff --git a/lib/routes/nuist/bulletin.ts b/lib/routes/nuist/bulletin.ts index 86ff307510..5904c7a878 100644 --- a/lib/routes/nuist/bulletin.ts +++ b/lib/routes/nuist/bulletin.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const baseTitle = '南信大信息公告栏'; diff --git a/lib/routes/nuist/cas.ts b/lib/routes/nuist/cas.ts index a450549165..21f788ad28 100644 --- a/lib/routes/nuist/cas.ts +++ b/lib/routes/nuist/cas.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/nuist/jwc.ts b/lib/routes/nuist/jwc.ts index c0101b4592..38c9c96074 100644 --- a/lib/routes/nuist/jwc.ts +++ b/lib/routes/nuist/jwc.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const baseTitle = '南京信息工程大学-教务处'; diff --git a/lib/routes/nuist/library/lib.ts b/lib/routes/nuist/library/lib.ts index 03f9262fc8..d037faeb85 100644 --- a/lib/routes/nuist/library/lib.ts +++ b/lib/routes/nuist/library/lib.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const baseTitle = '南京信息工程大学图书馆通知'; const baseUrl = 'https://lib.nuist.edu.cn'; diff --git a/lib/routes/nuist/scs.ts b/lib/routes/nuist/scs.ts index 9981cfd9fb..e96f43b8e2 100644 --- a/lib/routes/nuist/scs.ts +++ b/lib/routes/nuist/scs.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const baseTitle = 'NUIST CS(南信大计软院)'; const baseUrl = 'https://scs.nuist.edu.cn'; diff --git a/lib/routes/nuist/sese.ts b/lib/routes/nuist/sese.ts index b2e3956a55..98cea23d12 100644 --- a/lib/routes/nuist/sese.ts +++ b/lib/routes/nuist/sese.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const baseTitle = 'NUIST ESE(南信大环科院)'; diff --git a/lib/routes/nuist/xgc.ts b/lib/routes/nuist/xgc.ts index 2b70377920..501316a902 100644 --- a/lib/routes/nuist/xgc.ts +++ b/lib/routes/nuist/xgc.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const baseTitle = '南信大学生工作处'; diff --git a/lib/routes/nuist/yjs.ts b/lib/routes/nuist/yjs.ts index c3306fc483..5bd9f13304 100644 --- a/lib/routes/nuist/yjs.ts +++ b/lib/routes/nuist/yjs.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -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 type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/yjs/*', diff --git a/lib/routes/nwafu/all.ts b/lib/routes/nwafu/all.ts index 641ae5d652..40d71767fb 100644 --- a/lib/routes/nwafu/all.ts +++ b/lib/routes/nwafu/all.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + import { nwafuMap } from './utils'; export const route: Route = { diff --git a/lib/routes/nwnu/routes/college/csse.ts b/lib/routes/nwnu/routes/college/csse.ts index 4822aa5ef7..bb2ee5df7a 100644 --- a/lib/routes/nwnu/routes/college/csse.ts +++ b/lib/routes/nwnu/routes/college/csse.ts @@ -1,9 +1,11 @@ +import { load } from 'cheerio'; + import NotFoundError from '@/errors/types/not-found'; -import { DataItem, Route } from '@/types'; +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; + import { processEmbedPDF } from '../lib/embed-resource'; const WEBSITE_LOGO = 'https://jsj.nwnu.edu.cn/_upload/tpl/02/2e/558/template558/favicon.ico'; diff --git a/lib/routes/nwnu/routes/department/academic-affairs.ts b/lib/routes/nwnu/routes/department/academic-affairs.ts index 30a75b9d29..eba3dcc81d 100644 --- a/lib/routes/nwnu/routes/department/academic-affairs.ts +++ b/lib/routes/nwnu/routes/department/academic-affairs.ts @@ -1,9 +1,11 @@ +import { load } from 'cheerio'; + import NotFoundError from '@/errors/types/not-found'; -import { DataItem, Route } from '@/types'; +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; + import { processEmbedPDF } from '../lib/embed-resource'; const WEBSITE_LOGO = 'https://www.nwnu.edu.cn/_upload/tpl/02/d9/729/template729/favicon.ico'; diff --git a/lib/routes/nwnu/routes/department/postgraduate.ts b/lib/routes/nwnu/routes/department/postgraduate.ts index 25fae3bc4e..668c72987c 100644 --- a/lib/routes/nwnu/routes/department/postgraduate.ts +++ b/lib/routes/nwnu/routes/department/postgraduate.ts @@ -1,9 +1,11 @@ +import { load } from 'cheerio'; + import NotFoundError from '@/errors/types/not-found'; -import { DataItem, Route } from '@/types'; +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; + import { processEmbedPDF } from '../lib/embed-resource'; const WEBSITE_LOGO = 'https://www.nwnu.edu.cn/_upload/tpl/02/d9/729/template729/favicon.ico'; diff --git a/lib/routes/nyaa/main.ts b/lib/routes/nyaa/main.ts index a8032a6e72..24b46705b0 100644 --- a/lib/routes/nyaa/main.ts +++ b/lib/routes/nyaa/main.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import { config } from '@/config'; import Parser from 'rss-parser'; +import { config } from '@/config'; +import type { Route } from '@/types'; + export const route: Route = { path: ['/search/:query?', '/user/:username?', '/user/:username/search/:query?', '/sukebei/search/:query?', '/sukebei/user/:username?', '/sukebei/user/:username/search/:query?'], categories: ['multimedia'], diff --git a/lib/routes/nycu/aa.ts b/lib/routes/nycu/aa.ts index 03d85a811d..55b244a74d 100644 --- a/lib/routes/nycu/aa.ts +++ b/lib/routes/nycu/aa.ts @@ -1,8 +1,10 @@ -import { Data, Route } from '@/types'; -import timezone from '@/utils/timezone'; -import { CheerioAPI, load } from 'cheerio'; -import { Context } from 'hono'; +import type { CheerioAPI} from 'cheerio'; +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { Data, Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import timezone from '@/utils/timezone'; function ROCDate(dateStr: string | Date): Date { const date = new Date(dateStr); diff --git a/lib/routes/nycu/announcement.ts b/lib/routes/nycu/announcement.ts index 79dfa9aefb..3ff96aeb10 100644 --- a/lib/routes/nycu/announcement.ts +++ b/lib/routes/nycu/announcement.ts @@ -1,8 +1,10 @@ -import { Data, Route } from '@/types'; -import timezone from '@/utils/timezone'; -import { CheerioAPI, load } from 'cheerio'; -import { Context } from 'hono'; +import type { CheerioAPI} from 'cheerio'; +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { Data, Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import timezone from '@/utils/timezone'; async function handler(ctx: Context): Promise { const type = ctx.req.param('type') ?? '5'; diff --git a/lib/routes/nycu/cs.ts b/lib/routes/nycu/cs.ts index f4741d1082..d497edbe00 100644 --- a/lib/routes/nycu/cs.ts +++ b/lib/routes/nycu/cs.ts @@ -1,8 +1,10 @@ -import { Data, Route } from '@/types'; -import timezone from '@/utils/timezone'; -import { CheerioAPI, load } from 'cheerio'; -import { Context } from 'hono'; +import type { CheerioAPI} from 'cheerio'; +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { Data, Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import timezone from '@/utils/timezone'; async function handler(ctx: Context): Promise { const catagory = ctx.req.param('category') ?? 'all'; diff --git a/lib/routes/nycu/osa.ts b/lib/routes/nycu/osa.ts index d1cff00df6..46dfa51545 100644 --- a/lib/routes/nycu/osa.ts +++ b/lib/routes/nycu/osa.ts @@ -1,8 +1,10 @@ -import { Data, Route } from '@/types'; -import timezone from '@/utils/timezone'; -import { CheerioAPI, load } from 'cheerio'; -import { Context } from 'hono'; +import type { CheerioAPI} from 'cheerio'; +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { Data, Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import timezone from '@/utils/timezone'; function ROCDate(dateStr: string | Date): Date { const date = new Date(dateStr); diff --git a/lib/routes/nymity/censorbib.ts b/lib/routes/nymity/censorbib.ts index d881229621..b48d4743fe 100644 --- a/lib/routes/nymity/censorbib.ts +++ b/lib/routes/nymity/censorbib.ts @@ -1,6 +1,8 @@ -import { DataItem, Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; +import got from '@/utils/got'; + const url = 'https://censorbib.nymity.ch/'; export const route: Route = { diff --git a/lib/routes/nytimes/book.ts b/lib/routes/nytimes/book.ts index 134a1cd389..d258c6f14a 100644 --- a/lib/routes/nytimes/book.ts +++ b/lib/routes/nytimes/book.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; + const categoryList = { 'combined-print-and-e-book-nonfiction': 'Combined Print & E-Book Nonfiction', 'hardcover-nonfiction': 'Hardcover Nonfiction', diff --git a/lib/routes/nytimes/daily-briefing-chinese.ts b/lib/routes/nytimes/daily-briefing-chinese.ts index 363065b746..f41dbc03d1 100644 --- a/lib/routes/nytimes/daily-briefing-chinese.ts +++ b/lib/routes/nytimes/daily-briefing-chinese.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/daily_briefing_chinese', diff --git a/lib/routes/nytimes/index.ts b/lib/routes/nytimes/index.ts index 9154dd9176..3b6aad7f31 100644 --- a/lib/routes/nytimes/index.ts +++ b/lib/routes/nytimes/index.ts @@ -1,10 +1,13 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import parser from '@/utils/rss-parser'; -import utils from './utils'; -import { load } from 'cheerio'; import puppeteer from '@/utils/puppeteer'; +import parser from '@/utils/rss-parser'; + +import utils from './utils'; export const route: Route = { path: '/:lang?', diff --git a/lib/routes/nytimes/rss.ts b/lib/routes/nytimes/rss.ts index 3ae702c39a..13c1fb6f7a 100644 --- a/lib/routes/nytimes/rss.ts +++ b/lib/routes/nytimes/rss.ts @@ -1,8 +1,10 @@ -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; -import parser from '@/utils/rss-parser'; import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import parser from '@/utils/rss-parser'; export const route: Route = { path: '/rss/:cat?', diff --git a/lib/routes/nytimes/utils.ts b/lib/routes/nytimes/utils.ts index 36cf67f089..2db5209d51 100644 --- a/lib/routes/nytimes/utils.ts +++ b/lib/routes/nytimes/utils.ts @@ -1,5 +1,6 @@ -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; const ProcessImage = ($, e) => { diff --git a/lib/routes/obsidian/plugins.ts b/lib/routes/obsidian/plugins.ts index 83198bfacd..2d09a56e80 100644 --- a/lib/routes/obsidian/plugins.ts +++ b/lib/routes/obsidian/plugins.ts @@ -1,5 +1,4 @@ -import { Route } from '@/types'; - +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/obsidian/publish.ts b/lib/routes/obsidian/publish.ts index c0f237c605..90a564b2f4 100644 --- a/lib/routes/obsidian/publish.ts +++ b/lib/routes/obsidian/publish.ts @@ -1,10 +1,12 @@ -import { Route, DataItem } from '@/types'; import { load } from 'cheerio'; -import ofetch from '@/utils/ofetch'; -import { getTitle } from './utils'; + import { config } from '@/config'; +import type { DataItem, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { getTitle } from './utils'; + export const route: Route = { path: '/publish/:id', categories: ['blog'], diff --git a/lib/routes/oceanengine/arithmetic-index.ts b/lib/routes/oceanengine/arithmetic-index.ts index b93e1cf5c3..e071165018 100644 --- a/lib/routes/oceanengine/arithmetic-index.ts +++ b/lib/routes/oceanengine/arithmetic-index.ts @@ -1,15 +1,16 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; -import dayjs from 'dayjs'; -import { art } from '@/utils/render'; -import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; -import path from 'node:path'; -import { config } from '@/config'; -import puppeteer from '@/utils/puppeteer'; import { createDecipheriv } from 'node:crypto'; +import path from 'node:path'; + +import dayjs from 'dayjs'; + +import { config } from '@/config'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { parseDate } from '@/utils/parse-date'; +import puppeteer from '@/utils/puppeteer'; +import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; // Parameters const CACHE_MAX_AGE = config.cache.contentExpire; diff --git a/lib/routes/oct0pu5/rss.ts b/lib/routes/oct0pu5/rss.ts index a57892a723..c597bc20b3 100644 --- a/lib/routes/oct0pu5/rss.ts +++ b/lib/routes/oct0pu5/rss.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import buildData from '@/utils/common-config'; const baseUrl = 'https://oct0pu5.cn/'; diff --git a/lib/routes/odaily/activity.ts b/lib/routes/odaily/activity.ts index 806061c6fc..b414ba934b 100644 --- a/lib/routes/odaily/activity.ts +++ b/lib/routes/odaily/activity.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; + import { rootUrl } from './utils'; export const route: Route = { diff --git a/lib/routes/odaily/newsflash.ts b/lib/routes/odaily/newsflash.ts index a1834f3d79..4d0e519dea 100644 --- a/lib/routes/odaily/newsflash.ts +++ b/lib/routes/odaily/newsflash.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; + import { rootUrl } from './utils'; export const route: Route = { diff --git a/lib/routes/odaily/post.ts b/lib/routes/odaily/post.ts index 735568be6e..c2cef7b46c 100644 --- a/lib/routes/odaily/post.ts +++ b/lib/routes/odaily/post.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; + import { rootUrl } from './utils'; const titles = { diff --git a/lib/routes/odaily/search-news.ts b/lib/routes/odaily/search-news.ts index 8a9e3159c2..5eac2c3870 100644 --- a/lib/routes/odaily/search-news.ts +++ b/lib/routes/odaily/search-news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; + import { rootUrl } from './utils'; export const route: Route = { diff --git a/lib/routes/odaily/user.ts b/lib/routes/odaily/user.ts index 84704c8ce4..b0ec1cf110 100644 --- a/lib/routes/odaily/user.ts +++ b/lib/routes/odaily/user.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; + import { rootUrl } from './utils'; export const route: Route = { diff --git a/lib/routes/oeeee/app/channel.ts b/lib/routes/oeeee/app/channel.ts index 2c8bd0809d..a35932058c 100644 --- a/lib/routes/oeeee/app/channel.ts +++ b/lib/routes/oeeee/app/channel.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; -import { parseArticle } from '../utils'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; + +import { parseArticle } from '../utils'; export const route: Route = { path: '/app/channel/:id', diff --git a/lib/routes/oeeee/app/reporter.ts b/lib/routes/oeeee/app/reporter.ts index d02180ca01..da2a5f33c1 100644 --- a/lib/routes/oeeee/app/reporter.ts +++ b/lib/routes/oeeee/app/reporter.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { parseArticle } from '../utils'; import { art } from '@/utils/render'; -import path from 'node:path'; + +import { parseArticle } from '../utils'; export const route: Route = { path: '/app/reporter/:id', diff --git a/lib/routes/oeeee/utils.ts b/lib/routes/oeeee/utils.ts index 2200bc0088..706dc335f7 100644 --- a/lib/routes/oeeee/utils.ts +++ b/lib/routes/oeeee/utils.ts @@ -1,7 +1,8 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; const parseArticle = (item, tryGet) => tryGet(item.link, async () => { diff --git a/lib/routes/oeeee/web.ts b/lib/routes/oeeee/web.ts index 1e55e33c05..81ee21e044 100644 --- a/lib/routes/oeeee/web.ts +++ b/lib/routes/oeeee/web.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; -import { parseArticle } from './utils'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; + +import { parseArticle } from './utils'; export const route: Route = { path: '/web/:channel', diff --git a/lib/routes/oesw/index.ts b/lib/routes/oesw/index.ts index deae424380..b49e6a0765 100644 --- a/lib/routes/oesw/index.ts +++ b/lib/routes/oesw/index.ts @@ -1,7 +1,8 @@ import { load } from 'cheerio'; + +import type { Data, DataItem, Route } from '@/types'; import { getSubPath } from '@/utils/common-utils'; import ofetch from '@/utils/ofetch'; -import type { Data, DataItem, Route } from '@/types'; const FEED_LANGUAGE = 'de' as const; const FEED_LOGO = 'https://www.oesw.at/fileadmin/Logos/OeSW_AG/OeSW-Logo2024-RGB.png'; diff --git a/lib/routes/oesw/namespace.ts b/lib/routes/oesw/namespace.ts index e43418c78b..aed586fdee 100644 --- a/lib/routes/oesw/namespace.ts +++ b/lib/routes/oesw/namespace.ts @@ -1,4 +1,4 @@ -import { Namespace } from '@/types'; +import type { Namespace } from '@/types'; export const namespace: Namespace = { name: 'ÖSW', diff --git a/lib/routes/oilchem/index.ts b/lib/routes/oilchem/index.ts index a98e69b833..0b3081b58f 100644 --- a/lib/routes/oilchem/index.ts +++ b/lib/routes/oilchem/index.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import routes from './routes'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; + +import routes from './routes'; export const route: Route = { path: '/:type?/:category?/:subCategory?', diff --git a/lib/routes/okx/index.ts b/lib/routes/okx/index.ts index d04d5c6c7e..ab909d6cfe 100644 --- a/lib/routes/okx/index.ts +++ b/lib/routes/okx/index.ts @@ -1,9 +1,10 @@ -import { DataItem, Route } from '@/types'; -import cache from '@/utils/cache'; -import { Context } from 'hono'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; +import ofetch from '@/utils/ofetch'; export const route: Route = { path: '/:section?', diff --git a/lib/routes/olevod/vod.ts b/lib/routes/olevod/vod.ts index 89b5ba8250..35d467f624 100644 --- a/lib/routes/olevod/vod.ts +++ b/lib/routes/olevod/vod.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/olevod/vodlist.ts b/lib/routes/olevod/vodlist.ts index e911be1a82..c25546d256 100644 --- a/lib/routes/olevod/vodlist.ts +++ b/lib/routes/olevod/vodlist.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/ollama/blog.ts b/lib/routes/ollama/blog.ts index 36e88e9e02..7f393e1e00 100644 --- a/lib/routes/ollama/blog.ts +++ b/lib/routes/ollama/blog.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ollama/models.ts b/lib/routes/ollama/models.ts index 3e6b4aedfc..f1638b9978 100644 --- a/lib/routes/ollama/models.ts +++ b/lib/routes/ollama/models.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseRelativeDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/oncc/index.ts b/lib/routes/oncc/index.ts index 5416bad8aa..07198123d4 100644 --- a/lib/routes/oncc/index.ts +++ b/lib/routes/oncc/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import path from 'node:path'; import { art } from '@/utils/render'; const rootUrl = 'https://hk.on.cc'; diff --git a/lib/routes/oncc/money18.ts b/lib/routes/oncc/money18.ts index fb14a35f6c..436b706432 100644 --- a/lib/routes/oncc/money18.ts +++ b/lib/routes/oncc/money18.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import dayjs from 'dayjs'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; const sections = { exp: '新聞總覽', diff --git a/lib/routes/onehu/common.ts b/lib/routes/onehu/common.ts index 76c109be34..cf1a8ae21b 100644 --- a/lib/routes/onehu/common.ts +++ b/lib/routes/onehu/common.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/', diff --git a/lib/routes/onet/news.ts b/lib/routes/onet/news.ts index 45cc597df2..fc456648a1 100644 --- a/lib/routes/onet/news.ts +++ b/lib/routes/onet/news.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import cache from '@/utils/cache'; -import parser from '@/utils/rss-parser'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import parser from '@/utils/rss-parser'; + import { parseArticleContent, parseMainImage } from './utils'; export const route: Route = { diff --git a/lib/routes/onet/utils.ts b/lib/routes/onet/utils.ts index 4188281d0a..3db03167c2 100644 --- a/lib/routes/onet/utils.ts +++ b/lib/routes/onet/utils.ts @@ -1,6 +1,7 @@ -import { art } from '@/utils/render'; import path from 'node:path'; +import { art } from '@/utils/render'; + const parseMainImage = ($) => { const mainImage = $('figure.mainPhoto'); const img = mainImage.find('img'); diff --git a/lib/routes/oo-software/changelog.ts b/lib/routes/oo-software/changelog.ts index 44632d5000..db97a7408d 100644 --- a/lib/routes/oo-software/changelog.ts +++ b/lib/routes/oo-software/changelog.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/openai/chatgpt.ts b/lib/routes/openai/chatgpt.ts index 2724b9ac2f..0bf80d5003 100644 --- a/lib/routes/openai/chatgpt.ts +++ b/lib/routes/openai/chatgpt.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import dayjs from 'dayjs'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { config } from '@/config'; - +import dayjs from 'dayjs'; import isSameOrBefore from 'dayjs/plugin/isSameOrBefore.js'; + +import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + dayjs.extend(isSameOrBefore); export const route: Route = { diff --git a/lib/routes/openai/common.ts b/lib/routes/openai/common.ts index 30723d3857..daf84c9368 100644 --- a/lib/routes/openai/common.ts +++ b/lib/routes/openai/common.ts @@ -1,11 +1,13 @@ +import path from 'node:path'; + +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { DataItem } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import ofetch from '@/utils/ofetch'; -import { DataItem } from '@/types'; -import { load } from 'cheerio'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { config } from '@/config'; export const BASE_URL = new URL('https://openai.com'); diff --git a/lib/routes/openai/cookbook.ts b/lib/routes/openai/cookbook.ts index b61c18d357..d07fd7812c 100644 --- a/lib/routes/openai/cookbook.ts +++ b/lib/routes/openai/cookbook.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import logger from '@/utils/logger'; import ofetch from '@/utils/ofetch'; diff --git a/lib/routes/openai/news.ts b/lib/routes/openai/news.ts index 2f399bdeb5..e8983b134b 100644 --- a/lib/routes/openai/news.ts +++ b/lib/routes/openai/news.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; -import { fetchArticles, BASE_URL } from './common'; -import { Context } from 'hono'; +import type { Context } from 'hono'; + +import type { Route } from '@/types'; + +import { BASE_URL, fetchArticles } from './common'; export const route: Route = { path: '/news', diff --git a/lib/routes/openai/research.ts b/lib/routes/openai/research.ts index b0a0b0e6f5..cedcf09982 100644 --- a/lib/routes/openai/research.ts +++ b/lib/routes/openai/research.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import { getApiUrl, parseArticle } from './common'; export const route: Route = { diff --git a/lib/routes/openrice/chart.ts b/lib/routes/openrice/chart.ts index c56026d3d1..390e8d9c54 100644 --- a/lib/routes/openrice/chart.ts +++ b/lib/routes/openrice/chart.ts @@ -1,8 +1,11 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { art } from '@/utils/render'; + const baseUrl = 'https://www.openrice.com'; export const route: Route = { diff --git a/lib/routes/openrice/offers.ts b/lib/routes/openrice/offers.ts index a41b49290d..5eccbff192 100644 --- a/lib/routes/openrice/offers.ts +++ b/lib/routes/openrice/offers.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { art } from '@/utils/render'; -import path from 'node:path'; + const baseUrl = 'https://www.openrice.com'; export const route: Route = { diff --git a/lib/routes/openrice/promos.ts b/lib/routes/openrice/promos.ts index 161fbefab8..05f0e1bf5f 100644 --- a/lib/routes/openrice/promos.ts +++ b/lib/routes/openrice/promos.ts @@ -1,8 +1,11 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { art } from '@/utils/render'; + const baseUrl = 'https://www.openrice.com'; export const route: Route = { diff --git a/lib/routes/openrice/voting.ts b/lib/routes/openrice/voting.ts index 40cddfde0a..6ffef817e1 100644 --- a/lib/routes/openrice/voting.ts +++ b/lib/routes/openrice/voting.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; + const baseUrl = 'https://www.openrice.com'; export const route: Route = { diff --git a/lib/routes/openwrt/releases.ts b/lib/routes/openwrt/releases.ts index aa1af7cda1..f20223a9d7 100644 --- a/lib/routes/openwrt/releases.ts +++ b/lib/routes/openwrt/releases.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/releases/:brand/:model', radar: [ diff --git a/lib/routes/orcid/index.ts b/lib/routes/orcid/index.ts index dcad980e6c..1d928cb0ae 100644 --- a/lib/routes/orcid/index.ts +++ b/lib/routes/orcid/index.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:id', diff --git a/lib/routes/oreno3d/get-sec-page-data.ts b/lib/routes/oreno3d/get-sec-page-data.ts index 54fceed380..a99feda257 100644 --- a/lib/routes/oreno3d/get-sec-page-data.ts +++ b/lib/routes/oreno3d/get-sec-page-data.ts @@ -1,6 +1,7 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; +import got from '@/utils/got'; + const rootUrl = 'https://oreno3d.com'; async function sync_detail(link) { diff --git a/lib/routes/oreno3d/main.ts b/lib/routes/oreno3d/main.ts index 1ddb10000b..ff34034344 100644 --- a/lib/routes/oreno3d/main.ts +++ b/lib/routes/oreno3d/main.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { load } from 'cheerio'; + import get_sec_page_data from './get-sec-page-data'; const rootUrl = 'https://oreno3d.com'; diff --git a/lib/routes/ornl/all-news.ts b/lib/routes/ornl/all-news.ts index 64f07fca64..c0d62c529a 100644 --- a/lib/routes/ornl/all-news.ts +++ b/lib/routes/ornl/all-news.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '10', 10); diff --git a/lib/routes/oschina/column.ts b/lib/routes/oschina/column.ts index 124b2aff10..c90c37c823 100644 --- a/lib/routes/oschina/column.ts +++ b/lib/routes/oschina/column.ts @@ -1,15 +1,14 @@ import path from 'node:path'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type Context } from 'hono'; -import { type DataItem, type Route, type Data, ViewType } from '@/types'; - -import { art } from '@/utils/render'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; export const handler = async (ctx: Context): Promise => { diff --git a/lib/routes/oschina/event.ts b/lib/routes/oschina/event.ts index 7bac7aa21a..ac331520cf 100644 --- a/lib/routes/oschina/event.ts +++ b/lib/routes/oschina/event.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { category = 'latest' } = ctx.req.param(); diff --git a/lib/routes/oschina/news.ts b/lib/routes/oschina/news.ts index 29ad7c1548..78bae6eb5d 100644 --- a/lib/routes/oschina/news.ts +++ b/lib/routes/oschina/news.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { load } from 'cheerio'; import { fetchArticle } from '@/utils/wechat-mp'; -import { config } from '@/config'; const configs = { all: { diff --git a/lib/routes/oschina/topic.ts b/lib/routes/oschina/topic.ts index 4f77b16c59..4774873e46 100644 --- a/lib/routes/oschina/topic.ts +++ b/lib/routes/oschina/topic.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { load } from 'cheerio'; async function loadContent(link) { const res = await got(link); diff --git a/lib/routes/oschina/user.ts b/lib/routes/oschina/user.ts index c5069c72ef..26ade55eac 100644 --- a/lib/routes/oschina/user.ts +++ b/lib/routes/oschina/user.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/oshwhub/explore.ts b/lib/routes/oshwhub/explore.ts index fc505089d3..5dd0039621 100644 --- a/lib/routes/oshwhub/explore.ts +++ b/lib/routes/oshwhub/explore.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import { art } from '@/utils/render'; -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; +import path from 'node:path'; import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; import MarkdownIt from 'markdown-it'; -import path from 'node:path'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; const originOptions = [ { diff --git a/lib/routes/osu/beatmaps/latest-ranked.ts b/lib/routes/osu/beatmaps/latest-ranked.ts index e5b4c084f6..e860eee780 100644 --- a/lib/routes/osu/beatmaps/latest-ranked.ts +++ b/lib/routes/osu/beatmaps/latest-ranked.ts @@ -1,10 +1,12 @@ -import { Data, DataItem, Route } from '@/types'; import path from 'node:path'; -import got from '@/utils/got'; + import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import cache from '@/utils/cache'; + import { config } from '@/config'; +import type { Data, DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; const actualParametersDescTable = ` diff --git a/lib/routes/osu/beatmaps/packs.ts b/lib/routes/osu/beatmaps/packs.ts index e48bc2b968..afef25ec41 100644 --- a/lib/routes/osu/beatmaps/packs.ts +++ b/lib/routes/osu/beatmaps/packs.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/otobanana/cast.ts b/lib/routes/otobanana/cast.ts index cd2b0c4382..42c17cb5a8 100644 --- a/lib/routes/otobanana/cast.ts +++ b/lib/routes/otobanana/cast.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; + import { apiBase, baseUrl, getUserInfo, renderCast } from './utils'; export const route: Route = { diff --git a/lib/routes/otobanana/livestream.ts b/lib/routes/otobanana/livestream.ts index f4c9c20c96..341d529a10 100644 --- a/lib/routes/otobanana/livestream.ts +++ b/lib/routes/otobanana/livestream.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; + import { apiBase, baseUrl, getUserInfo, renderLive } from './utils'; export const route: Route = { diff --git a/lib/routes/otobanana/timeline.ts b/lib/routes/otobanana/timeline.ts index 59652ad7d9..e5cd0bb24e 100644 --- a/lib/routes/otobanana/timeline.ts +++ b/lib/routes/otobanana/timeline.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; + import { apiBase, baseUrl, getUserInfo, renderPost } from './utils'; export const route: Route = { diff --git a/lib/routes/otobanana/utils.ts b/lib/routes/otobanana/utils.ts index 6138b14ab2..b1cb2fc256 100644 --- a/lib/routes/otobanana/utils.ts +++ b/lib/routes/otobanana/utils.ts @@ -1,7 +1,8 @@ +import path from 'node:path'; + import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const domain = 'otobanana.com'; const apiBase = `https://api.${domain}`; diff --git a/lib/routes/ouc/hqsz.ts b/lib/routes/ouc/hqsz.ts index 9c7fc635c5..233b44b81e 100644 --- a/lib/routes/ouc/hqsz.ts +++ b/lib/routes/ouc/hqsz.ts @@ -1,8 +1,9 @@ -import { parseDate } from '@/utils/parse-date'; -import got from '@/utils/got'; -import cache from '@/utils/cache'; import CryptoJS from 'crypto-js/crypto-js'; -import { Route } from '@/types'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/hqsz', diff --git a/lib/routes/ouc/it-postgraduate.ts b/lib/routes/ouc/it-postgraduate.ts index e3e6893ebd..49af3d162c 100644 --- a/lib/routes/ouc/it-postgraduate.ts +++ b/lib/routes/ouc/it-postgraduate.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ouc/it-tx.ts b/lib/routes/ouc/it-tx.ts index c63c228b2d..56cfb5f272 100644 --- a/lib/routes/ouc/it-tx.ts +++ b/lib/routes/ouc/it-tx.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ouc/it.ts b/lib/routes/ouc/it.ts index 23bacb0aae..e283c5a857 100644 --- a/lib/routes/ouc/it.ts +++ b/lib/routes/ouc/it.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ouc/jwc.ts b/lib/routes/ouc/jwc.ts index 0b101b9e93..5c182cb53c 100644 --- a/lib/routes/ouc/jwc.ts +++ b/lib/routes/ouc/jwc.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ouc/jwgl.ts b/lib/routes/ouc/jwgl.ts index bdeb5a02db..8dd05dade9 100644 --- a/lib/routes/ouc/jwgl.ts +++ b/lib/routes/ouc/jwgl.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ouc/yjs.ts b/lib/routes/ouc/yjs.ts index 9777e95368..be668c865a 100644 --- a/lib/routes/ouc/yjs.ts +++ b/lib/routes/ouc/yjs.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/oup/index.ts b/lib/routes/oup/index.ts index 4c4ce2b6ee..8d76cec882 100644 --- a/lib/routes/oup/index.ts +++ b/lib/routes/oup/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import path from 'node:path'; import { art } from '@/utils/render'; const rootUrl = 'https://academic.oup.com'; diff --git a/lib/routes/outagereport/index.ts b/lib/routes/outagereport/index.ts index 6585dc39b4..0dc6628b8c 100644 --- a/lib/routes/outagereport/index.ts +++ b/lib/routes/outagereport/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; const baseUrl = 'https://outage.report/'; diff --git a/lib/routes/p-articles/contributors.ts b/lib/routes/p-articles/contributors.ts index e9bfec6b8f..8880096626 100644 --- a/lib/routes/p-articles/contributors.ts +++ b/lib/routes/p-articles/contributors.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { rootUrl, ProcessFeed } from './utils'; +import ofetch from '@/utils/ofetch'; + +import { ProcessFeed, rootUrl } from './utils'; export const route: Route = { path: '/contributors/:author', diff --git a/lib/routes/p-articles/section.ts b/lib/routes/p-articles/section.ts index ffd96f3499..ae53abd380 100644 --- a/lib/routes/p-articles/section.ts +++ b/lib/routes/p-articles/section.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { rootUrl, ProcessFeed } from './utils'; +import ofetch from '@/utils/ofetch'; + +import { ProcessFeed, rootUrl } from './utils'; export const route: Route = { path: '/section/:section', diff --git a/lib/routes/p-articles/utils.ts b/lib/routes/p-articles/utils.ts index 6645ad6c11..3a9810419d 100644 --- a/lib/routes/p-articles/utils.ts +++ b/lib/routes/p-articles/utils.ts @@ -1,4 +1,5 @@ import { load } from 'cheerio'; + import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; @@ -18,4 +19,4 @@ const ProcessFeed = (info, data) => { return info; }; -export { rootUrl, ProcessFeed }; +export { ProcessFeed, rootUrl }; diff --git a/lib/routes/pacilution/latest.ts b/lib/routes/pacilution/latest.ts index fa65b069ce..e522812702 100644 --- a/lib/routes/pacilution/latest.ts +++ b/lib/routes/pacilution/latest.ts @@ -1,9 +1,10 @@ -import { DataItem, Route } from '@/types'; +import { load } from 'cheerio'; +import iconv from 'iconv-lite'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; -import iconv from 'iconv-lite'; const BASE_URL = 'http://www.pacilution.com/'; diff --git a/lib/routes/panewslab/author.ts b/lib/routes/panewslab/author.ts index d4c66eb323..eda8696781 100644 --- a/lib/routes/panewslab/author.ts +++ b/lib/routes/panewslab/author.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/panewslab/news.ts b/lib/routes/panewslab/news.ts index 23ae5f5db8..f3070ba7aa 100644 --- a/lib/routes/panewslab/news.ts +++ b/lib/routes/panewslab/news.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/panewslab/profundity.ts b/lib/routes/panewslab/profundity.ts index 5fe19509f4..7035955ab4 100644 --- a/lib/routes/panewslab/profundity.ts +++ b/lib/routes/panewslab/profundity.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const categories = { diff --git a/lib/routes/panewslab/topic.ts b/lib/routes/panewslab/topic.ts index 46909c8d8f..268e37518f 100644 --- a/lib/routes/panewslab/topic.ts +++ b/lib/routes/panewslab/topic.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/papers/category.ts b/lib/routes/papers/category.ts index a01fd31f79..ba4fb81629 100644 --- a/lib/routes/papers/category.ts +++ b/lib/routes/papers/category.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type Context } from 'hono'; -import path from 'node:path'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; export const handler = async (ctx: Context): Promise => { const { id } = ctx.req.param(); diff --git a/lib/routes/papers/query.ts b/lib/routes/papers/query.ts index 0212638a41..4adad380a2 100644 --- a/lib/routes/papers/query.ts +++ b/lib/routes/papers/query.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; import parser from '@/utils/rss-parser'; const pdfUrlGenerators = { diff --git a/lib/routes/paradigm/writing.ts b/lib/routes/paradigm/writing.ts index ab9bf221bd..129ae71f6f 100644 --- a/lib/routes/paradigm/writing.ts +++ b/lib/routes/paradigm/writing.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://www.paradigm.xyz'; diff --git a/lib/routes/parliament.uk/commonslibrary.ts b/lib/routes/parliament.uk/commonslibrary.ts index 41fa182b7a..a9c4dab666 100644 --- a/lib/routes/parliament.uk/commonslibrary.ts +++ b/lib/routes/parliament.uk/commonslibrary.ts @@ -1,5 +1,6 @@ import { load } from 'cheerio'; -import { Route } from '@/types'; + +import type { Route } from '@/types'; import puppeteer from '@/utils/puppeteer'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/parliament.uk/lordslibrary.ts b/lib/routes/parliament.uk/lordslibrary.ts index f0f07beda5..9a6d7c4149 100644 --- a/lib/routes/parliament.uk/lordslibrary.ts +++ b/lib/routes/parliament.uk/lordslibrary.ts @@ -1,5 +1,6 @@ import { load } from 'cheerio'; -import { Route } from '@/types'; + +import type { Route } from '@/types'; import puppeteer from '@/utils/puppeteer'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/parliament.uk/petitions.ts b/lib/routes/parliament.uk/petitions.ts index 31110b7cd7..62dec5cb04 100644 --- a/lib/routes/parliament.uk/petitions.ts +++ b/lib/routes/parliament.uk/petitions.ts @@ -1,12 +1,12 @@ import path from 'node:path'; +import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; -import { load, type CheerioAPI } from 'cheerio'; -import { type DataItem, type Route, type Data, ViewType } from '@/types'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import ofetch from '@/utils/ofetch'; export const handler = async (ctx: Context): Promise => { const { state = 'all' } = ctx.req.param(); diff --git a/lib/routes/parliament/section77.ts b/lib/routes/parliament/section77.ts index dcc140e279..753fdd9b94 100644 --- a/lib/routes/parliament/section77.ts +++ b/lib/routes/parliament/section77.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import { CookieJar } from 'tough-cookie'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import timezone from '@/utils/timezone'; -import { CookieJar } from 'tough-cookie'; export const route: Route = { path: '/section77/:type?', diff --git a/lib/routes/patagonia/new-arrivals.ts b/lib/routes/patagonia/new-arrivals.ts index 406d8e0cd5..a20cd4b580 100644 --- a/lib/routes/patagonia/new-arrivals.ts +++ b/lib/routes/patagonia/new-arrivals.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { load } from 'cheerio'; + const host = 'https://www.patagonia.com'; const categoryMap = { mens: ['mens-new', 'mens-new-arrivals'], diff --git a/lib/routes/patreon/feed.ts b/lib/routes/patreon/feed.ts index 26a143a41a..8c9a7ff542 100644 --- a/lib/routes/patreon/feed.ts +++ b/lib/routes/patreon/feed.ts @@ -1,13 +1,15 @@ -import { Route } from '@/types'; -import { CreatorData, MediaRelation, PostData } from './types'; +import path from 'node:path'; +import * as cheerio from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import * as cheerio from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import path from 'node:path'; import { art } from '@/utils/render'; -import { config } from '@/config'; + +import type { CreatorData, MediaRelation, PostData } from './types'; export const route: Route = { path: '/:creator', diff --git a/lib/routes/paulgraham/article.ts b/lib/routes/paulgraham/article.ts index a6a21caf04..ef13e112b2 100644 --- a/lib/routes/paulgraham/article.ts +++ b/lib/routes/paulgraham/article.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/pconline/focus.ts b/lib/routes/pconline/focus.ts index e818ff34bb..54db04046e 100644 --- a/lib/routes/pconline/focus.ts +++ b/lib/routes/pconline/focus.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootUrl = 'https://www.pconline.com.cn'; diff --git a/lib/routes/pencilnews/index.ts b/lib/routes/pencilnews/index.ts index f39f9a687b..c8d0e625e8 100644 --- a/lib/routes/pencilnews/index.ts +++ b/lib/routes/pencilnews/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/penguin-random-house/articles.ts b/lib/routes/penguin-random-house/articles.ts index 05d58bf35b..0c7771668b 100644 --- a/lib/routes/penguin-random-house/articles.ts +++ b/lib/routes/penguin-random-house/articles.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import utils from './utils'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; +import utils from './utils'; + export const route: Route = { path: '/articles', categories: ['reading'], diff --git a/lib/routes/penguin-random-house/thereaddown.ts b/lib/routes/penguin-random-house/thereaddown.ts index fed6056e2f..941d8c1b16 100644 --- a/lib/routes/penguin-random-house/thereaddown.ts +++ b/lib/routes/penguin-random-house/thereaddown.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import utils from './utils'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; +import utils from './utils'; + export const route: Route = { path: '/the-read-down', categories: ['reading'], diff --git a/lib/routes/penguin-random-house/utils.ts b/lib/routes/penguin-random-house/utils.ts index 89e274914a..a1303943d2 100644 --- a/lib/routes/penguin-random-house/utils.ts +++ b/lib/routes/penguin-random-house/utils.ts @@ -1,9 +1,11 @@ -import cache from '@/utils/cache'; -import { load } from 'cheerio'; -import got from '@/utils/got'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; + +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; const parseBookInList = (element) => { const $ = load(element); diff --git a/lib/routes/people/index.ts b/lib/routes/people/index.ts index 2915b09c99..e9040ebdf1 100644 --- a/lib/routes/people/index.ts +++ b/lib/routes/people/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; -import timezone from '@/utils/timezone'; -import { parseDate } from '@/utils/parse-date'; -import { isValidHost } from '@/utils/valid-host'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; +import { isValidHost } from '@/utils/valid-host'; export const route: Route = { path: '/:site?/:category{.+}?', diff --git a/lib/routes/people/liuyan.ts b/lib/routes/people/liuyan.ts index ab3cbb6f72..4d14873151 100644 --- a/lib/routes/people/liuyan.ts +++ b/lib/routes/people/liuyan.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/people/xjpjh.ts b/lib/routes/people/xjpjh.ts index ed899cf16d..0aa1f01a41 100644 --- a/lib/routes/people/xjpjh.ts +++ b/lib/routes/people/xjpjh.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import * as url from 'node:url'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import * as url from 'node:url'; const host = 'http://jhsjk.people.cn'; diff --git a/lib/routes/peopo/topic.ts b/lib/routes/peopo/topic.ts index 1043ac759e..2fcf23f70a 100644 --- a/lib/routes/peopo/topic.ts +++ b/lib/routes/peopo/topic.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + const baseUrl = 'https://www.peopo.org'; export const route: Route = { diff --git a/lib/routes/phoronix/index.ts b/lib/routes/phoronix/index.ts index 0438af8c52..d4b869742c 100644 --- a/lib/routes/phoronix/index.ts +++ b/lib/routes/phoronix/index.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; -import parser from '@/utils/rss-parser'; import { load } from 'cheerio'; -import got from '@/utils/got'; import dayjs from 'dayjs'; -import utc from 'dayjs/plugin/utc.js'; import timezone from 'dayjs/plugin/timezone.js'; +import utc from 'dayjs/plugin/utc.js'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import ofetch from '@/utils/ofetch'; +import parser from '@/utils/rss-parser'; + dayjs.extend(utc); dayjs.extend(timezone); diff --git a/lib/routes/pianyivps/rss.ts b/lib/routes/pianyivps/rss.ts index 1649363cdf..fdfa1a9818 100644 --- a/lib/routes/pianyivps/rss.ts +++ b/lib/routes/pianyivps/rss.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Route } from '@/types'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/', diff --git a/lib/routes/pianyuan/app.ts b/lib/routes/pianyuan/app.ts index c77c3e1f5f..0b1aae91ec 100644 --- a/lib/routes/pianyuan/app.ts +++ b/lib/routes/pianyuan/app.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/pianyuan/search.ts b/lib/routes/pianyuan/search.ts index e561218241..faefcf8001 100644 --- a/lib/routes/pianyuan/search.ts +++ b/lib/routes/pianyuan/search.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/pianyuan/utils.ts b/lib/routes/pianyuan/utils.ts index de18c2fcd8..35e1cf694d 100644 --- a/lib/routes/pianyuan/utils.ts +++ b/lib/routes/pianyuan/utils.ts @@ -1,7 +1,9 @@ import { load } from 'cheerio'; -import got from '@/utils/got'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import got from '@/utils/got'; + const security_key = 'pianyuan-security_session_verify'; const PHPSESSID_key = 'pianyuan-PHPSESSID'; const loginauth_key = 'pianyuan-py_loginauth'; diff --git a/lib/routes/picnob.info/user.ts b/lib/routes/picnob.info/user.ts index 62bd457e1f..f4b08df473 100644 --- a/lib/routes/picnob.info/user.ts +++ b/lib/routes/picnob.info/user.ts @@ -1,11 +1,14 @@ -import { config } from '@/config'; -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; -import ofetch from '@/utils/ofetch'; -import { Post, Profile, Pull, Status, Story } from './types'; import xxhash from 'xxhash-wasm'; +import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + +import type { Post, Profile, Pull, Status, Story } from './types'; + export const route: Route = { path: '/user/:id/:type?', categories: ['social-media'], diff --git a/lib/routes/picnob/user.ts b/lib/routes/picnob/user.ts index 1a57315352..42af225ee7 100644 --- a/lib/routes/picnob/user.ts +++ b/lib/routes/picnob/user.ts @@ -1,9 +1,12 @@ +import { load } from 'cheerio'; +import type { ConnectResult, Options } from 'puppeteer-real-browser'; +import { connect } from 'puppeteer-real-browser'; + import { config } from '@/config'; -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import { parseRelativeDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; -import { connect, Options, ConnectResult } from 'puppeteer-real-browser'; const realBrowserOption: Options = { args: ['--start-maximized'], diff --git a/lib/routes/picuki/profile.ts b/lib/routes/picuki/profile.ts index 7b1f01b0e9..5525cbf0b6 100644 --- a/lib/routes/picuki/profile.ts +++ b/lib/routes/picuki/profile.ts @@ -1,13 +1,14 @@ -import { DataItem, Route } from '@/types'; - -import cache from '@/utils/cache'; -import { load } from 'cheerio'; -import ofetch from '@/utils/ofetch'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; + import { config } from '@/config'; -import { getPuppeteerPage } from '@/utils/puppeteer'; import NotFoundError from '@/errors/types/not-found'; +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { getPuppeteerPage } from '@/utils/puppeteer'; +import { art } from '@/utils/render'; export const route: Route = { path: '/profile/:id/:type?/:functionalFlag?', diff --git a/lib/routes/pikabu/community.ts b/lib/routes/pikabu/community.ts index e656943ac4..da009163d1 100644 --- a/lib/routes/pikabu/community.ts +++ b/lib/routes/pikabu/community.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { baseUrl, fixImage, fixVideo } from './utils'; export const route: Route = { diff --git a/lib/routes/pikabu/user.ts b/lib/routes/pikabu/user.ts index 34f054f743..6f78330ca6 100644 --- a/lib/routes/pikabu/user.ts +++ b/lib/routes/pikabu/user.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { baseUrl, fixImage, fixVideo } from './utils'; export const route: Route = { diff --git a/lib/routes/pikabu/utils.ts b/lib/routes/pikabu/utils.ts index 4bbb4c2439..6664a291f8 100644 --- a/lib/routes/pikabu/utils.ts +++ b/lib/routes/pikabu/utils.ts @@ -1,6 +1,7 @@ -import { art } from '@/utils/render'; import path from 'node:path'; +import { art } from '@/utils/render'; + const baseUrl = 'https://pikabu.ru'; const fixImage = (element) => { diff --git a/lib/routes/pincong/hot.ts b/lib/routes/pincong/hot.ts index 643577d620..5ddc38ed21 100644 --- a/lib/routes/pincong/hot.ts +++ b/lib/routes/pincong/hot.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; + import { baseUrl, puppeteerGet } from './utils'; export const route: Route = { diff --git a/lib/routes/pincong/index.ts b/lib/routes/pincong/index.ts index 8160dc4823..0efbd7f63a 100644 --- a/lib/routes/pincong/index.ts +++ b/lib/routes/pincong/index.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; + import { baseUrl, puppeteerGet } from './utils'; export const route: Route = { diff --git a/lib/routes/pincong/topic.ts b/lib/routes/pincong/topic.ts index 54418ef1d6..3bbbb3a6ea 100644 --- a/lib/routes/pincong/topic.ts +++ b/lib/routes/pincong/topic.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; + import { baseUrl, puppeteerGet } from './utils'; export const route: Route = { diff --git a/lib/routes/pingwest/status.ts b/lib/routes/pingwest/status.ts index 9031f3895c..132e413ea5 100644 --- a/lib/routes/pingwest/status.ts +++ b/lib/routes/pingwest/status.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/pingwest/tag.ts b/lib/routes/pingwest/tag.ts index 173093ff3d..89fb9f3d04 100644 --- a/lib/routes/pingwest/tag.ts +++ b/lib/routes/pingwest/tag.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/pingwest/user.ts b/lib/routes/pingwest/user.ts index 65b5ace35a..83bace538b 100644 --- a/lib/routes/pingwest/user.ts +++ b/lib/routes/pingwest/user.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/pingwest/utils.ts b/lib/routes/pingwest/utils.ts index 2c5733fbc1..d713cae843 100644 --- a/lib/routes/pingwest/utils.ts +++ b/lib/routes/pingwest/utils.ts @@ -1,4 +1,5 @@ import { load } from 'cheerio'; + import got from '@/utils/got'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/pinterest/user.ts b/lib/routes/pinterest/user.ts index 568e64146d..66376f4c46 100644 --- a/lib/routes/pinterest/user.ts +++ b/lib/routes/pinterest/user.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { BoardsFeedResource, UserActivityPinsResource, UserProfile } from './types'; + +import type { BoardsFeedResource, UserActivityPinsResource, UserProfile } from './types'; export const route: Route = { path: '/user/:username/:type?', diff --git a/lib/routes/pixabay/search.ts b/lib/routes/pixabay/search.ts index 6f117315d7..68d4fb8fa8 100644 --- a/lib/routes/pixabay/search.ts +++ b/lib/routes/pixabay/search.ts @@ -1,10 +1,11 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { config } from '@/config'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/search/:q/:order?', diff --git a/lib/routes/pixelstech/index.ts b/lib/routes/pixelstech/index.ts index 63d14f7446..b74e5a0eb2 100644 --- a/lib/routes/pixelstech/index.ts +++ b/lib/routes/pixelstech/index.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { topic } = ctx.req.param(); diff --git a/lib/routes/pixiv/api/get-bookmarks.ts b/lib/routes/pixiv/api/get-bookmarks.ts index 3250e05769..30f1f3ce2c 100644 --- a/lib/routes/pixiv/api/get-bookmarks.ts +++ b/lib/routes/pixiv/api/get-bookmarks.ts @@ -1,7 +1,8 @@ -import got from '../pixiv-got'; -import { maskHeader } from '../constants'; import queryString from 'query-string'; +import { maskHeader } from '../constants'; +import got from '../pixiv-got'; + /** * 获取用户的收藏 * diff --git a/lib/routes/pixiv/api/get-illust-detail.ts b/lib/routes/pixiv/api/get-illust-detail.ts index 64f524f1f8..543e0895f9 100644 --- a/lib/routes/pixiv/api/get-illust-detail.ts +++ b/lib/routes/pixiv/api/get-illust-detail.ts @@ -1,7 +1,8 @@ -import got from '../pixiv-got'; -import { maskHeader } from '../constants'; import queryString from 'query-string'; +import { maskHeader } from '../constants'; +import got from '../pixiv-got'; + /** * 获取插画详细信息 * @param {string} illust_id 插画作品 id diff --git a/lib/routes/pixiv/api/get-illust-follows.ts b/lib/routes/pixiv/api/get-illust-follows.ts index 404ce35124..af4f157348 100644 --- a/lib/routes/pixiv/api/get-illust-follows.ts +++ b/lib/routes/pixiv/api/get-illust-follows.ts @@ -1,7 +1,8 @@ -import got from '../pixiv-got'; -import { maskHeader } from '../constants'; import queryString from 'query-string'; +import { maskHeader } from '../constants'; +import got from '../pixiv-got'; + /** * 获取用户关注的画师们的最新插画 * @param {string} token pixiv oauth token diff --git a/lib/routes/pixiv/api/get-illusts.ts b/lib/routes/pixiv/api/get-illusts.ts index 409dde7295..266bda9ef9 100644 --- a/lib/routes/pixiv/api/get-illusts.ts +++ b/lib/routes/pixiv/api/get-illusts.ts @@ -1,7 +1,8 @@ -import got from '../pixiv-got'; -import { maskHeader } from '../constants'; import queryString from 'query-string'; +import { maskHeader } from '../constants'; +import got from '../pixiv-got'; + /** * 获取用户插画作品 * @param {string} user_id 目标用户id diff --git a/lib/routes/pixiv/api/get-ranking.ts b/lib/routes/pixiv/api/get-ranking.ts index b7fd154d7b..e91889a1f3 100644 --- a/lib/routes/pixiv/api/get-ranking.ts +++ b/lib/routes/pixiv/api/get-ranking.ts @@ -1,8 +1,10 @@ -import got from '../pixiv-got'; -import { maskHeader } from '../constants'; import assert from 'node:assert'; + import queryString from 'query-string'; +import { maskHeader } from '../constants'; +import got from '../pixiv-got'; + const allowMode = new Set(['day', 'week', 'month', 'day_male', 'day_female', 'day_ai', 'week_original', 'week_rookie', 'day_r18', 'day_r18_ai', 'day_male_r18', 'day_female_r18', 'week_r18', 'week_r18g']); /** diff --git a/lib/routes/pixiv/api/get-user-detail.ts b/lib/routes/pixiv/api/get-user-detail.ts index 6fd24e9093..e06ff6b74a 100644 --- a/lib/routes/pixiv/api/get-user-detail.ts +++ b/lib/routes/pixiv/api/get-user-detail.ts @@ -1,7 +1,8 @@ -import got from '../pixiv-got'; -import { maskHeader } from '../constants'; import queryString from 'query-string'; +import { maskHeader } from '../constants'; +import got from '../pixiv-got'; + /** * pixiv 用户 * @typedef {{user: {id: number, name: string, account: string, profile_image_urls: any, comment: string}, profile: any} userDetail diff --git a/lib/routes/pixiv/api/search-illust.ts b/lib/routes/pixiv/api/search-illust.ts index 064769d790..93e7e7d4ec 100644 --- a/lib/routes/pixiv/api/search-illust.ts +++ b/lib/routes/pixiv/api/search-illust.ts @@ -1,7 +1,8 @@ -import got from '../pixiv-got'; -import { maskHeader } from '../constants'; import queryString from 'query-string'; +import { maskHeader } from '../constants'; +import got from '../pixiv-got'; + /** * 按时间排序搜索内容 * @param {string} keyword 关键词 diff --git a/lib/routes/pixiv/api/search-popular-illust.ts b/lib/routes/pixiv/api/search-popular-illust.ts index a75cf3e15a..e2486d302f 100644 --- a/lib/routes/pixiv/api/search-popular-illust.ts +++ b/lib/routes/pixiv/api/search-popular-illust.ts @@ -1,7 +1,8 @@ -import got from '../pixiv-got'; -import { maskHeader } from '../constants'; import queryString from 'query-string'; +import { maskHeader } from '../constants'; +import got from '../pixiv-got'; + /** * 按热门排序搜索内容 * @param {string} keyword 关键词 diff --git a/lib/routes/pixiv/bookmarks.ts b/lib/routes/pixiv/bookmarks.ts index 0220b09810..dd86b2a023 100644 --- a/lib/routes/pixiv/bookmarks.ts +++ b/lib/routes/pixiv/bookmarks.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { getToken } from './token'; +import { parseDate } from '@/utils/parse-date'; + import getBookmarks from './api/get-bookmarks'; import getUserDetail from './api/get-user-detail'; -import { config } from '@/config'; +import { getToken } from './token'; import pixivUtils from './utils'; -import { parseDate } from '@/utils/parse-date'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; export const route: Route = { path: '/user/bookmarks/:id', diff --git a/lib/routes/pixiv/illustfollow.ts b/lib/routes/pixiv/illustfollow.ts index d4e3f7dcfb..6e90285199 100644 --- a/lib/routes/pixiv/illustfollow.ts +++ b/lib/routes/pixiv/illustfollow.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import { getToken } from './token'; -import getIllustFollows from './api/get-illust-follows'; import { config } from '@/config'; -import pixivUtils from './utils'; -import { parseDate } from '@/utils/parse-date'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { parseDate } from '@/utils/parse-date'; + +import getIllustFollows from './api/get-illust-follows'; +import { getToken } from './token'; +import pixivUtils from './utils'; export const route: Route = { path: '/user/illustfollows', diff --git a/lib/routes/pixiv/novel-api/content/nsfw.ts b/lib/routes/pixiv/novel-api/content/nsfw.ts index 86eab24e67..721ae9ab0d 100644 --- a/lib/routes/pixiv/novel-api/content/nsfw.ts +++ b/lib/routes/pixiv/novel-api/content/nsfw.ts @@ -1,12 +1,14 @@ import { JSDOM, VirtualConsole } from 'jsdom'; -import cache from '@/utils/cache'; -import got from '../../pixiv-got'; -import { maskHeader } from '../../constants'; import queryString from 'query-string'; -import { parseNovelContent } from './utils'; -import type { NovelContent, NSFWNovelDetail } from './types'; + +import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; +import { maskHeader } from '../../constants'; +import got from '../../pixiv-got'; +import type { NovelContent, NSFWNovelDetail } from './types'; +import { parseNovelContent } from './utils'; + export async function getNSFWNovelContent(novelId: string, token: string): Promise { return (await cache.tryGet(`https://app-api.pixiv.net/webview/v2/novel:${novelId}`, async () => { const response = await got('https://app-api.pixiv.net/webview/v2/novel', { diff --git a/lib/routes/pixiv/novel-api/content/sfw.ts b/lib/routes/pixiv/novel-api/content/sfw.ts index c58d2489d9..cec3169996 100644 --- a/lib/routes/pixiv/novel-api/content/sfw.ts +++ b/lib/routes/pixiv/novel-api/content/sfw.ts @@ -1,10 +1,11 @@ -import got from '@/utils/got'; import cache from '@/utils/cache'; -import pixivUtils from '../../utils'; -import { parseNovelContent } from './utils'; -import { NovelContent, SFWNovelDetail } from './types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import pixivUtils from '../../utils'; +import type { NovelContent, SFWNovelDetail } from './types'; +import { parseNovelContent } from './utils'; + const baseUrl = 'https://www.pixiv.net'; export async function getSFWNovelContent(novelId: string): Promise { diff --git a/lib/routes/pixiv/novel-api/content/utils.ts b/lib/routes/pixiv/novel-api/content/utils.ts index cbb0d4e0a3..b440798dd3 100644 --- a/lib/routes/pixiv/novel-api/content/utils.ts +++ b/lib/routes/pixiv/novel-api/content/utils.ts @@ -1,7 +1,9 @@ import { load } from 'cheerio'; + +import logger from '@/utils/logger'; + import getIllustDetail from '../../api/get-illust-detail'; import pixivUtils from '../../utils'; -import logger from '@/utils/logger'; export function convertPixivProtocolExtended(caption: string): string { const protocolMap = new Map([ diff --git a/lib/routes/pixiv/novel-api/series/nsfw.ts b/lib/routes/pixiv/novel-api/series/nsfw.ts index bb230fe19c..cb8db08327 100644 --- a/lib/routes/pixiv/novel-api/series/nsfw.ts +++ b/lib/routes/pixiv/novel-api/series/nsfw.ts @@ -1,14 +1,16 @@ -import got from '../../pixiv-got'; -import { maskHeader } from '../../constants'; -import { getNSFWNovelContent } from '../content/nsfw'; -import pixivUtils from '../../utils'; -import { AppNovelSeries, SeriesDetail, SeriesFeed } from './types'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; -import { getToken } from '../../token'; -import { config } from '@/config'; -import cache from '@/utils/cache'; import queryString from 'query-string'; +import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import cache from '@/utils/cache'; + +import { maskHeader } from '../../constants'; +import got from '../../pixiv-got'; +import { getToken } from '../../token'; +import pixivUtils from '../../utils'; +import { getNSFWNovelContent } from '../content/nsfw'; +import type { AppNovelSeries, SeriesDetail, SeriesFeed } from './types'; + const baseUrl = 'https://www.pixiv.net'; async function getNovelSeries(seriesId: string, offset: number, token: string): Promise { diff --git a/lib/routes/pixiv/novel-api/series/sfw.ts b/lib/routes/pixiv/novel-api/series/sfw.ts index d9e3d45ca5..0b4b0cf3f4 100644 --- a/lib/routes/pixiv/novel-api/series/sfw.ts +++ b/lib/routes/pixiv/novel-api/series/sfw.ts @@ -1,8 +1,10 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; -import { getSFWNovelContent } from '../content/sfw'; + +import got from '@/utils/got'; + import pixivUtils from '../../utils'; -import { SeriesContentResponse, SeriesFeed } from './types'; +import { getSFWNovelContent } from '../content/sfw'; +import type { SeriesContentResponse, SeriesFeed } from './types'; const baseUrl = 'https://www.pixiv.net'; diff --git a/lib/routes/pixiv/novel-api/user-novels/nsfw.ts b/lib/routes/pixiv/novel-api/user-novels/nsfw.ts index b55f188e00..db9a896deb 100644 --- a/lib/routes/pixiv/novel-api/user-novels/nsfw.ts +++ b/lib/routes/pixiv/novel-api/user-novels/nsfw.ts @@ -1,16 +1,18 @@ -import got from '../../pixiv-got'; -import { maskHeader } from '../../constants'; import queryString from 'query-string'; + import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import cache from '@/utils/cache'; +import { parseDate } from '@/utils/parse-date'; + +import { maskHeader } from '../../constants'; +import got from '../../pixiv-got'; +import { getToken } from '../../token'; import pixivUtils from '../../utils'; import { getNSFWNovelContent } from '../content/nsfw'; -import { parseDate } from '@/utils/parse-date'; import { convertPixivProtocolExtended } from '../content/utils'; -import type { NSFWNovelsResponse, NovelList } from './types'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; -import cache from '@/utils/cache'; -import { getToken } from '../../token'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { NovelList, NSFWNovelsResponse } from './types'; function getNovels(user_id: string, token: string): Promise { return got('https://app-api.pixiv.net/v1/user/novels', { diff --git a/lib/routes/pixiv/novel-api/user-novels/sfw.ts b/lib/routes/pixiv/novel-api/user-novels/sfw.ts index ce7fbed896..61b3b8bd05 100644 --- a/lib/routes/pixiv/novel-api/user-novels/sfw.ts +++ b/lib/routes/pixiv/novel-api/user-novels/sfw.ts @@ -1,8 +1,9 @@ import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import pixivUtils from '../../utils'; import { getSFWNovelContent } from '../content/sfw'; -import type { SFWNovelsResponse, NovelList } from './types'; +import type { NovelList, SFWNovelsResponse } from './types'; const baseUrl = 'https://www.pixiv.net'; diff --git a/lib/routes/pixiv/novel-series.ts b/lib/routes/pixiv/novel-series.ts index 6343be281c..4f1097a887 100644 --- a/lib/routes/pixiv/novel-series.ts +++ b/lib/routes/pixiv/novel-series.ts @@ -1,9 +1,10 @@ -import { Data, Route } from '@/types'; import { config } from '@/config'; +import type { Data, Route } from '@/types'; +import got from '@/utils/got'; + import { getNSFWSeriesNovels } from './novel-api/series/nsfw'; import { getSFWSeriesNovels } from './novel-api/series/sfw'; -import { SeriesDetail } from './novel-api/series/types'; -import got from '@/utils/got'; +import type { SeriesDetail } from './novel-api/series/types'; const baseUrl = 'https://www.pixiv.net'; diff --git a/lib/routes/pixiv/novels.ts b/lib/routes/pixiv/novels.ts index 1ea94c2422..6eff8472a9 100644 --- a/lib/routes/pixiv/novels.ts +++ b/lib/routes/pixiv/novels.ts @@ -1,9 +1,11 @@ -import { Data, Route, ViewType } from '@/types'; -import { fallback, queryToBoolean } from '@/utils/readable-social'; import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Data, Route} from '@/types'; +import { ViewType } from '@/types'; +import { fallback, queryToBoolean } from '@/utils/readable-social'; + import { getNSFWUserNovels } from './novel-api/user-novels/nsfw'; import { getSFWUserNovels } from './novel-api/user-novels/sfw'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; export const route: Route = { path: '/user/novels/:id/:full_content?', diff --git a/lib/routes/pixiv/pixiv-got.ts b/lib/routes/pixiv/pixiv-got.ts index a935500c82..d1eafa7022 100644 --- a/lib/routes/pixiv/pixiv-got.ts +++ b/lib/routes/pixiv/pixiv-got.ts @@ -1,8 +1,10 @@ import tls from 'node:tls'; + import ipRegex from 'ip-regex'; + +import { config } from '@/config'; import got from '@/utils/got'; import logger from '@/utils/logger'; -import { config } from '@/config'; async function dohResolve(name, jsonDohEndpoint) { try { diff --git a/lib/routes/pixiv/ranking.ts b/lib/routes/pixiv/ranking.ts index 7422ba25fe..84bc503ae6 100644 --- a/lib/routes/pixiv/ranking.ts +++ b/lib/routes/pixiv/ranking.ts @@ -1,11 +1,13 @@ -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; -import { getToken } from './token'; -import getRanking from './api/get-ranking'; import { config } from '@/config'; -import pixivUtils from './utils'; -import { parseDate } from '@/utils/parse-date'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import { parseDate } from '@/utils/parse-date'; + +import getRanking from './api/get-ranking'; +import { getToken } from './token'; +import pixivUtils from './utils'; const titles = { day: 'pixiv 日排行', diff --git a/lib/routes/pixiv/search.ts b/lib/routes/pixiv/search.ts index 080040d312..5ee9924c2f 100644 --- a/lib/routes/pixiv/search.ts +++ b/lib/routes/pixiv/search.ts @@ -1,12 +1,14 @@ -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; -import { getToken } from './token'; -import searchPopularIllust from './api/search-popular-illust'; -import searchIllust from './api/search-illust'; import { config } from '@/config'; -import pixivUtils from './utils'; -import { parseDate } from '@/utils/parse-date'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import { parseDate } from '@/utils/parse-date'; + +import searchIllust from './api/search-illust'; +import searchPopularIllust from './api/search-popular-illust'; +import { getToken } from './token'; +import pixivUtils from './utils'; export const route: Route = { path: '/search/:keyword/:order?/:mode?/:include_ai?', diff --git a/lib/routes/pixiv/token.ts b/lib/routes/pixiv/token.ts index 98356a0579..c087a27007 100644 --- a/lib/routes/pixiv/token.ts +++ b/lib/routes/pixiv/token.ts @@ -1,7 +1,8 @@ import { config } from '@/config'; import logger from '@/utils/logger'; -import got from './pixiv-got'; + import { maskHeader } from './constants'; +import got from './pixiv-got'; let token = null; diff --git a/lib/routes/pixiv/user.ts b/lib/routes/pixiv/user.ts index ca074aabe0..baf25f5667 100644 --- a/lib/routes/pixiv/user.ts +++ b/lib/routes/pixiv/user.ts @@ -1,11 +1,13 @@ -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; -import { getToken } from './token'; -import getIllusts from './api/get-illusts'; import { config } from '@/config'; -import pixivUtils from './utils'; -import { parseDate } from '@/utils/parse-date'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import { parseDate } from '@/utils/parse-date'; + +import getIllusts from './api/get-illusts'; +import { getToken } from './token'; +import pixivUtils from './utils'; export const route: Route = { path: '/user/:id', diff --git a/lib/routes/pixivision/index.ts b/lib/routes/pixivision/index.ts index 71df03218d..d397b7875d 100644 --- a/lib/routes/pixivision/index.ts +++ b/lib/routes/pixivision/index.ts @@ -1,8 +1,11 @@ -import { Route, DataItem, Data, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Data, DataItem, Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + import { processContent } from './utils'; export const route: Route = { diff --git a/lib/routes/pixivision/utils.ts b/lib/routes/pixivision/utils.ts index ac05698fa9..ad07b8e1c3 100644 --- a/lib/routes/pixivision/utils.ts +++ b/lib/routes/pixivision/utils.ts @@ -1,4 +1,5 @@ -import { CheerioAPI } from 'cheerio'; +import type { CheerioAPI } from 'cheerio'; + import { config } from '@/config'; const multiImagePrompt = { diff --git a/lib/routes/piyao/jrpy.ts b/lib/routes/piyao/jrpy.ts index 3774ca096e..a08218d6e4 100644 --- a/lib/routes/piyao/jrpy.ts +++ b/lib/routes/piyao/jrpy.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootUrl = 'https://www.piyao.org.cn'; diff --git a/lib/routes/pkmer/recent.ts b/lib/routes/pkmer/recent.ts index 2ef02f69d0..d5da8b2018 100644 --- a/lib/routes/pkmer/recent.ts +++ b/lib/routes/pkmer/recent.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + const baseUrl = 'https://pkmer.cn'; export const route: Route = { diff --git a/lib/routes/pku/bbs/hot.ts b/lib/routes/pku/bbs/hot.ts index c1f29e8e84..c621c8fc63 100644 --- a/lib/routes/pku/bbs/hot.ts +++ b/lib/routes/pku/bbs/hot.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import { config } from '@/config'; import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/pku/cls/announcement.ts b/lib/routes/pku/cls/announcement.ts index 9523afe060..d01a788f61 100644 --- a/lib/routes/pku/cls/announcement.ts +++ b/lib/routes/pku/cls/announcement.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const homeUrl = 'https://bio.pku.edu.cn/homes/Index/news/21/21.html'; diff --git a/lib/routes/pku/cls/lecture.ts b/lib/routes/pku/cls/lecture.ts index 5f31cd64e2..3582926be1 100644 --- a/lib/routes/pku/cls/lecture.ts +++ b/lib/routes/pku/cls/lecture.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const homeUrl = 'http://bio.pku.edu.cn/homes/Index/news_jz/7/7.html'; diff --git a/lib/routes/pku/eecs.ts b/lib/routes/pku/eecs.ts index 2d336cd33d..3f7de9c437 100644 --- a/lib/routes/pku/eecs.ts +++ b/lib/routes/pku/eecs.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { eecsMap } from './utils'; diff --git a/lib/routes/pku/hr.ts b/lib/routes/pku/hr.ts index 3ced800a0c..5d271eedc0 100644 --- a/lib/routes/pku/hr.ts +++ b/lib/routes/pku/hr.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/pku/nsd.ts b/lib/routes/pku/nsd.ts index 1bc3011a84..a72fe87e1c 100644 --- a/lib/routes/pku/nsd.ts +++ b/lib/routes/pku/nsd.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { finishArticleItem } from '@/utils/wechat-mp'; import { parseDate } from '@/utils/parse-date'; +import { finishArticleItem } from '@/utils/wechat-mp'; const baseUrl = 'https://nsd.pku.edu.cn/sylm/gd/'; diff --git a/lib/routes/pku/pkuyjs.ts b/lib/routes/pku/pkuyjs.ts index 9b174f7fb0..b89eec7406 100644 --- a/lib/routes/pku/pkuyjs.ts +++ b/lib/routes/pku/pkuyjs.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/pku/rccp/mzyt.ts b/lib/routes/pku/rccp/mzyt.ts index 69af2b0d9d..26cd5ccd5e 100644 --- a/lib/routes/pku/rccp/mzyt.ts +++ b/lib/routes/pku/rccp/mzyt.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + const baseUrl = 'https://www.rccp.pku.edu.cn/mzyt/'; export const route: Route = { diff --git a/lib/routes/pku/scc/recruit.ts b/lib/routes/pku/scc/recruit.ts index 9116f9c669..7d16d5cec9 100644 --- a/lib/routes/pku/scc/recruit.ts +++ b/lib/routes/pku/scc/recruit.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const arr = { diff --git a/lib/routes/pku/ss/admission.ts b/lib/routes/pku/ss/admission.ts index 267ada8b0f..5fb012521a 100644 --- a/lib/routes/pku/ss/admission.ts +++ b/lib/routes/pku/ss/admission.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { baseUrl, getSingleRecord, getArticle } from './common'; + +import { baseUrl, getArticle, getSingleRecord } from './common'; const host = `${baseUrl}/admission/admnotice/`; diff --git a/lib/routes/pku/ss/common.ts b/lib/routes/pku/ss/common.ts index 21ec500e88..e7416191ef 100644 --- a/lib/routes/pku/ss/common.ts +++ b/lib/routes/pku/ss/common.ts @@ -1,5 +1,6 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://www.ss.pku.edu.cn'; @@ -30,4 +31,4 @@ const getArticle = (item, tryGet) => return item; }); -export { baseUrl, getSingleRecord, getArticle }; +export { baseUrl, getArticle, getSingleRecord }; diff --git a/lib/routes/pku/ss/notice.ts b/lib/routes/pku/ss/notice.ts index 265675369e..b00bf22a3a 100644 --- a/lib/routes/pku/ss/notice.ts +++ b/lib/routes/pku/ss/notice.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { baseUrl, getSingleRecord, getArticle } from './common'; + +import { baseUrl, getArticle, getSingleRecord } from './common'; const host = `${baseUrl}/newscenter/notice/`; diff --git a/lib/routes/pku/ss/pg-admin.ts b/lib/routes/pku/ss/pg-admin.ts index ef6dbc21fc..f16b7ccb8e 100644 --- a/lib/routes/pku/ss/pg-admin.ts +++ b/lib/routes/pku/ss/pg-admin.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { baseUrl, getSingleRecord, getArticle } from './common'; + +import { baseUrl, getArticle, getSingleRecord } from './common'; const host = `${baseUrl}/admission/admbrochure/`; diff --git a/lib/routes/playno1/av.ts b/lib/routes/playno1/av.ts index b3c1e3c99f..04956e769c 100644 --- a/lib/routes/playno1/av.ts +++ b/lib/routes/playno1/av.ts @@ -1,10 +1,13 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { cookieJar, processArticle } from './utils'; + const baseUrl = 'http://www.playno1.com'; export const route: Route = { diff --git a/lib/routes/playno1/st.ts b/lib/routes/playno1/st.ts index bda62fa98c..653540e4f5 100644 --- a/lib/routes/playno1/st.ts +++ b/lib/routes/playno1/st.ts @@ -1,10 +1,13 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { cookieJar, processArticle } from './utils'; + const baseUrl = 'http://stno1.playno1.com'; export const route: Route = { diff --git a/lib/routes/playno1/utils.ts b/lib/routes/playno1/utils.ts index 10cbe66f89..4a4681b5be 100644 --- a/lib/routes/playno1/utils.ts +++ b/lib/routes/playno1/utils.ts @@ -1,6 +1,8 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; -import { CookieJar, Cookie } from 'tough-cookie'; +import { Cookie, CookieJar } from 'tough-cookie'; + +import got from '@/utils/got'; + const cookieJar = new CookieJar(); const cookie = Cookie.fromJSON({ key: 'playno1', diff --git a/lib/routes/playpcesor/rss.ts b/lib/routes/playpcesor/rss.ts index ce01a36603..9c212b8165 100644 --- a/lib/routes/playpcesor/rss.ts +++ b/lib/routes/playpcesor/rss.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + export const route: Route = { path: '/', categories: ['blog'], diff --git a/lib/routes/plurk/anonymous.ts b/lib/routes/plurk/anonymous.ts index 453e768671..7ee88d6595 100644 --- a/lib/routes/plurk/anonymous.ts +++ b/lib/routes/plurk/anonymous.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; + import { baseUrl, getPlurk } from './utils'; export const route: Route = { diff --git a/lib/routes/plurk/hotlinks.ts b/lib/routes/plurk/hotlinks.ts index 503ef59a6a..b655243f09 100644 --- a/lib/routes/plurk/hotlinks.ts +++ b/lib/routes/plurk/hotlinks.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; + import { baseUrl, getPlurk } from './utils'; export const route: Route = { diff --git a/lib/routes/plurk/news.ts b/lib/routes/plurk/news.ts index 29a9a1c1dd..45557a02fb 100644 --- a/lib/routes/plurk/news.ts +++ b/lib/routes/plurk/news.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; + import { baseUrl, fetchFriends, getPlurk } from './utils'; export const route: Route = { diff --git a/lib/routes/plurk/search.ts b/lib/routes/plurk/search.ts index 58764cb404..f14fcdc344 100644 --- a/lib/routes/plurk/search.ts +++ b/lib/routes/plurk/search.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; +import dayjs from 'dayjs'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import dayjs from 'dayjs'; + import { baseUrl, getPlurk } from './utils'; export const route: Route = { diff --git a/lib/routes/plurk/top.ts b/lib/routes/plurk/top.ts index 3c65320f10..b3ad3992dc 100644 --- a/lib/routes/plurk/top.ts +++ b/lib/routes/plurk/top.ts @@ -1,8 +1,10 @@ -import { Route, ViewType } from '@/types'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; + import { baseUrl, getPlurk } from './utils'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const categoryList = new Set(['topReplurks', 'topFavorites', 'topResponded']); diff --git a/lib/routes/plurk/topic.ts b/lib/routes/plurk/topic.ts index 3c2b2fb603..886646994b 100644 --- a/lib/routes/plurk/topic.ts +++ b/lib/routes/plurk/topic.ts @@ -1,7 +1,10 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import { baseUrl, fetchFriends, getPlurk } from './utils'; export const route: Route = { diff --git a/lib/routes/plurk/user.ts b/lib/routes/plurk/user.ts index 7fcf353ce5..7c629b0832 100644 --- a/lib/routes/plurk/user.ts +++ b/lib/routes/plurk/user.ts @@ -1,7 +1,10 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import { baseUrl, fetchFriends, getPlurk } from './utils'; export const route: Route = { diff --git a/lib/routes/plurk/utils.ts b/lib/routes/plurk/utils.ts index 730354fa15..a070ac7822 100644 --- a/lib/routes/plurk/utils.ts +++ b/lib/routes/plurk/utils.ts @@ -1,5 +1,6 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://www.plurk.com'; diff --git a/lib/routes/pnas/index.ts b/lib/routes/pnas/index.ts index 1e3516371c..28a92fffa1 100644 --- a/lib/routes/pnas/index.ts +++ b/lib/routes/pnas/index.ts @@ -1,15 +1,16 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; -import { load } from 'cheerio'; -import got from '@/utils/got'; -import { parseDate } from '@/utils/parse-date'; -import { art } from '@/utils/render'; import path from 'node:path'; -import { setCookies } from '@/utils/puppeteer-utils'; + +import { load } from 'cheerio'; import { CookieJar } from 'tough-cookie'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import logger from '@/utils/logger'; +import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; +import { setCookies } from '@/utils/puppeteer-utils'; +import { art } from '@/utils/render'; export const route: Route = { path: '/:topicPath{.+}?', diff --git a/lib/routes/podwise/collections.ts b/lib/routes/podwise/collections.ts index 98ee10118a..cd2f531a62 100644 --- a/lib/routes/podwise/collections.ts +++ b/lib/routes/podwise/collections.ts @@ -1,5 +1,7 @@ -import { Route, ViewType } from '@/types'; import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; // 统一使用的请求库 export const route: Route = { diff --git a/lib/routes/podwise/episodes.ts b/lib/routes/podwise/episodes.ts index 5a4ac23a35..915205b67c 100644 --- a/lib/routes/podwise/episodes.ts +++ b/lib/routes/podwise/episodes.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; -import ofetch from '@/utils/ofetch'; // 统一使用的请求库 -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import dayjs from 'dayjs'; import duration from 'dayjs/plugin/duration.js'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; // 统一使用的请求库 +import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; + dayjs.extend(duration); export const route: Route = { diff --git a/lib/routes/pornhub/category-url.ts b/lib/routes/pornhub/category-url.ts index 7f190f6f0c..ae583e23fb 100644 --- a/lib/routes/pornhub/category-url.ts +++ b/lib/routes/pornhub/category-url.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { isValidHost } from '@/utils/valid-host'; -import { headers, parseItems } from './utils'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { isValidHost } from '@/utils/valid-host'; + +import { headers, parseItems } from './utils'; export const route: Route = { path: '/category_url/:url?/:language?', diff --git a/lib/routes/pornhub/category.ts b/lib/routes/pornhub/category.ts index a5d271608e..5dca3a3232 100644 --- a/lib/routes/pornhub/category.ts +++ b/lib/routes/pornhub/category.ts @@ -1,9 +1,11 @@ -import { Route, ViewType } from '@/types'; +import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { defaultDomain, renderDescription } from './utils'; -import { config } from '@/config'; export const route: Route = { path: '/category/:caty', diff --git a/lib/routes/pornhub/model.ts b/lib/routes/pornhub/model.ts index 910c90d399..cb53a52c4c 100644 --- a/lib/routes/pornhub/model.ts +++ b/lib/routes/pornhub/model.ts @@ -1,9 +1,12 @@ -import { Route, ViewType, Data } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { isValidHost } from '@/utils/valid-host'; -import { headers, parseItems, getRadarDomin } from './utils'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Data, Route } from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; +import { isValidHost } from '@/utils/valid-host'; + +import { getRadarDomin, headers, parseItems } from './utils'; export const route: Route = { path: '/model/:username/:language?/:sort?', diff --git a/lib/routes/pornhub/pornstar.ts b/lib/routes/pornhub/pornstar.ts index 092619b5b7..06489745e8 100644 --- a/lib/routes/pornhub/pornstar.ts +++ b/lib/routes/pornhub/pornstar.ts @@ -1,9 +1,12 @@ -import { Route, ViewType, Data } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { isValidHost } from '@/utils/valid-host'; -import { headers, parseItems, getRadarDomin } from './utils'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Data, Route } from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; +import { isValidHost } from '@/utils/valid-host'; + +import { getRadarDomin, headers, parseItems } from './utils'; export const route: Route = { path: '/pornstar/:username/:language?/:sort?', diff --git a/lib/routes/pornhub/search.ts b/lib/routes/pornhub/search.ts index 56dd63fde2..03cb877ebf 100644 --- a/lib/routes/pornhub/search.ts +++ b/lib/routes/pornhub/search.ts @@ -1,6 +1,8 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { defaultDomain, renderDescription } from './utils'; export const route: Route = { diff --git a/lib/routes/pornhub/users.ts b/lib/routes/pornhub/users.ts index 7dbfb4a4ff..b14991ac52 100644 --- a/lib/routes/pornhub/users.ts +++ b/lib/routes/pornhub/users.ts @@ -1,9 +1,11 @@ -import { Route, Data } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { isValidHost } from '@/utils/valid-host'; -import { headers, parseItems, getRadarDomin } from './utils'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Data, Route } from '@/types'; +import got from '@/utils/got'; +import { isValidHost } from '@/utils/valid-host'; + +import { getRadarDomin, headers, parseItems } from './utils'; export const route: Route = { path: '/users/:username/:language?', diff --git a/lib/routes/pornhub/utils.ts b/lib/routes/pornhub/utils.ts index 3d12923704..0d65e0ee3a 100644 --- a/lib/routes/pornhub/utils.ts +++ b/lib/routes/pornhub/utils.ts @@ -1,8 +1,10 @@ -import { art } from '@/utils/render'; import path from 'node:path'; -import { parseRelativeDate } from '@/utils/parse-date'; + import dayjs from 'dayjs'; +import { parseRelativeDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + const defaultDomain = 'https://www.pornhub.com'; const headers = { @@ -38,4 +40,4 @@ const getRadarDomin = (path: string) => [ })), ]; -export { defaultDomain, headers, renderDescription, parseItems, getRadarDomin }; +export { defaultDomain, getRadarDomin, headers, parseItems, renderDescription }; diff --git a/lib/routes/postman/release-notes.ts b/lib/routes/postman/release-notes.ts index 9fa903c26a..ef3d53e29c 100644 --- a/lib/routes/postman/release-notes.ts +++ b/lib/routes/postman/release-notes.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; + const md = MarkdownIt({ html: true, }); diff --git a/lib/routes/priconne-redive/news.ts b/lib/routes/priconne-redive/news.ts index 2da7840083..b0a096d7af 100644 --- a/lib/routes/priconne-redive/news.ts +++ b/lib/routes/priconne-redive/news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import got from '@/utils/got'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + export const route: Route = { path: '/news/:server?', categories: ['game'], diff --git a/lib/routes/producthunt/today.ts b/lib/routes/producthunt/today.ts index cd1804e6dc..75ce3e89d7 100644 --- a/lib/routes/producthunt/today.ts +++ b/lib/routes/producthunt/today.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { config } from '@/config'; export const route: Route = { path: '/today', diff --git a/lib/routes/ps/monthly-games.ts b/lib/routes/ps/monthly-games.ts index ead30ee64a..3306da329a 100644 --- a/lib/routes/ps/monthly-games.ts +++ b/lib/routes/ps/monthly-games.ts @@ -1,8 +1,10 @@ -import { Route, ViewType } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; import { art } from '@/utils/render'; export const route: Route = { diff --git a/lib/routes/ps/trophy.ts b/lib/routes/ps/trophy.ts index 3729fda21a..f1554247d5 100644 --- a/lib/routes/ps/trophy.ts +++ b/lib/routes/ps/trophy.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/trophy/:id', categories: ['game'], diff --git a/lib/routes/psnine/game.ts b/lib/routes/psnine/game.ts index a9960ab2d7..8481ce6dc0 100644 --- a/lib/routes/psnine/game.ts +++ b/lib/routes/psnine/game.ts @@ -1,8 +1,8 @@ -import type { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; import * as cheerio from 'cheerio'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + const handler = async () => { const url = 'https://www.psnine.com/psngame'; const response = await ofetch(url); diff --git a/lib/routes/psnine/index.ts b/lib/routes/psnine/index.ts index 095a9b30f0..0cff6134cc 100644 --- a/lib/routes/psnine/index.ts +++ b/lib/routes/psnine/index.ts @@ -1,7 +1,7 @@ -import type { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; import * as cheerio from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseRelativeDate } from '@/utils/parse-date'; const handler = async () => { diff --git a/lib/routes/psnine/node.ts b/lib/routes/psnine/node.ts index 47823c7efc..47e7642d3b 100644 --- a/lib/routes/psnine/node.ts +++ b/lib/routes/psnine/node.ts @@ -1,10 +1,10 @@ -import type { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; import * as cheerio from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import cache from '@/utils/cache'; const handler = async (ctx) => { const { id = 'news', order = 'obdate' } = ctx.req.param(); diff --git a/lib/routes/psnine/shuzhe.ts b/lib/routes/psnine/shuzhe.ts index 312dd8022a..2cb7390b83 100644 --- a/lib/routes/psnine/shuzhe.ts +++ b/lib/routes/psnine/shuzhe.ts @@ -1,8 +1,8 @@ -import type { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; import * as cheerio from 'cheerio'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + const handler = async () => { const url = 'https://www.psnine.com/dd'; const response = await ofetch(url); diff --git a/lib/routes/psnine/trade.ts b/lib/routes/psnine/trade.ts index 9a926c8e1a..a7c25d604a 100644 --- a/lib/routes/psnine/trade.ts +++ b/lib/routes/psnine/trade.ts @@ -1,7 +1,7 @@ -import type { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; import * as cheerio from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseRelativeDate } from '@/utils/parse-date'; const handler = async () => { diff --git a/lib/routes/psyche/topic.ts b/lib/routes/psyche/topic.ts index 5c60346974..cf488fe9fa 100644 --- a/lib/routes/psyche/topic.ts +++ b/lib/routes/psyche/topic.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; + import { getData } from './utils'; export const route: Route = { diff --git a/lib/routes/psyche/type.ts b/lib/routes/psyche/type.ts index f4dbaeca42..56c3ac7e96 100644 --- a/lib/routes/psyche/type.ts +++ b/lib/routes/psyche/type.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; -import { getData } from './utils'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import { getData } from './utils'; + export const route: Route = { path: '/type/:type', categories: ['new-media'], diff --git a/lib/routes/psyche/utils.ts b/lib/routes/psyche/utils.ts index 52cba2aa37..8e6cdc2057 100644 --- a/lib/routes/psyche/utils.ts +++ b/lib/routes/psyche/utils.ts @@ -1,8 +1,10 @@ +import path from 'node:path'; + +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { art } from '@/utils/render'; -import path from 'node:path'; const getImageById = async (id) => { const response = await ofetch('https://api.aeonmedia.co/graphql', { diff --git a/lib/routes/pts/curations.ts b/lib/routes/pts/curations.ts index 372090843d..3bdded7237 100644 --- a/lib/routes/pts/curations.ts +++ b/lib/routes/pts/curations.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/curations', diff --git a/lib/routes/pts/index.ts b/lib/routes/pts/index.ts index ddd49bfc33..d8899e01ca 100644 --- a/lib/routes/pts/index.ts +++ b/lib/routes/pts/index.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; +import path from 'node:path'; -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 type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '*', diff --git a/lib/routes/pts/live.ts b/lib/routes/pts/live.ts index 5ecc57d8bb..bb7bcd4715 100644 --- a/lib/routes/pts/live.ts +++ b/lib/routes/pts/live.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/live/:id', diff --git a/lib/routes/pts/projects.ts b/lib/routes/pts/projects.ts index 9452b8ac05..fc74e190bf 100644 --- a/lib/routes/pts/projects.ts +++ b/lib/routes/pts/projects.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/projects', diff --git a/lib/routes/publico/ciencias.ts b/lib/routes/publico/ciencias.ts index 9bd842ff86..9740e3a4c1 100644 --- a/lib/routes/publico/ciencias.ts +++ b/lib/routes/publico/ciencias.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + import getItems from './items-processor'; export const route: Route = { diff --git a/lib/routes/publico/culturas.ts b/lib/routes/publico/culturas.ts index dd344c549f..f9dd2b542c 100644 --- a/lib/routes/publico/culturas.ts +++ b/lib/routes/publico/culturas.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + import getItems from './items-processor'; export const route: Route = { diff --git a/lib/routes/publico/economia.ts b/lib/routes/publico/economia.ts index be998d28c7..4ed7ffb76a 100644 --- a/lib/routes/publico/economia.ts +++ b/lib/routes/publico/economia.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + import getItems from './items-processor'; export const route: Route = { diff --git a/lib/routes/publico/internacional.ts b/lib/routes/publico/internacional.ts index 7ea2b15c07..69722da629 100644 --- a/lib/routes/publico/internacional.ts +++ b/lib/routes/publico/internacional.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + import getItems from './items-processor'; export const route: Route = { diff --git a/lib/routes/publico/mujer.ts b/lib/routes/publico/mujer.ts index e5d2438b87..85b25691a0 100644 --- a/lib/routes/publico/mujer.ts +++ b/lib/routes/publico/mujer.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + import getItems from './items-processor'; export const route: Route = { diff --git a/lib/routes/publico/opinion.ts b/lib/routes/publico/opinion.ts index 6cd7595d77..623e7b2660 100644 --- a/lib/routes/publico/opinion.ts +++ b/lib/routes/publico/opinion.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + import getItems from './items-processor'; export const route: Route = { diff --git a/lib/routes/publico/politica.ts b/lib/routes/publico/politica.ts index 75e464d143..975d508199 100644 --- a/lib/routes/publico/politica.ts +++ b/lib/routes/publico/politica.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + import getItems from './items-processor'; export const route: Route = { diff --git a/lib/routes/publico/public.ts b/lib/routes/publico/public.ts index 6bb15a7dd5..a60624da64 100644 --- a/lib/routes/publico/public.ts +++ b/lib/routes/publico/public.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + import getItems from './items-processor'; export const route: Route = { diff --git a/lib/routes/publico/sociedad.ts b/lib/routes/publico/sociedad.ts index ff02395d83..35e506c2e5 100644 --- a/lib/routes/publico/sociedad.ts +++ b/lib/routes/publico/sociedad.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + import getItems from './items-processor'; export const route: Route = { diff --git a/lib/routes/publico/tremending.ts b/lib/routes/publico/tremending.ts index 7692662a1b..55994b38f5 100644 --- a/lib/routes/publico/tremending.ts +++ b/lib/routes/publico/tremending.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + import getItems from './items-processor'; export const route: Route = { diff --git a/lib/routes/pubmed/trending.ts b/lib/routes/pubmed/trending.ts index 5f114f74ef..b9db7b59d8 100644 --- a/lib/routes/pubmed/trending.ts +++ b/lib/routes/pubmed/trending.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/trending/:filters?', diff --git a/lib/routes/pubscholar/explore.ts b/lib/routes/pubscholar/explore.ts index 66c24df353..cee31ba776 100644 --- a/lib/routes/pubscholar/explore.ts +++ b/lib/routes/pubscholar/explore.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import sanitizeHtml from 'sanitize-html'; + +import type { Route } from '@/types'; +import md5 from '@/utils/md5'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { baseUrl, uuidv4, getArticleLink, getSignedHeaders } from './utils'; -import md5 from '@/utils/md5'; -import { Resource } from './types'; -import sanitizeHtml from 'sanitize-html'; + +import type { Resource } from './types'; +import { baseUrl, getArticleLink, getSignedHeaders, uuidv4 } from './utils'; export const route: Route = { path: '/explore/:category?/:keyword?', diff --git a/lib/routes/pubscholar/utils.ts b/lib/routes/pubscholar/utils.ts index 4fa71fac04..5c894ee07d 100644 --- a/lib/routes/pubscholar/utils.ts +++ b/lib/routes/pubscholar/utils.ts @@ -1,4 +1,5 @@ import crypto from 'node:crypto'; + import CryptoJS from 'crypto-js'; const salt = '6m6pingbinwaktg227gngifoocrfbo95'; diff --git a/lib/routes/pumc/mdadmission.ts b/lib/routes/pumc/mdadmission.ts index 405c9df241..da0ce1f2ab 100644 --- a/lib/routes/pumc/mdadmission.ts +++ b/lib/routes/pumc/mdadmission.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/putty/changes.ts b/lib/routes/putty/changes.ts index d108a855ff..0037c89c52 100644 --- a/lib/routes/putty/changes.ts +++ b/lib/routes/putty/changes.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/pwc/sustainability.ts b/lib/routes/pwc/sustainability.ts index 91c45fd85c..653fbab531 100644 --- a/lib/routes/pwc/sustainability.ts +++ b/lib/routes/pwc/sustainability.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; interface PlayerOptions { link: string; diff --git a/lib/routes/python/release.ts b/lib/routes/python/release.ts index bd77fdc17e..25c2e63784 100644 --- a/lib/routes/python/release.ts +++ b/lib/routes/python/release.ts @@ -1,13 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/qbitai/category.ts b/lib/routes/qbitai/category.ts index 990e7475b8..da4f31e306 100644 --- a/lib/routes/qbitai/category.ts +++ b/lib/routes/qbitai/category.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import parser from '@/utils/rss-parser'; -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import parser from '@/utils/rss-parser'; export const route: Route = { path: '/category/:category', diff --git a/lib/routes/qbitai/tag.ts b/lib/routes/qbitai/tag.ts index edea512d1d..7abf96a14e 100644 --- a/lib/routes/qbitai/tag.ts +++ b/lib/routes/qbitai/tag.ts @@ -1,7 +1,6 @@ -import { Route } from '@/types'; -import parser from '@/utils/rss-parser'; - +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; +import parser from '@/utils/rss-parser'; export const route: Route = { path: '/tag/:tag', diff --git a/lib/routes/qbittorrent/news.ts b/lib/routes/qbittorrent/news.ts index 0659ccfc71..85f0e909c3 100644 --- a/lib/routes/qbittorrent/news.ts +++ b/lib/routes/qbittorrent/news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; export const route: Route = { path: '/news', diff --git a/lib/routes/qdu/houqin.ts b/lib/routes/qdu/houqin.ts index ed60c0d4ce..2303edb7d2 100644 --- a/lib/routes/qdu/houqin.ts +++ b/lib/routes/qdu/houqin.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; const base = 'https://houqin.qdu.edu.cn/'; diff --git a/lib/routes/qdu/jwc.ts b/lib/routes/qdu/jwc.ts index 58d4c5fffa..b79f98abdf 100644 --- a/lib/routes/qdu/jwc.ts +++ b/lib/routes/qdu/jwc.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; const base = 'https://jwc.qdu.edu.cn/'; diff --git a/lib/routes/qianp/news.ts b/lib/routes/qianp/news.ts index 1136b70c17..203beea20f 100644 --- a/lib/routes/qianp/news.ts +++ b/lib/routes/qianp/news.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + import { getTokenAndSecret } from './utils'; export const route: Route = { diff --git a/lib/routes/qianzhan/column.ts b/lib/routes/qianzhan/column.ts index e6acc15c08..718bcef7f0 100644 --- a/lib/routes/qianzhan/column.ts +++ b/lib/routes/qianzhan/column.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/qianzhan/rank.ts b/lib/routes/qianzhan/rank.ts index d3099afc04..6e63d24ef9 100644 --- a/lib/routes/qianzhan/rank.ts +++ b/lib/routes/qianzhan/rank.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/qiche365/namespace.ts b/lib/routes/qiche365/namespace.ts index 33eee78e3c..4712a06f02 100644 --- a/lib/routes/qiche365/namespace.ts +++ b/lib/routes/qiche365/namespace.ts @@ -1,4 +1,5 @@ import type { Namespace } from '@/types'; + export const namespace: Namespace = { name: '汽车召回网', url: 'qiche365.org.cn', diff --git a/lib/routes/qiche365/recall.ts b/lib/routes/qiche365/recall.ts index 882a93019f..4d18836b80 100644 --- a/lib/routes/qiche365/recall.ts +++ b/lib/routes/qiche365/recall.ts @@ -1,6 +1,7 @@ -import { Route, Data, DataItem } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Data, DataItem, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/qidian/author.ts b/lib/routes/qidian/author.ts index ec9a1a6f14..f7cb6d6973 100644 --- a/lib/routes/qidian/author.ts +++ b/lib/routes/qidian/author.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/qidian/chapter.ts b/lib/routes/qidian/chapter.ts index 2272e826ec..a72f315d10 100644 --- a/lib/routes/qidian/chapter.ts +++ b/lib/routes/qidian/chapter.ts @@ -1,6 +1,8 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/qidian/forum.ts b/lib/routes/qidian/forum.ts index 5c40a21a3a..3d80969548 100644 --- a/lib/routes/qidian/forum.ts +++ b/lib/routes/qidian/forum.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseRelativeDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/qidian/free-next.ts b/lib/routes/qidian/free-next.ts index b19d71d715..0f5bd46ef3 100644 --- a/lib/routes/qidian/free-next.ts +++ b/lib/routes/qidian/free-next.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/free-next/:type?', categories: ['reading'], diff --git a/lib/routes/qidian/free.ts b/lib/routes/qidian/free.ts index a864f61c03..ede85968cf 100644 --- a/lib/routes/qidian/free.ts +++ b/lib/routes/qidian/free.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseRelativeDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/qingting/channel.ts b/lib/routes/qingting/channel.ts index 8833715da6..6a9e47dfda 100644 --- a/lib/routes/qingting/channel.ts +++ b/lib/routes/qingting/channel.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/channel/:id', diff --git a/lib/routes/qingting/podcast.ts b/lib/routes/qingting/podcast.ts index 1d418f4006..5bc02fddbd 100644 --- a/lib/routes/qingting/podcast.ts +++ b/lib/routes/qingting/podcast.ts @@ -1,10 +1,11 @@ +import crypto from 'node:crypto'; + +import { config } from '@/config'; import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; -import crypto from 'node:crypto'; import ofetch from '@/utils/ofetch'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; +import timezone from '@/utils/timezone'; const qingtingId = config.qingting.id ?? ''; diff --git a/lib/routes/qipamaijia/index.ts b/lib/routes/qipamaijia/index.ts index e2ea456c45..3b188907d7 100644 --- a/lib/routes/qipamaijia/index.ts +++ b/lib/routes/qipamaijia/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + const rootUrl = 'https://www.qipamaijia.com'; export const route: Route = { diff --git a/lib/routes/qiyoujiage/price.ts b/lib/routes/qiyoujiage/price.ts index 795cf519e5..10cdc51e3e 100644 --- a/lib/routes/qiyoujiage/price.ts +++ b/lib/routes/qiyoujiage/price.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import md5 from '@/utils/md5'; export const route: Route = { diff --git a/lib/routes/qlu/notice.ts b/lib/routes/qlu/notice.ts index 3db95edba3..7609557929 100644 --- a/lib/routes/qlu/notice.ts +++ b/lib/routes/qlu/notice.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; const host = 'https://www.qlu.edu.cn'; diff --git a/lib/routes/qm120/news.ts b/lib/routes/qm120/news.ts index 5be2a794d5..5fbd5e8914 100644 --- a/lib/routes/qm120/news.ts +++ b/lib/routes/qm120/news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/news/:category?', diff --git a/lib/routes/qoo-app/apps/card.ts b/lib/routes/qoo-app/apps/card.ts index 98f5eda7eb..a2bc275bee 100644 --- a/lib/routes/qoo-app/apps/card.ts +++ b/lib/routes/qoo-app/apps/card.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { appsUrl } from '../utils'; export const route: Route = { diff --git a/lib/routes/qoo-app/apps/comment.ts b/lib/routes/qoo-app/apps/comment.ts index d8e13ba925..e8db39377b 100644 --- a/lib/routes/qoo-app/apps/comment.ts +++ b/lib/routes/qoo-app/apps/comment.ts @@ -1,13 +1,15 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; -import { appsUrl } from '../utils'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; + +import { appsUrl } from '../utils'; + export const route: Route = { path: '/apps/:lang?/comment/:id', categories: ['anime'], diff --git a/lib/routes/qoo-app/apps/note.ts b/lib/routes/qoo-app/apps/note.ts index f18933b846..8a9aca13ee 100644 --- a/lib/routes/qoo-app/apps/note.ts +++ b/lib/routes/qoo-app/apps/note.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { appsUrl } from '../utils'; export const route: Route = { diff --git a/lib/routes/qoo-app/apps/post.ts b/lib/routes/qoo-app/apps/post.ts index 0cf396882b..0a85ef54aa 100644 --- a/lib/routes/qoo-app/apps/post.ts +++ b/lib/routes/qoo-app/apps/post.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { appsUrl, newsUrl, fixImg } from '../utils'; + +import { appsUrl, fixImg, newsUrl } from '../utils'; export const route: Route = { path: '/apps/:lang?/post/:id', diff --git a/lib/routes/qoo-app/news.ts b/lib/routes/qoo-app/news.ts index 81b4e9c038..06cf23e892 100644 --- a/lib/routes/qoo-app/news.ts +++ b/lib/routes/qoo-app/news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { newsUrl, siteIcon, fixImg } from './utils'; +import { fixImg, newsUrl, siteIcon } from './utils'; export const route: Route = { path: '/news/:lang?', diff --git a/lib/routes/qoo-app/notes/note.ts b/lib/routes/qoo-app/notes/note.ts index 273e5fadc4..d86332157b 100644 --- a/lib/routes/qoo-app/notes/note.ts +++ b/lib/routes/qoo-app/notes/note.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import { ssoUrl, notesUrl } from '../utils'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + +import { notesUrl, ssoUrl } from '../utils'; + export const route: Route = { path: '/notes/:lang?/note/:id', categories: ['anime'], diff --git a/lib/routes/qoo-app/notes/topic.ts b/lib/routes/qoo-app/notes/topic.ts index b1d69f421f..178011db15 100644 --- a/lib/routes/qoo-app/notes/topic.ts +++ b/lib/routes/qoo-app/notes/topic.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { notesUrl, extractNotes } from '../utils'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import { extractNotes, notesUrl } from '../utils'; export const route: Route = { path: '/notes/:lang?/topic/:topic', diff --git a/lib/routes/qoo-app/notes/user.ts b/lib/routes/qoo-app/notes/user.ts index 9b9f6398a8..29def526d0 100644 --- a/lib/routes/qoo-app/notes/user.ts +++ b/lib/routes/qoo-app/notes/user.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { notesUrl, extractNotes } from '../utils'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import { extractNotes, notesUrl } from '../utils'; export const route: Route = { path: '/notes/:lang?/user/:uid', diff --git a/lib/routes/qoo-app/user/app-comment.ts b/lib/routes/qoo-app/user/app-comment.ts index 83ecdfece7..9f050ea449 100644 --- a/lib/routes/qoo-app/user/app-comment.ts +++ b/lib/routes/qoo-app/user/app-comment.ts @@ -1,13 +1,15 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; -import { userUrl, appsUrl } from '../utils'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; + +import { appsUrl, userUrl } from '../utils'; + export const route: Route = { path: '/user/:lang?/appComment/:uid', categories: ['anime'], diff --git a/lib/routes/qoo-app/utils.ts b/lib/routes/qoo-app/utils.ts index 6746ad3481..612ac0c6ed 100644 --- a/lib/routes/qoo-app/utils.ts +++ b/lib/routes/qoo-app/utils.ts @@ -45,4 +45,4 @@ const extractNotes = ($) => { }); }; -export { appsUrl, newsUrl, notesUrl, ssoUrl, userUrl, siteIcon, fixImg, extractNotes }; +export { appsUrl, extractNotes, fixImg, newsUrl, notesUrl, siteIcon, ssoUrl, userUrl }; diff --git a/lib/routes/qq/ac/comic.ts b/lib/routes/qq/ac/comic.ts index 5b308f452d..ceaccc0c31 100644 --- a/lib/routes/qq/ac/comic.ts +++ b/lib/routes/qq/ac/comic.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { rootUrl, mobileRootUrl } from './utils'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import { mobileRootUrl, rootUrl } from './utils'; export const route: Route = { path: '/ac/comic/:id?', diff --git a/lib/routes/qq/ac/rank.ts b/lib/routes/qq/ac/rank.ts index 4e21a3fdd4..553c512e2a 100644 --- a/lib/routes/qq/ac/rank.ts +++ b/lib/routes/qq/ac/rank.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; -import { rootUrl, ProcessItems } from './utils'; +import type { Route } from '@/types'; + +import { ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/ac/rank/:type?/:time?', diff --git a/lib/routes/qq/ac/utils.ts b/lib/routes/qq/ac/utils.ts index 62205ac252..6499a677fb 100644 --- a/lib/routes/qq/ac/utils.ts +++ b/lib/routes/qq/ac/utils.ts @@ -1,8 +1,10 @@ +import path from 'node:path'; + +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { art } from '@/utils/render'; -import path from 'node:path'; const rootUrl = 'https://ac.qq.com'; const mobileRootUrl = 'https://m.ac.qq.com'; @@ -66,4 +68,4 @@ const ProcessItems = async (ctx, currentUrl, time, title) => { }; }; -export { rootUrl, mobileRootUrl, ProcessItems }; +export { mobileRootUrl, ProcessItems, rootUrl }; diff --git a/lib/routes/qq/cfhd/index.ts b/lib/routes/qq/cfhd/index.ts index 826ec9a951..088d405f90 100644 --- a/lib/routes/qq/cfhd/index.ts +++ b/lib/routes/qq/cfhd/index.ts @@ -1,11 +1,11 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { category = '60847' } = ctx.req.param(); diff --git a/lib/routes/qq/fact/index.ts b/lib/routes/qq/fact/index.ts index 67c45825e1..3c79365e3a 100644 --- a/lib/routes/qq/fact/index.ts +++ b/lib/routes/qq/fact/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; +import CryptoJS from 'crypto-js'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; -import CryptoJS from 'crypto-js'; import { art } from '@/utils/render'; -import path from 'node:path'; const getRequestToken = () => { const e = 'sgn51n6r6q97o6g3'; diff --git a/lib/routes/qq/kg/cache.ts b/lib/routes/qq/kg/cache.ts index 18cb4ac7ea..59dce3eb03 100644 --- a/lib/routes/qq/kg/cache.ts +++ b/lib/routes/qq/kg/cache.ts @@ -1,6 +1,7 @@ +import { JSDOM } from 'jsdom'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { JSDOM } from 'jsdom'; export default { getPlayInfo: async (ctx, shareId, ksong_mid = '') => { diff --git a/lib/routes/qq/kg/reply.ts b/lib/routes/qq/kg/reply.ts index 901de79093..70dd6ea39c 100644 --- a/lib/routes/qq/kg/reply.ts +++ b/lib/routes/qq/kg/reply.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import cache from './cache'; +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; +import cache from './cache'; + export const route: Route = { path: '/kg/reply/:playId', categories: ['social-media'], diff --git a/lib/routes/qq/kg/user.ts b/lib/routes/qq/kg/user.ts index 97cadacbea..e42812c210 100644 --- a/lib/routes/qq/kg/user.ts +++ b/lib/routes/qq/kg/user.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { JSDOM } from 'jsdom'; -import cache from './cache'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import cache from './cache'; + export const route: Route = { path: '/kg/:userId', categories: ['social-media'], diff --git a/lib/routes/qq/lol/news.ts b/lib/routes/qq/lol/news.ts index 18ed97deae..20b2141f20 100644 --- a/lib/routes/qq/lol/news.ts +++ b/lib/routes/qq/lol/news.ts @@ -1,14 +1,13 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import cache from '@/utils/cache'; +import { type CheerioAPI, load } from 'cheerio'; +import { type Context } from 'hono'; import iconv from 'iconv-lite'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, load } from 'cheerio'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const { category = 23 } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/qq/pd/guild.ts b/lib/routes/qq/pd/guild.ts index 91c21736ae..9bbfddcf74 100644 --- a/lib/routes/qq/pd/guild.ts +++ b/lib/routes/qq/pd/guild.ts @@ -1,11 +1,12 @@ -import { Data, DataItem, Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; import type { Context } from 'hono'; -import { Feed } from './types'; -import { parseFeed } from './utils'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + +import type { Feed } from './types'; +import { parseFeed } from './utils'; const baseUrl = 'https://pd.qq.com/g/'; const baseApiUrl = 'https://pd.qq.com/qunng/guild/gotrpc/noauth/trpc.qchannel.commreader.ComReader/'; diff --git a/lib/routes/qq/pd/utils.ts b/lib/routes/qq/pd/utils.ts index 7e469d5525..988b1b5c0d 100644 --- a/lib/routes/qq/pd/utils.ts +++ b/lib/routes/qq/pd/utils.ts @@ -1,6 +1,6 @@ // Description: QQ PD utils -import { Feed, FeedImage, FeedPattern, FeedFontProps, FeedPatternData } from './types'; +import type { Feed, FeedFontProps, FeedImage, FeedPattern, FeedPatternData } from './types'; const patternTypeMap = { 1: 'text', diff --git a/lib/routes/qq/weread/category.ts b/lib/routes/qq/weread/category.ts index 410f728ca0..d46e54cb27 100644 --- a/lib/routes/qq/weread/category.ts +++ b/lib/routes/qq/weread/category.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; export const route: Route = { diff --git a/lib/routes/qq88/index.ts b/lib/routes/qq88/index.ts index ef9e1141a1..d446c9bd2e 100644 --- a/lib/routes/qq88/index.ts +++ b/lib/routes/qq88/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/qqorw/index.ts b/lib/routes/qqorw/index.ts index b485e7ff0b..592024cdb6 100644 --- a/lib/routes/qqorw/index.ts +++ b/lib/routes/qqorw/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/qstheory/index.ts b/lib/routes/qstheory/index.ts index 9af215f31f..a0a7675197 100644 --- a/lib/routes/qstheory/index.ts +++ b/lib/routes/qstheory/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; import * as cheerio from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + import { baseUrl as rootUrl, getItem } from './utils'; const config = { diff --git a/lib/routes/qstheory/magazine.ts b/lib/routes/qstheory/magazine.ts index 4096ddd493..532f900921 100644 --- a/lib/routes/qstheory/magazine.ts +++ b/lib/routes/qstheory/magazine.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; import * as cheerio from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + import { baseUrl, getItem } from './utils'; export const route: Route = { diff --git a/lib/routes/qstheory/utils.ts b/lib/routes/qstheory/utils.ts index 08878d9c3a..eda6b3c06b 100644 --- a/lib/routes/qstheory/utils.ts +++ b/lib/routes/qstheory/utils.ts @@ -1,5 +1,6 @@ -import ofetch from '@/utils/ofetch'; import * as cheerio from 'cheerio'; + +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const baseUrl = 'http://www.qstheory.cn'; diff --git a/lib/routes/questmobile/report.ts b/lib/routes/questmobile/report.ts index 273d8a209d..b34deddaeb 100644 --- a/lib/routes/questmobile/report.ts +++ b/lib/routes/questmobile/report.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; /** * Parses a tree array and returns an array of objects containing the key-value pairs. diff --git a/lib/routes/questn/community.ts b/lib/routes/questn/community.ts index f6094e8ebf..f8266042da 100644 --- a/lib/routes/questn/community.ts +++ b/lib/routes/questn/community.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/community/:communityUrl', diff --git a/lib/routes/questn/events.ts b/lib/routes/questn/events.ts index 74ad6298b1..3366b0ba22 100644 --- a/lib/routes/questn/events.ts +++ b/lib/routes/questn/events.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import { parseFilterStr } from './util'; diff --git a/lib/routes/quicker/qa.ts b/lib/routes/quicker/qa.ts index 4f1b418d18..955fab1b69 100644 --- a/lib/routes/quicker/qa.ts +++ b/lib/routes/quicker/qa.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/qa/:category?/:state?', diff --git a/lib/routes/quicker/share.ts b/lib/routes/quicker/share.ts index f8a73ddef6..db06b3ace5 100644 --- a/lib/routes/quicker/share.ts +++ b/lib/routes/quicker/share.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/share/:category?', diff --git a/lib/routes/quicker/user.ts b/lib/routes/quicker/user.ts index 25a6a526f4..d9814894ad 100644 --- a/lib/routes/quicker/user.ts +++ b/lib/routes/quicker/user.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/user/:category/:id', diff --git a/lib/routes/quicker/versions.ts b/lib/routes/quicker/versions.ts index f99d8fd9cb..9cf62a0e39 100644 --- a/lib/routes/quicker/versions.ts +++ b/lib/routes/quicker/versions.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/qust/jw.ts b/lib/routes/qust/jw.ts index 12042667aa..250752fee2 100644 --- a/lib/routes/qust/jw.ts +++ b/lib/routes/qust/jw.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + const baseUrl = 'https://jw.qust.edu.cn/'; export const route: Route = { diff --git a/lib/routes/qweather/3days.ts b/lib/routes/qweather/3days.ts index f85a80ca3d..a25df7e645 100644 --- a/lib/routes/qweather/3days.ts +++ b/lib/routes/qweather/3days.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + import { render3DaysDescription, type WeatherForecastItem } from './util'; + const author = 'QWeather'; export const route: Route = { diff --git a/lib/routes/qweather/now.ts b/lib/routes/qweather/now.ts index a891f2ffed..7409015a8d 100644 --- a/lib/routes/qweather/now.ts +++ b/lib/routes/qweather/now.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; -import { renderNowDescription, type NowItem } from './util'; + +import { type NowItem, renderNowDescription } from './util'; export const route: Route = { path: '/now/:location', diff --git a/lib/routes/qweather/util.tsx b/lib/routes/qweather/util.tsx index 273d46f189..c7cb124ae3 100644 --- a/lib/routes/qweather/util.tsx +++ b/lib/routes/qweather/util.tsx @@ -86,4 +86,4 @@ const Now = ({ item }: { item: NowItem }) => (

); -export { render3DaysDescription, renderNowDescription, type WeatherForecastItem, type NowItem }; +export { type NowItem, render3DaysDescription, renderNowDescription, type WeatherForecastItem }; diff --git a/lib/routes/qwenlm/blog.ts b/lib/routes/qwenlm/blog.ts index 5c7016823c..befc24a9f3 100644 --- a/lib/routes/qwenlm/blog.ts +++ b/lib/routes/qwenlm/blog.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/qztc/home/index.ts b/lib/routes/qztc/home/index.ts index 872255795c..953230869a 100644 --- a/lib/routes/qztc/home/index.ts +++ b/lib/routes/qztc/home/index.ts @@ -1,8 +1,9 @@ -import { Data, Route } from '@/types'; -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; import { load } from 'cheerio'; + +import type { Data, Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; const rootUrl = 'https://www.qztc.edu.cn/'; diff --git a/lib/routes/qztc/jwc/index.ts b/lib/routes/qztc/jwc/index.ts index e536f3053d..f384009cb2 100644 --- a/lib/routes/qztc/jwc/index.ts +++ b/lib/routes/qztc/jwc/index.ts @@ -1,8 +1,9 @@ -import { Data, Route } from '@/types'; -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; import { load } from 'cheerio'; + +import type { Data, Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; const rootUrl = 'https://www.qztc.edu.cn/jwc/'; diff --git a/lib/routes/qztc/sjxy/index.ts b/lib/routes/qztc/sjxy/index.ts index 0cea3be85b..a7f63b29b3 100644 --- a/lib/routes/qztc/sjxy/index.ts +++ b/lib/routes/qztc/sjxy/index.ts @@ -1,8 +1,9 @@ -import { Data, Route } from '@/types'; -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; import { load } from 'cheerio'; + +import type { Data, Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; const rootUrl = 'https://www.qztc.edu.cn/sjxy/'; diff --git a/lib/routes/radio-canada/latest.ts b/lib/routes/radio-canada/latest.ts index 90f7862042..f7b0776e05 100644 --- a/lib/routes/radio-canada/latest.ts +++ b/lib/routes/radio-canada/latest.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; export const route: Route = { path: '/latest/:language?', diff --git a/lib/routes/radio/album.ts b/lib/routes/radio/album.ts index 69ac22eec9..daf54a41f4 100644 --- a/lib/routes/radio/album.ts +++ b/lib/routes/radio/album.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; import timezone from '@/utils/timezone'; const audio_types = { diff --git a/lib/routes/radio/index.ts b/lib/routes/radio/index.ts index a0be7ef160..f09525aa78 100644 --- a/lib/routes/radio/index.ts +++ b/lib/routes/radio/index.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:id', diff --git a/lib/routes/radio/zhibo.ts b/lib/routes/radio/zhibo.ts index 85c17eae8c..e53bdd0a68 100644 --- a/lib/routes/radio/zhibo.ts +++ b/lib/routes/radio/zhibo.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import CryptoJS from 'crypto-js'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import CryptoJS from 'crypto-js'; const audio_types = { m3u8: 'x-mpegURL', diff --git a/lib/routes/railway/index.ts b/lib/routes/railway/index.ts index ed88431904..4c2e89ff61 100644 --- a/lib/routes/railway/index.ts +++ b/lib/routes/railway/index.ts @@ -1,10 +1,10 @@ -import { Route, DataItem } from '@/types'; - -import cache from '@/utils/cache'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; +import type { Context } from 'hono'; + +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { Context } from 'hono'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/blog', diff --git a/lib/routes/rarehistoricalphotos/index.ts b/lib/routes/rarehistoricalphotos/index.ts index 52e875e0da..f569de4c96 100644 --- a/lib/routes/rarehistoricalphotos/index.ts +++ b/lib/routes/rarehistoricalphotos/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/raspberrypi/magazine.ts b/lib/routes/raspberrypi/magazine.ts index 746a166ed2..eb5d612ca7 100644 --- a/lib/routes/raspberrypi/magazine.ts +++ b/lib/routes/raspberrypi/magazine.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '12', 10); diff --git a/lib/routes/rattibha/user.ts b/lib/routes/rattibha/user.ts index 77aea5ce77..52be2f03c2 100644 --- a/lib/routes/rattibha/user.ts +++ b/lib/routes/rattibha/user.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; -import { config } from '@/config'; -import { parseDate } from '@/utils/parse-date'; import path from 'node:path'; + +import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import { getCurrentPath } from '@/utils/helpers'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; const __dirname = getCurrentPath(import.meta.url); diff --git a/lib/routes/rawkuma/manga.ts b/lib/routes/rawkuma/manga.ts index a403591c5a..7daae2cd64 100644 --- a/lib/routes/rawkuma/manga.ts +++ b/lib/routes/rawkuma/manga.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/manga/:id', diff --git a/lib/routes/raycast/changelog.ts b/lib/routes/raycast/changelog.ts index 35e72f5395..7e3f8cdba0 100644 --- a/lib/routes/raycast/changelog.ts +++ b/lib/routes/raycast/changelog.ts @@ -1,7 +1,8 @@ -import type { Route, DataItem } from '@/types'; -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; const handler: Route['handler'] = async () => { diff --git a/lib/routes/react/blog.ts b/lib/routes/react/blog.ts index a1d3f2f01c..38e79c7048 100644 --- a/lib/routes/react/blog.ts +++ b/lib/routes/react/blog.ts @@ -1,8 +1,9 @@ -import type { DataItem, Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; const handler: Route['handler'] = async () => { const data = await ofetch('https://react.dev/blog'); diff --git a/lib/routes/reactiflux/transcripts.ts b/lib/routes/reactiflux/transcripts.ts index 881b7a886d..5f2abf7a18 100644 --- a/lib/routes/reactiflux/transcripts.ts +++ b/lib/routes/reactiflux/transcripts.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/reactnewsletter/reactnewsletter.ts b/lib/routes/reactnewsletter/reactnewsletter.ts index d763664de3..e8d908771f 100644 --- a/lib/routes/reactnewsletter/reactnewsletter.ts +++ b/lib/routes/reactnewsletter/reactnewsletter.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -const currentURL = 'https://reactnewsletter.com/issues'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +const currentURL = 'https://reactnewsletter.com/issues'; + export const route: Route = { path: '/', radar: [ diff --git a/lib/routes/readhub/daily.ts b/lib/routes/readhub/daily.ts index 71572b8cb9..cff69db28a 100644 --- a/lib/routes/readhub/daily.ts +++ b/lib/routes/readhub/daily.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { rootUrl, apiRootUrl, processItems } from './util'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + +import { apiRootUrl, processItems, rootUrl } from './util'; export const route: Route = { path: '/daily', diff --git a/lib/routes/readhub/index.ts b/lib/routes/readhub/index.ts index 7e535f15b1..a405411bc5 100644 --- a/lib/routes/readhub/index.ts +++ b/lib/routes/readhub/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; import path from 'node:path'; -import { rootUrl, apiTopicUrl, art, processItems } from './util'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + +import { apiTopicUrl, art, processItems, rootUrl } from './util'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/readhub/util.ts b/lib/routes/readhub/util.ts index a97f455484..08e6c9f620 100644 --- a/lib/routes/readhub/util.ts +++ b/lib/routes/readhub/util.ts @@ -1,8 +1,10 @@ +import path from 'node:path'; + +import dayjs from 'dayjs'; + import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import dayjs from 'dayjs'; const domain = 'readhub.cn'; const rootUrl = `https://${domain}`; @@ -59,6 +61,6 @@ const processItems = async (items, tryGet) => ) ); -export { rootUrl, apiRootUrl, apiTopicUrl, processItems }; +export { apiRootUrl, apiTopicUrl, processItems, rootUrl }; export { art } from '@/utils/render'; diff --git a/lib/routes/readwise/list.ts b/lib/routes/readwise/list.ts index f996a7e08a..a480ced396 100644 --- a/lib/routes/readwise/list.ts +++ b/lib/routes/readwise/list.ts @@ -1,7 +1,7 @@ -import ConfigNotFoundError from '@/errors/types/config-not-found'; -import ofetch from '@/utils/ofetch'; -import { Route } from '@/types'; import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/rebase/geekdaily.ts b/lib/routes/rebase/geekdaily.ts index 7ac9e4a7ea..37a6ffae8c 100644 --- a/lib/routes/rebase/geekdaily.ts +++ b/lib/routes/rebase/geekdaily.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/remnote/changelog.ts b/lib/routes/remnote/changelog.ts index 511cedcc4b..b6e78a79ef 100644 --- a/lib/routes/remnote/changelog.ts +++ b/lib/routes/remnote/changelog.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + const FQDN = 'feedback.remnote.com'; const apiGateway = 'https://gateway.hellonext.co'; diff --git a/lib/routes/researchgate/publications.ts b/lib/routes/researchgate/publications.ts index d00f42ead3..b455c395fc 100644 --- a/lib/routes/researchgate/publications.ts +++ b/lib/routes/researchgate/publications.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; diff --git a/lib/routes/resetera/thread.ts b/lib/routes/resetera/thread.ts index bc980b3226..fc34411414 100644 --- a/lib/routes/resetera/thread.ts +++ b/lib/routes/resetera/thread.ts @@ -1,7 +1,8 @@ // lib/routes/resetera/thread.ts +import { load } from 'cheerio'; + import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; const BASE = 'https://www.resetera.com'; diff --git a/lib/routes/resonac/products.ts b/lib/routes/resonac/products.ts index 68d0a11dd8..67c3ce556e 100644 --- a/lib/routes/resonac/products.ts +++ b/lib/routes/resonac/products.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; // import { parseDate } from '@/utils/parse-date'; // import timezone from '@/utils/timezone'; diff --git a/lib/routes/reuters/common.ts b/lib/routes/reuters/common.ts index 12064725da..97e7493fce 100644 --- a/lib/routes/reuters/common.ts +++ b/lib/routes/reuters/common.ts @@ -1,11 +1,13 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:category/:topic?', diff --git a/lib/routes/reuters/investigates.ts b/lib/routes/reuters/investigates.ts index b759605675..82be8df6a4 100644 --- a/lib/routes/reuters/investigates.ts +++ b/lib/routes/reuters/investigates.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/rfa/index.ts b/lib/routes/rfa/index.ts index 4afa1ebba0..b437a8a75a 100644 --- a/lib/routes/rfa/index.ts +++ b/lib/routes/rfa/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/rfi/news.ts b/lib/routes/rfi/news.ts index cd5977a55b..d1fe744ccc 100644 --- a/lib/routes/rfi/news.ts +++ b/lib/routes/rfi/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/right/forum.ts b/lib/routes/right/forum.ts index e0152337af..0cf8a887b4 100644 --- a/lib/routes/right/forum.ts +++ b/lib/routes/right/forum.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/forum/:id?', diff --git a/lib/routes/robots.txt.ts b/lib/routes/robots.txt.ts index 3185d1bdb9..20b9d1bf6b 100644 --- a/lib/routes/robots.txt.ts +++ b/lib/routes/robots.txt.ts @@ -1,4 +1,5 @@ import type { Handler } from 'hono'; + import { config } from '@/config'; const handler: Handler = (ctx) => { diff --git a/lib/routes/rockthejvm/articles.ts b/lib/routes/rockthejvm/articles.ts index ffe2d97f4c..6e7ac6b8be 100644 --- a/lib/routes/rockthejvm/articles.ts +++ b/lib/routes/rockthejvm/articles.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/rodong/news.ts b/lib/routes/rodong/news.ts index 07258ceef1..1335f9e0dc 100644 --- a/lib/routes/rodong/news.ts +++ b/lib/routes/rodong/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const host = 'http://www.rodong.rep.kp'; diff --git a/lib/routes/routledge/book-series.ts b/lib/routes/routledge/book-series.ts index 78bb418e63..248e85d2c5 100644 --- a/lib/routes/routledge/book-series.ts +++ b/lib/routes/routledge/book-series.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:bookName/book-series/:bookId', diff --git a/lib/routes/rsc/journal.ts b/lib/routes/rsc/journal.ts index 7b1e924d05..47ae3828de 100644 --- a/lib/routes/rsc/journal.ts +++ b/lib/routes/rsc/journal.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/journal/:id/:category?', diff --git a/lib/routes/rss3/index.ts b/lib/routes/rss3/index.ts index bd96959f40..62235918af 100644 --- a/lib/routes/rss3/index.ts +++ b/lib/routes/rss3/index.ts @@ -1,8 +1,8 @@ -import { Route, type DataItem } from '@/types'; +import { renderItemActionToHTML } from '@rss3/sdk'; +import type { type DataItem, Route } from '@/types'; import { camelcaseKeys } from '@/utils/camelcase-keys'; import ofetch from '@/utils/ofetch'; -import { renderItemActionToHTML } from '@rss3/sdk'; export const route: Route = { path: '/:account/:network?/:tag?', diff --git a/lib/routes/rss3/interfaces/metadata.ts b/lib/routes/rss3/interfaces/metadata.ts index 52b40a8c37..0bfcea3751 100644 --- a/lib/routes/rss3/interfaces/metadata.ts +++ b/lib/routes/rss3/interfaces/metadata.ts @@ -1,4 +1,4 @@ -import { +import type { CollectibleApproval, CollectibleBurn, CollectibleMint, @@ -20,9 +20,9 @@ import { SocialRevise, SocialReward, SocialShare, + StakerProfitSnapshot, StakeStaking, StakeTransaction, - StakerProfitSnapshot, TransactionApproval, TransactionBridge, TransactionBurn, @@ -30,6 +30,7 @@ import { TransactionMint, TransactionTransfer, } from '@rss3/sdk'; + export type RSS3DataModels = { CollectibleApproval: CollectibleApproval; CollectibleBurn: CollectibleBurn; diff --git a/lib/routes/rsshub/routes.ts b/lib/routes/rsshub/routes.ts index 421b280104..274f0b585b 100644 --- a/lib/routes/rsshub/routes.ts +++ b/lib/routes/rsshub/routes.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; -import ofetch from '@/utils/ofetch'; import * as cheerio from 'cheerio'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; + export const route: Route = { path: '/routes/:lang?', categories: ['program-update'], diff --git a/lib/routes/rsshub/transform/html.ts b/lib/routes/rsshub/transform/html.ts index af1d6471ba..d712cf1bff 100644 --- a/lib/routes/rsshub/transform/html.ts +++ b/lib/routes/rsshub/transform/html.ts @@ -1,10 +1,11 @@ -import { DataItem, Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import sanitizeHtml from 'sanitize-html'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; -import sanitizeHtml from 'sanitize-html'; +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; export const route: Route = { path: '/transform/html/:url/:routeParams', diff --git a/lib/routes/rsshub/transform/json.ts b/lib/routes/rsshub/transform/json.ts index 09d1af6019..9d0823d91a 100644 --- a/lib/routes/rsshub/transform/json.ts +++ b/lib/routes/rsshub/transform/json.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import got from '@/utils/got'; function jsonGet(obj, attr) { if (typeof attr !== 'string') { diff --git a/lib/routes/rsshub/transform/sitemap.ts b/lib/routes/rsshub/transform/sitemap.ts index f013e943af..94f63ee65f 100644 --- a/lib/routes/rsshub/transform/sitemap.ts +++ b/lib/routes/rsshub/transform/sitemap.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import got from '@/utils/got'; export const route: Route = { path: '/transform/sitemap/:url/:routeParams?', diff --git a/lib/routes/ruancan/category.ts b/lib/routes/ruancan/category.ts index ea61a67448..a1111e3956 100644 --- a/lib/routes/ruancan/category.ts +++ b/lib/routes/ruancan/category.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import fetchFeed from './utils'; export const route: Route = { diff --git a/lib/routes/ruancan/index.ts b/lib/routes/ruancan/index.ts index de304f9b38..5e6a66ad2b 100644 --- a/lib/routes/ruancan/index.ts +++ b/lib/routes/ruancan/index.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import fetchFeed from './utils'; export const route: Route = { diff --git a/lib/routes/ruancan/search.ts b/lib/routes/ruancan/search.ts index 55a8fae374..ad067e54fb 100644 --- a/lib/routes/ruancan/search.ts +++ b/lib/routes/ruancan/search.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import fetchFeed from './utils'; export const route: Route = { diff --git a/lib/routes/ruancan/user.ts b/lib/routes/ruancan/user.ts index 431e7bc486..df2dd2c8f9 100644 --- a/lib/routes/ruancan/user.ts +++ b/lib/routes/ruancan/user.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import fetchFeed from './utils'; export const route: Route = { diff --git a/lib/routes/ruancan/utils.ts b/lib/routes/ruancan/utils.ts index 75eaeb1335..9b4365a7b1 100644 --- a/lib/routes/ruancan/utils.ts +++ b/lib/routes/ruancan/utils.ts @@ -1,6 +1,7 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const fetchFeed = async (ctx, currentUrl) => { diff --git a/lib/routes/ruankao/news.ts b/lib/routes/ruankao/news.ts index 1d0cff612c..679c775ec9 100644 --- a/lib/routes/ruankao/news.ts +++ b/lib/routes/ruankao/news.ts @@ -1,8 +1,10 @@ +import { load } from 'cheerio'; + import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; + const BASE_URL = 'https://www.ruankao.org.cn/index/work.html'; const removeFontPresetting = (html: string = ''): string => { diff --git a/lib/routes/ruc/ai.ts b/lib/routes/ruc/ai.ts index 1a8f639eee..e99326439c 100644 --- a/lib/routes/ruc/ai.ts +++ b/lib/routes/ruc/ai.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import cache from '@/utils/cache'; export const route: Route = { path: '/ai/:category?', diff --git a/lib/routes/ruc/hr.ts b/lib/routes/ruc/hr.ts index 7c81ca1934..612f35707d 100644 --- a/lib/routes/ruc/hr.ts +++ b/lib/routes/ruc/hr.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/runtrail/posts.ts b/lib/routes/runtrail/posts.ts index 5e2be6f310..1323bab710 100644 --- a/lib/routes/runtrail/posts.ts +++ b/lib/routes/runtrail/posts.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/rustcc/jobs.ts b/lib/routes/rustcc/jobs.ts index bcb291289b..02d50ef6d5 100644 --- a/lib/routes/rustcc/jobs.ts +++ b/lib/routes/rustcc/jobs.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/rustcc/news.ts b/lib/routes/rustcc/news.ts index cccac9c060..66a9f58927 100644 --- a/lib/routes/rustcc/news.ts +++ b/lib/routes/rustcc/news.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/sakurazaka46/blog.ts b/lib/routes/sakurazaka46/blog.ts index 2bc756d95b..eea3c63d51 100644 --- a/lib/routes/sakurazaka46/blog.ts +++ b/lib/routes/sakurazaka46/blog.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/blog/:id?/:page?', diff --git a/lib/routes/sakurazaka46/news.ts b/lib/routes/sakurazaka46/news.ts index 58fb34729a..c9866129ef 100644 --- a/lib/routes/sakurazaka46/news.ts +++ b/lib/routes/sakurazaka46/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/samd/news.ts b/lib/routes/samd/news.ts index 097c42de41..3efe7aaa68 100644 --- a/lib/routes/samd/news.ts +++ b/lib/routes/samd/news.ts @@ -1,9 +1,10 @@ -import { Route, DataItem } from '@/types'; +import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { load } from 'cheerio'; -import ofetch from '@/utils/ofetch'; const dict = { '434': '行业资讯', '436': '协会动态', '438': '重要通知', '440': '政策法规' }; diff --git a/lib/routes/samrdprc/index.ts b/lib/routes/samrdprc/index.ts index be5a0968f0..692101a045 100644 --- a/lib/routes/samrdprc/index.ts +++ b/lib/routes/samrdprc/index.ts @@ -1,13 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const { id = 'xwdt/gzdt' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '17', 10); diff --git a/lib/routes/samrdprc/news.ts b/lib/routes/samrdprc/news.ts index 629f32dd6f..8dc5efaf55 100644 --- a/lib/routes/samrdprc/news.ts +++ b/lib/routes/samrdprc/news.ts @@ -1,8 +1,9 @@ -import { Route, DataItem } from '@/types'; -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/news/:type1/:type2', diff --git a/lib/routes/samsung/research/blog.ts b/lib/routes/samsung/research/blog.ts index 750d82bd3d..159e9118c5 100644 --- a/lib/routes/samsung/research/blog.ts +++ b/lib/routes/samsung/research/blog.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/sankei/news.ts b/lib/routes/sankei/news.ts index cbd723e6f1..192f389747 100644 --- a/lib/routes/sankei/news.ts +++ b/lib/routes/sankei/news.ts @@ -1,10 +1,10 @@ -import { Route, Data, DataItem } from '@/types'; +import { load } from 'cheerio'; +import type { Context } from 'hono'; +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { Context } from 'hono'; export const route: Route = { path: '/news/:category', diff --git a/lib/routes/sankei/topics.ts b/lib/routes/sankei/topics.ts index 852031847c..6c8d1557fb 100644 --- a/lib/routes/sankei/topics.ts +++ b/lib/routes/sankei/topics.ts @@ -1,10 +1,10 @@ -import { Route, Data, DataItem } from '@/types'; +import { load } from 'cheerio'; +import type { Context } from 'hono'; +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { Context } from 'hono'; export const route: Route = { path: ['/topics/:topic'], diff --git a/lib/routes/sara/index.ts b/lib/routes/sara/index.ts index 27520482ac..0f66e89536 100644 --- a/lib/routes/sara/index.ts +++ b/lib/routes/sara/index.ts @@ -1,6 +1,7 @@ -import { Route, DataItem } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; const typeMap = { diff --git a/lib/routes/saraba1st/digest.ts b/lib/routes/saraba1st/digest.ts index 94493e4670..48c849afa4 100644 --- a/lib/routes/saraba1st/digest.ts +++ b/lib/routes/saraba1st/digest.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { config } from '@/config'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/digest/:tid', diff --git a/lib/routes/saraba1st/thread.ts b/lib/routes/saraba1st/thread.ts index 3c7b3d24c9..80390852e8 100644 --- a/lib/routes/saraba1st/thread.ts +++ b/lib/routes/saraba1st/thread.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; import queryString from 'query-string'; + import { config } from '@/config'; +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/sass/gs/index.ts b/lib/routes/sass/gs/index.ts index 6400849adc..c3ea0e9ebf 100644 --- a/lib/routes/sass/gs/index.ts +++ b/lib/routes/sass/gs/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const host = 'https://gs.sass.org.cn'; diff --git a/lib/routes/scau/yjs.ts b/lib/routes/scau/yjs.ts index 36e164b58e..6454a5e8b5 100644 --- a/lib/routes/scau/yjs.ts +++ b/lib/routes/scau/yjs.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/scau/yjsy.ts b/lib/routes/scau/yjsy.ts index 0cdcb77a2f..00872744e0 100644 --- a/lib/routes/scau/yjsy.ts +++ b/lib/routes/scau/yjsy.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/science/blogs.ts b/lib/routes/science/blogs.ts index 1ddd29ec81..7e42daf67c 100644 --- a/lib/routes/science/blogs.ts +++ b/lib/routes/science/blogs.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import { baseUrl } from './utils'; + import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; +import { baseUrl } from './utils'; + export const route: Route = { path: '/blogs/:name?', categories: ['journal'], diff --git a/lib/routes/science/cover.ts b/lib/routes/science/cover.ts index bc5c8b5bba..f8970f06ce 100644 --- a/lib/routes/science/cover.ts +++ b/lib/routes/science/cover.ts @@ -1,5 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; // journals form AAAS publishing group // // science: Science @@ -8,12 +11,10 @@ import { Route } from '@/types'; // scirobotics: Science Robotics // signaling: Science Signaling // stm: Science Translational Medicine - import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; + import { baseUrl } from './utils'; export const route: Route = { diff --git a/lib/routes/science/current.ts b/lib/routes/science/current.ts index 759421fc48..17d65e6922 100644 --- a/lib/routes/science/current.ts +++ b/lib/routes/science/current.ts @@ -1,5 +1,3 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; // journals form AAAS publishing group // // science: Science @@ -8,12 +6,15 @@ import cache from '@/utils/cache'; // scirobotics: Science Robotics // signaling: Science Signaling // stm: Science Translational Medicine - import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; -import { baseUrl, fetchDesc, getItem } from './utils'; import puppeteer from '@/utils/puppeteer'; +import { baseUrl, fetchDesc, getItem } from './utils'; + export const route: Route = { path: '/current/:journal?', categories: ['journal'], diff --git a/lib/routes/science/early.ts b/lib/routes/science/early.ts index c3d0060614..5cc20e2e8a 100644 --- a/lib/routes/science/early.ts +++ b/lib/routes/science/early.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import puppeteer from '@/utils/puppeteer'; diff --git a/lib/routes/science/utils.ts b/lib/routes/science/utils.ts index a49e54526d..e616d1fb92 100644 --- a/lib/routes/science/utils.ts +++ b/lib/routes/science/utils.ts @@ -1,7 +1,9 @@ -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { load } from 'cheerio'; + import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; const baseUrl = 'https://www.science.org'; diff --git a/lib/routes/sciencedirect/call-for-paper.ts b/lib/routes/sciencedirect/call-for-paper.ts index 290a9eb17c..c3954a8691 100644 --- a/lib/routes/sciencedirect/call-for-paper.ts +++ b/lib/routes/sciencedirect/call-for-paper.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + export const route: Route = { path: '/call-for-paper/:subject', categories: ['journal'], diff --git a/lib/routes/sciencedirect/cf-email.ts b/lib/routes/sciencedirect/cf-email.ts index 39f7cc651d..21af4821b5 100644 --- a/lib/routes/sciencedirect/cf-email.ts +++ b/lib/routes/sciencedirect/cf-email.ts @@ -29,7 +29,6 @@ export { * @returns decoded email address */ decodeCFEmail, - /** * Returns CloudFlare protected email address. * @param {String} email - email in plaintext diff --git a/lib/routes/sciencedirect/current-issue.ts b/lib/routes/sciencedirect/current-issue.ts index 6657e61cbd..0349c31e8a 100644 --- a/lib/routes/sciencedirect/current-issue.ts +++ b/lib/routes/sciencedirect/current-issue.ts @@ -1,11 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import sanitizeHtml from 'sanitize-html'; +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import sanitizeHtml from 'sanitize-html'; -import { config } from '@/config'; export const route: Route = { path: '/journal/:id/current', diff --git a/lib/routes/sciencedirect/journal.ts b/lib/routes/sciencedirect/journal.ts index cc53640492..dcac29bdb4 100644 --- a/lib/routes/sciencedirect/journal.ts +++ b/lib/routes/sciencedirect/journal.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + import { decodeCFEmail } from './cf-email'; export const route: Route = { diff --git a/lib/routes/sciencenet/blog.ts b/lib/routes/sciencenet/blog.ts index af867f18aa..f2550276a6 100644 --- a/lib/routes/sciencenet/blog.ts +++ b/lib/routes/sciencenet/blog.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/blog/:type?/:time?/:sort?', diff --git a/lib/routes/sciencenet/user.ts b/lib/routes/sciencenet/user.ts index 5e65a1c38a..5a64c3c88a 100644 --- a/lib/routes/sciencenet/user.ts +++ b/lib/routes/sciencenet/user.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/user/:id', diff --git a/lib/routes/scientificamerican/podcast.ts b/lib/routes/scientificamerican/podcast.ts index 423fe8da92..caebf9bd22 100644 --- a/lib/routes/scientificamerican/podcast.ts +++ b/lib/routes/scientificamerican/podcast.ts @@ -3,12 +3,11 @@ import path from 'node:path'; import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; -import { type DataItem, type Route, type Data, ViewType } from '@/types'; - -import { art } from '@/utils/render'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; export const handler = async (ctx: Context): Promise => { diff --git a/lib/routes/scitechvista/index.ts b/lib/routes/scitechvista/index.ts index 1709b45f4a..72cdf98ff6 100644 --- a/lib/routes/scitechvista/index.ts +++ b/lib/routes/scitechvista/index.ts @@ -1,12 +1,14 @@ +import path from 'node:path'; + +import { load } from 'cheerio'; + import { type Data, type DataItem, type Route } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; import { namespace } from './namespace'; -import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; -import { parseDate } from '@/utils/parse-date'; -import path from 'node:path'; -import { art } from '@/utils/render'; const baseUrl = `https://${namespace.url}`; diff --git a/lib/routes/scmp/coronavirus.ts b/lib/routes/scmp/coronavirus.ts index 193267e80f..6e7e15903c 100644 --- a/lib/routes/scmp/coronavirus.ts +++ b/lib/routes/scmp/coronavirus.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + export const route: Route = { path: '/coronavirus', categories: ['other'], diff --git a/lib/routes/scmp/index.ts b/lib/routes/scmp/index.ts index b3eb8dae46..a1e86888e8 100644 --- a/lib/routes/scmp/index.ts +++ b/lib/routes/scmp/index.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { parseItem } from './utils'; export const route: Route = { diff --git a/lib/routes/scmp/topic.ts b/lib/routes/scmp/topic.ts index 97e53528cd..5b008dc921 100644 --- a/lib/routes/scmp/topic.ts +++ b/lib/routes/scmp/topic.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { parseItem } from './utils'; export const route: Route = { diff --git a/lib/routes/scmp/utils.ts b/lib/routes/scmp/utils.ts index ddfa87762c..648c6c0eac 100644 --- a/lib/routes/scmp/utils.ts +++ b/lib/routes/scmp/utils.ts @@ -1,6 +1,7 @@ import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const renderHTML = (node) => { if (!node) { diff --git a/lib/routes/scnu/cs/match.ts b/lib/routes/scnu/cs/match.ts index 17ef9bd8e8..4d56f42a37 100644 --- a/lib/routes/scnu/cs/match.ts +++ b/lib/routes/scnu/cs/match.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/scnu/jw.ts b/lib/routes/scnu/jw.ts index 8bfe1bd14f..591a5a9b05 100644 --- a/lib/routes/scnu/jw.ts +++ b/lib/routes/scnu/jw.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/scnu/library.ts b/lib/routes/scnu/library.ts index f64b3f932e..9972b43eaf 100644 --- a/lib/routes/scnu/library.ts +++ b/lib/routes/scnu/library.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/scnu/physics-school-announcements-and-news.ts b/lib/routes/scnu/physics-school-announcements-and-news.ts index 47e0f7ffab..aa82dcef03 100644 --- a/lib/routes/scnu/physics-school-announcements-and-news.ts +++ b/lib/routes/scnu/physics-school-announcements-and-news.ts @@ -1,8 +1,9 @@ +import { load } from 'cheerio'; + 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 timezone from '@/utils/timezone'; const getAritlces = async (category, url, cache) => { const { data } = await got(url); diff --git a/lib/routes/scnu/ss.ts b/lib/routes/scnu/ss.ts index 7f2ec38a8a..0ed04b7e75 100644 --- a/lib/routes/scnu/ss.ts +++ b/lib/routes/scnu/ss.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/scnu/yjs.ts b/lib/routes/scnu/yjs.ts index ff2b571eaf..6f5aaeabf0 100644 --- a/lib/routes/scnu/yjs.ts +++ b/lib/routes/scnu/yjs.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/yjs', categories: ['university'], diff --git a/lib/routes/scoop/apps.ts b/lib/routes/scoop/apps.ts index 829698f4c7..a41ef20054 100644 --- a/lib/routes/scoop/apps.ts +++ b/lib/routes/scoop/apps.ts @@ -1,12 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import { art } from '@/utils/render'; -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; +import path from 'node:path'; import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; -import path from 'node:path'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; const orderbys = (desc: string) => { const base = { diff --git a/lib/routes/scpta/news.ts b/lib/routes/scpta/news.ts index f0c32dd2d8..90003dab1f 100644 --- a/lib/routes/scpta/news.ts +++ b/lib/routes/scpta/news.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/news/:category', diff --git a/lib/routes/sctv/programme.ts b/lib/routes/sctv/programme.ts index e156f89233..3d62e97711 100644 --- a/lib/routes/sctv/programme.ts +++ b/lib/routes/sctv/programme.ts @@ -1,11 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/programme/:id?/:limit?/:isFull?', diff --git a/lib/routes/scu/jwc/tzgg.ts b/lib/routes/scu/jwc/tzgg.ts index dcc7383e3d..07fffc87fa 100644 --- a/lib/routes/scu/jwc/tzgg.ts +++ b/lib/routes/scu/jwc/tzgg.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 const baseUrl = 'https://jwc.scu.edu.cn/tzgg.htm'; const baseIndexUrl = 'https://jwc.scu.edu.cn/'; diff --git a/lib/routes/scu/scupi/_utils.ts b/lib/routes/scu/scupi/_utils.ts index 295220cfc3..7ea8074db5 100644 --- a/lib/routes/scu/scupi/_utils.ts +++ b/lib/routes/scu/scupi/_utils.ts @@ -1,7 +1,8 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + import { config } from '@/config'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export async function getNotifList() { try { diff --git a/lib/routes/scu/scupi/notice.ts b/lib/routes/scu/scupi/notice.ts index 8457223004..73c7b55caa 100644 --- a/lib/routes/scu/scupi/notice.ts +++ b/lib/routes/scu/scupi/notice.ts @@ -1,9 +1,10 @@ // Warning: The author still knows nothing about javascript! -import { getNotifList, getArticle } from './_utils'; -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import { getArticle, getNotifList } from './_utils'; + export const route: Route = { path: '/scupi', categories: ['university'], diff --git a/lib/routes/scut/gzic/media.ts b/lib/routes/scut/gzic/media.ts index 6d94de2a8e..4dc01169d0 100644 --- a/lib/routes/scut/gzic/media.ts +++ b/lib/routes/scut/gzic/media.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/gzic/media', diff --git a/lib/routes/scut/gzic/news.ts b/lib/routes/scut/gzic/news.ts index d295d929b3..c512910dee 100644 --- a/lib/routes/scut/gzic/news.ts +++ b/lib/routes/scut/gzic/news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/gzic/news', diff --git a/lib/routes/scut/gzic/notice.ts b/lib/routes/scut/gzic/notice.ts index ce55a124f4..9c9281ad3d 100644 --- a/lib/routes/scut/gzic/notice.ts +++ b/lib/routes/scut/gzic/notice.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; const categoryMap = { xsyg: { title: '学术预告', tag: '30284' }, diff --git a/lib/routes/scut/jwc/news.ts b/lib/routes/scut/jwc/news.ts index f286e805cb..8c86719d89 100644 --- a/lib/routes/scut/jwc/news.ts +++ b/lib/routes/scut/jwc/news.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import querystring from 'node:querystring'; +import * as url from 'node:url'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import * as url from 'node:url'; -import querystring from 'node:querystring'; const baseUrl = 'http://jw.scut.edu.cn'; const refererUrl = baseUrl + '/dist/'; diff --git a/lib/routes/scut/jwc/notice.ts b/lib/routes/scut/jwc/notice.ts index bbd6794ea1..fd807371aa 100644 --- a/lib/routes/scut/jwc/notice.ts +++ b/lib/routes/scut/jwc/notice.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import querystring from 'node:querystring'; +import * as url from 'node:url'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import * as url from 'node:url'; -import querystring from 'node:querystring'; const baseUrl = 'http://jw.scut.edu.cn'; const refererUrl = baseUrl + '/dist/'; diff --git a/lib/routes/scut/jwc/school.ts b/lib/routes/scut/jwc/school.ts index ad41dc2fbb..0b0879f210 100644 --- a/lib/routes/scut/jwc/school.ts +++ b/lib/routes/scut/jwc/school.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import querystring from 'node:querystring'; +import * as url from 'node:url'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import * as url from 'node:url'; -import querystring from 'node:querystring'; const baseUrl = 'http://jw.scut.edu.cn'; const refererUrl = baseUrl + '/dist/'; diff --git a/lib/routes/scut/scet/notice.ts b/lib/routes/scut/scet/notice.ts index ddbacbacaa..3e324c4125 100644 --- a/lib/routes/scut/scet/notice.ts +++ b/lib/routes/scut/scet/notice.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/scet/notice', categories: ['university'], diff --git a/lib/routes/scut/seie/news-ccenter.ts b/lib/routes/scut/seie/news-ccenter.ts index c42d405a58..8883786833 100644 --- a/lib/routes/scut/seie/news-ccenter.ts +++ b/lib/routes/scut/seie/news-ccenter.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/scut/smae/notice.ts b/lib/routes/scut/smae/notice.ts index 206ca57ce8..5daac46095 100644 --- a/lib/routes/scut/smae/notice.ts +++ b/lib/routes/scut/smae/notice.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; // 导入必要的模组 import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const categoryMap = { diff --git a/lib/routes/scut/yjs.ts b/lib/routes/scut/yjs.ts index 4e95cfd100..743072cb2b 100644 --- a/lib/routes/scut/yjs.ts +++ b/lib/routes/scut/yjs.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/scvtc/xygg.ts b/lib/routes/scvtc/xygg.ts index b2aabc8522..5a2101b84f 100644 --- a/lib/routes/scvtc/xygg.ts +++ b/lib/routes/scvtc/xygg.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/sdo/ff14risingstones/api.ts b/lib/routes/sdo/ff14risingstones/api.ts index e91e4bad03..be8da24486 100644 --- a/lib/routes/sdo/ff14risingstones/api.ts +++ b/lib/routes/sdo/ff14risingstones/api.ts @@ -1,4 +1,5 @@ import cache from '@/utils/cache'; + import { API_URL } from './constant'; import type { DutiesPartyDetail, FreeCompanyPartyDetail, NoviceNetworkParty, PostDetail, Resently, UserDynamic, UserInfo, UserPost } from './types'; import { requestAPI } from './utils'; diff --git a/lib/routes/sdo/ff14risingstones/posts.ts b/lib/routes/sdo/ff14risingstones/posts.ts index dd142d5354..cf35b36f85 100644 --- a/lib/routes/sdo/ff14risingstones/posts.ts +++ b/lib/routes/sdo/ff14risingstones/posts.ts @@ -1,8 +1,10 @@ -import type { Route } from '@/types'; -import { INDEX_URL, LOGO_URL, POST_PART, POST_TYPE, REQUIRE_CONFIG } from './constant'; import type { Context } from 'hono'; -import { checkConfig, generatePostFeeds } from './utils'; + +import type { Route } from '@/types'; + import { getPosts } from './api'; +import { INDEX_URL, LOGO_URL, POST_PART, POST_TYPE, REQUIRE_CONFIG } from './constant'; +import { checkConfig, generatePostFeeds } from './utils'; export const route: Route = { path: '/ff14risingstones/posts/:pid?/:type?', diff --git a/lib/routes/sdo/ff14risingstones/strats.ts b/lib/routes/sdo/ff14risingstones/strats.ts index 6b75187fd5..218a2540e3 100644 --- a/lib/routes/sdo/ff14risingstones/strats.ts +++ b/lib/routes/sdo/ff14risingstones/strats.ts @@ -1,8 +1,10 @@ -import type { Route } from '@/types'; -import { INDEX_URL, LOGO_URL, POST_TYPE, REQUIRE_CONFIG, STRAT_PART } from './constant'; import type { Context } from 'hono'; -import { checkConfig, generatePostFeeds } from './utils'; + +import type { Route } from '@/types'; + import { getPosts } from './api'; +import { INDEX_URL, LOGO_URL, POST_TYPE, REQUIRE_CONFIG, STRAT_PART } from './constant'; +import { checkConfig, generatePostFeeds } from './utils'; export const route: Route = { path: '/ff14risingstones/strats/:pid?/:type?', diff --git a/lib/routes/sdo/ff14risingstones/timeline.ts b/lib/routes/sdo/ff14risingstones/timeline.ts index f8bfa1e9dd..b964e4c705 100644 --- a/lib/routes/sdo/ff14risingstones/timeline.ts +++ b/lib/routes/sdo/ff14risingstones/timeline.ts @@ -1,8 +1,10 @@ -import type { Data, Route } from '@/types'; -import { INDEX_URL, LOGO_URL, REQUIRE_CONFIG } from './constant'; import type { Context } from 'hono'; -import { checkConfig, generateDynamicFeeds } from './utils'; + +import type { Data, Route } from '@/types'; + import { getFollowDynamicList } from './api'; +import { INDEX_URL, LOGO_URL, REQUIRE_CONFIG } from './constant'; +import { checkConfig, generateDynamicFeeds } from './utils'; export const route: Route = { path: '/ff14risingstones/timeline', diff --git a/lib/routes/sdo/ff14risingstones/types/dynamic.ts b/lib/routes/sdo/ff14risingstones/types/dynamic.ts index 6d6532d2d3..1cdb2f8ab4 100644 --- a/lib/routes/sdo/ff14risingstones/types/dynamic.ts +++ b/lib/routes/sdo/ff14risingstones/types/dynamic.ts @@ -1,6 +1,6 @@ import type { DynamicSource } from '../constant'; import type { DateTimeFormat, UserPost } from './other'; -import type { DutiesParty, NoviceNetworkParty, FreeCompanyParty, OtherParty, RolePlayParty } from './party'; +import type { DutiesParty, FreeCompanyParty, NoviceNetworkParty, OtherParty, RolePlayParty } from './party'; interface BaseUserDynamic { character_name: string; diff --git a/lib/routes/sdo/ff14risingstones/user-dynamics.ts b/lib/routes/sdo/ff14risingstones/user-dynamics.ts index 200170aa7f..1886fdca7c 100644 --- a/lib/routes/sdo/ff14risingstones/user-dynamics.ts +++ b/lib/routes/sdo/ff14risingstones/user-dynamics.ts @@ -1,8 +1,10 @@ -import type { Data, Route } from '@/types'; -import { INDEX_URL, REQUIRE_CONFIG } from './constant'; import type { Context } from 'hono'; -import { checkConfig, generateDynamicFeeds } from './utils'; + +import type { Data, Route } from '@/types'; + import { getUserDynamic, getUserInfo } from './api'; +import { INDEX_URL, REQUIRE_CONFIG } from './constant'; +import { checkConfig, generateDynamicFeeds } from './utils'; export const route: Route = { path: '/ff14risingstones/user-dynamics/:uid', diff --git a/lib/routes/sdo/ff14risingstones/user-posts.ts b/lib/routes/sdo/ff14risingstones/user-posts.ts index d06e2cff55..0937449f70 100644 --- a/lib/routes/sdo/ff14risingstones/user-posts.ts +++ b/lib/routes/sdo/ff14risingstones/user-posts.ts @@ -1,8 +1,10 @@ -import type { Data, Route } from '@/types'; -import { INDEX_URL, REQUIRE_CONFIG } from './constant'; import type { Context } from 'hono'; -import { checkConfig, generatePostFeeds } from './utils'; + +import type { Data, Route } from '@/types'; + import { getUserInfo, getUserPosts } from './api'; +import { INDEX_URL, REQUIRE_CONFIG } from './constant'; +import { checkConfig, generatePostFeeds } from './utils'; export const route: Route = { path: '/ff14risingstones/user-posts/:uid', diff --git a/lib/routes/sdo/ff14risingstones/user-resently.ts b/lib/routes/sdo/ff14risingstones/user-resently.ts index 6040e6093d..df453df2e5 100644 --- a/lib/routes/sdo/ff14risingstones/user-resently.ts +++ b/lib/routes/sdo/ff14risingstones/user-resently.ts @@ -1,11 +1,13 @@ -import type { Data, Route } from '@/types'; -import { INDEX_URL, REQUIRE_CONFIG } from './constant'; import type { Context } from 'hono'; -import { checkConfig } from './utils'; -import { getResently, getUserInfo } from './api'; + +import type { Data, Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; +import { getResently, getUserInfo } from './api'; +import { INDEX_URL, REQUIRE_CONFIG } from './constant'; +import { checkConfig } from './utils'; + export const route: Route = { path: '/ff14risingstones/user-resently/:uid', categories: ['bbs'], diff --git a/lib/routes/sdo/ff14risingstones/user-strats.ts b/lib/routes/sdo/ff14risingstones/user-strats.ts index 480c31965b..2386e76990 100644 --- a/lib/routes/sdo/ff14risingstones/user-strats.ts +++ b/lib/routes/sdo/ff14risingstones/user-strats.ts @@ -1,8 +1,10 @@ -import type { Data, Route } from '@/types'; -import { INDEX_URL, REQUIRE_CONFIG } from './constant'; import type { Context } from 'hono'; -import { checkConfig, generatePostFeeds } from './utils'; + +import type { Data, Route } from '@/types'; + import { getUserInfo, getUserPosts } from './api'; +import { INDEX_URL, REQUIRE_CONFIG } from './constant'; +import { checkConfig, generatePostFeeds } from './utils'; export const route: Route = { path: '/ff14risingstones/user-strats/:uid', diff --git a/lib/routes/sdo/ff14risingstones/utils.ts b/lib/routes/sdo/ff14risingstones/utils.ts index 93c64eb4ec..dc8b3b1603 100644 --- a/lib/routes/sdo/ff14risingstones/utils.ts +++ b/lib/routes/sdo/ff14risingstones/utils.ts @@ -1,14 +1,16 @@ +import path from 'node:path'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { DataItem } from '@/types'; import ofetch from '@/utils/ofetch'; -import type { BaseResponse, DutiesPartyDetail, FreeCompanyPartyDetail, NoviceNetworkParty, PostDetail, UserDynamic, UserPost } from './types'; -import { DataItem } from '@/types'; -import { DynamicSource, INDEX_URL, JOB, NoviceNetworkIdentity, PLAY_STYLE } from './constant'; -import { getDutiesRecruitDetail, getFreeCompanyRecruitDetail, getNoviceNetworkRecruitDetail, getPostsDetail } from './api'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; + +import { getDutiesRecruitDetail, getFreeCompanyRecruitDetail, getNoviceNetworkRecruitDetail, getPostsDetail } from './api'; +import { DynamicSource, INDEX_URL, JOB, NoviceNetworkIdentity, PLAY_STYLE } from './constant'; +import type { BaseResponse, DutiesPartyDetail, FreeCompanyPartyDetail, NoviceNetworkParty, PostDetail, UserDynamic, UserPost } from './types'; export function checkConfig() { if (!config.sdo.ff14risingstones || !config.sdo.ua) { diff --git a/lib/routes/sdu/cmse.ts b/lib/routes/sdu/cmse.ts index 8affc159a3..b6c0a8297c 100644 --- a/lib/routes/sdu/cmse.ts +++ b/lib/routes/sdu/cmse.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const host = 'http://www.cmse.sdu.edu.cn/'; diff --git a/lib/routes/sdu/cs/index.ts b/lib/routes/sdu/cs/index.ts index 63760d348b..a7f1c4444a 100644 --- a/lib/routes/sdu/cs/index.ts +++ b/lib/routes/sdu/cs/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { finishArticleItem } from '@/utils/wechat-mp'; diff --git a/lib/routes/sdu/cs/yjsgz.ts b/lib/routes/sdu/cs/yjsgz.ts index 3ebffc9ef7..08da928e3b 100644 --- a/lib/routes/sdu/cs/yjsgz.ts +++ b/lib/routes/sdu/cs/yjsgz.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { finishArticleItem } from '@/utils/wechat-mp'; diff --git a/lib/routes/sdu/epe.ts b/lib/routes/sdu/epe.ts index 7b5e5af8d7..613b01eb4a 100644 --- a/lib/routes/sdu/epe.ts +++ b/lib/routes/sdu/epe.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/sdu/extractor/index.ts b/lib/routes/sdu/extractor/index.ts index 8e58211f54..55edee95b0 100644 --- a/lib/routes/sdu/extractor/index.ts +++ b/lib/routes/sdu/extractor/index.ts @@ -1,7 +1,7 @@ -import news from './wh/news'; -import view from './view'; import sdrj from './sdrj'; +import view from './view'; import jwc from './wh/jwc'; +import news from './wh/news'; const index = (link) => { if (link.startsWith('https://xinwen.wh.sdu.edu.cn/')) { diff --git a/lib/routes/sdu/extractor/sdrj.ts b/lib/routes/sdu/extractor/sdrj.ts index 3cacd0eb6a..397f92c3be 100644 --- a/lib/routes/sdu/extractor/sdrj.ts +++ b/lib/routes/sdu/extractor/sdrj.ts @@ -1,6 +1,7 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/sdu/extractor/view.ts b/lib/routes/sdu/extractor/view.ts index bcf0118bd8..9f62f3d26e 100644 --- a/lib/routes/sdu/extractor/view.ts +++ b/lib/routes/sdu/extractor/view.ts @@ -1,6 +1,7 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/sdu/extractor/wh/jwc.ts b/lib/routes/sdu/extractor/wh/jwc.ts index 27a322685f..22755b8a75 100644 --- a/lib/routes/sdu/extractor/wh/jwc.ts +++ b/lib/routes/sdu/extractor/wh/jwc.ts @@ -1,6 +1,7 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/sdu/extractor/wh/news.ts b/lib/routes/sdu/extractor/wh/news.ts index 4fcda62285..88d430faea 100644 --- a/lib/routes/sdu/extractor/wh/news.ts +++ b/lib/routes/sdu/extractor/wh/news.ts @@ -1,6 +1,7 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/sdu/gjsw.ts b/lib/routes/sdu/gjsw.ts index 27d2ef4f68..2fea3b9e39 100644 --- a/lib/routes/sdu/gjsw.ts +++ b/lib/routes/sdu/gjsw.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { finishArticleItem } from '@/utils/wechat-mp'; diff --git a/lib/routes/sdu/mech.ts b/lib/routes/sdu/mech.ts index 7a9e48ff5b..c5cf3a5b82 100644 --- a/lib/routes/sdu/mech.ts +++ b/lib/routes/sdu/mech.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/sdu/qd/xszxqd.ts b/lib/routes/sdu/qd/xszxqd.ts index 8c75a0ea25..abee5ca4ae 100644 --- a/lib/routes/sdu/qd/xszxqd.ts +++ b/lib/routes/sdu/qd/xszxqd.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { finishArticleItem } from '@/utils/wechat-mp'; diff --git a/lib/routes/sdu/qd/xyb.ts b/lib/routes/sdu/qd/xyb.ts index 905ebac4b9..e09a1a4d21 100644 --- a/lib/routes/sdu/qd/xyb.ts +++ b/lib/routes/sdu/qd/xyb.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { finishArticleItem } from '@/utils/wechat-mp'; diff --git a/lib/routes/sdu/sc.ts b/lib/routes/sdu/sc.ts index 43732ed64b..0d38f43e92 100644 --- a/lib/routes/sdu/sc.ts +++ b/lib/routes/sdu/sc.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const host = 'https://www.sc.sdu.edu.cn/'; diff --git a/lib/routes/sdu/wh/jwc.ts b/lib/routes/sdu/wh/jwc.ts index e33de99dfe..126470fd6a 100644 --- a/lib/routes/sdu/wh/jwc.ts +++ b/lib/routes/sdu/wh/jwc.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import data from '../data'; -import extractor from '../extractor'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; +import data from '../data'; +import extractor from '../extractor'; + export const route: Route = { path: '/wh/jwc/:column?', categories: ['university'], diff --git a/lib/routes/sdu/wh/news.ts b/lib/routes/sdu/wh/news.ts index 42b8d7dae2..b3f4e42bf0 100644 --- a/lib/routes/sdu/wh/news.ts +++ b/lib/routes/sdu/wh/news.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; +import { parseDate } from '@/utils/parse-date'; + import data from '../data'; import extractor from '../extractor'; -import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/wh/news/:column?', diff --git a/lib/routes/sdu/ygb.ts b/lib/routes/sdu/ygb.ts index 56e99782e6..f81d91c386 100644 --- a/lib/routes/sdu/ygb.ts +++ b/lib/routes/sdu/ygb.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { finishArticleItem } from '@/utils/wechat-mp'; diff --git a/lib/routes/sdust/yjsy/zhaosheng.ts b/lib/routes/sdust/yjsy/zhaosheng.ts index c033d6ca7a..59c2cb0819 100644 --- a/lib/routes/sdust/yjsy/zhaosheng.ts +++ b/lib/routes/sdust/yjsy/zhaosheng.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/sdzk/index.ts b/lib/routes/sdzk/index.ts index c75848145f..a675639836 100644 --- a/lib/routes/sdzk/index.ts +++ b/lib/routes/sdzk/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/sec-in/index.ts b/lib/routes/sec-in/index.ts index ad5c680d60..fc0d3078b6 100644 --- a/lib/routes/sec-in/index.ts +++ b/lib/routes/sec-in/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/sec-wiki/weekly.ts b/lib/routes/sec-wiki/weekly.ts index 4a50ce3fbe..763d99db6b 100644 --- a/lib/routes/sec-wiki/weekly.ts +++ b/lib/routes/sec-wiki/weekly.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; // import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/secretsanfrancisco/rss.ts b/lib/routes/secretsanfrancisco/rss.ts index 47957b97c7..d50f56fc5c 100644 --- a/lib/routes/secretsanfrancisco/rss.ts +++ b/lib/routes/secretsanfrancisco/rss.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { load } from 'cheerio'; -import cache from '@/utils/cache'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/secrss/author.ts b/lib/routes/secrss/author.ts index 9fefa7d73e..d08c5db4bd 100644 --- a/lib/routes/secrss/author.ts +++ b/lib/routes/secrss/author.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; export const route: Route = { path: '/author/:author', diff --git a/lib/routes/secrss/category.ts b/lib/routes/secrss/category.ts index d4d46da673..75b4c7e897 100644 --- a/lib/routes/secrss/category.ts +++ b/lib/routes/secrss/category.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { load } from 'cheerio'; export const route: Route = { path: '/category/:category?', diff --git a/lib/routes/seekingalpha/index.ts b/lib/routes/seekingalpha/index.ts index b76e288e2a..e99b83d21c 100644 --- a/lib/routes/seekingalpha/index.ts +++ b/lib/routes/seekingalpha/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import path from 'node:path'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { art } from '@/utils/render'; import { parseDate } from '@/utils/parse-date'; -import path from 'node:path'; +import { art } from '@/utils/render'; const baseUrl = 'https://seekingalpha.com'; diff --git a/lib/routes/sega/maimaidx.ts b/lib/routes/sega/maimaidx.ts index 63984ffc97..57c40c3a9a 100644 --- a/lib/routes/sega/maimaidx.ts +++ b/lib/routes/sega/maimaidx.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import * as cheerio from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/maimaidx/news', diff --git a/lib/routes/sega/pjsekai.ts b/lib/routes/sega/pjsekai.ts index 03f6db774e..3e164b46c8 100644 --- a/lib/routes/sega/pjsekai.ts +++ b/lib/routes/sega/pjsekai.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import * as cheerio from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import timezone from '@/utils/timezone'; + export const route: Route = { path: '/pjsekai/news', categories: ['game'], diff --git a/lib/routes/segmentfault/blogs.ts b/lib/routes/segmentfault/blogs.ts index c81fcf4eb5..6d75152483 100644 --- a/lib/routes/segmentfault/blogs.ts +++ b/lib/routes/segmentfault/blogs.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { host, acw_sc__v2, parseList, parseItems } from './utils'; + +import { acw_sc__v2, host, parseItems, parseList } from './utils'; export const route: Route = { path: '/blogs/:tag', diff --git a/lib/routes/segmentfault/channel.ts b/lib/routes/segmentfault/channel.ts index ab764a7e17..3b60de3810 100644 --- a/lib/routes/segmentfault/channel.ts +++ b/lib/routes/segmentfault/channel.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { host, acw_sc__v2, parseList, parseItems } from './utils'; + +import { acw_sc__v2, host, parseItems, parseList } from './utils'; export const route: Route = { path: '/channel/:name', diff --git a/lib/routes/segmentfault/user.ts b/lib/routes/segmentfault/user.ts index 2beca2b643..8e16d0c7cc 100644 --- a/lib/routes/segmentfault/user.ts +++ b/lib/routes/segmentfault/user.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { host, acw_sc__v2, parseList, parseItems } from './utils'; + +import { acw_sc__v2, host, parseItems, parseList } from './utils'; export const route: Route = { path: '/user/:name', diff --git a/lib/routes/segmentfault/utils.ts b/lib/routes/segmentfault/utils.ts index 1a0489a500..b7294c02a2 100644 --- a/lib/routes/segmentfault/utils.ts +++ b/lib/routes/segmentfault/utils.ts @@ -1,7 +1,9 @@ -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + import { config } from '@/config'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + import { getAcwScV2ByArg1 } from '../5eplay/utils'; const host = 'https://segmentfault.com'; @@ -54,4 +56,4 @@ const parseItems = (cookie, item, tryGet) => return item; }); -export { host, acw_sc__v2, parseList, parseItems }; +export { acw_sc__v2, host, parseItems, parseList }; diff --git a/lib/routes/sehuatang/index.ts b/lib/routes/sehuatang/index.ts index 5b8ea3f3e7..8d04bc7928 100644 --- a/lib/routes/sehuatang/index.ts +++ b/lib/routes/sehuatang/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { config } from '@/config'; const host = 'https://www.sehuatang.net/'; diff --git a/lib/routes/sehuatang/user.ts b/lib/routes/sehuatang/user.ts index 96114e0399..c7df077bf3 100644 --- a/lib/routes/sehuatang/user.ts +++ b/lib/routes/sehuatang/user.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 + +import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; // 导入必要的模组 import got from '@/utils/got'; // 自订的 got -import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; const baseUrl = 'https://sehuatang.org/'; diff --git a/lib/routes/sensortower/blog.ts b/lib/routes/sensortower/blog.ts index 91778f2800..3029779f64 100644 --- a/lib/routes/sensortower/blog.ts +++ b/lib/routes/sensortower/blog.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/blog/:language?', diff --git a/lib/routes/setn/index.ts b/lib/routes/setn/index.ts index 4b390a0365..952012c7d2 100644 --- a/lib/routes/setn/index.ts +++ b/lib/routes/setn/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; const defaultRootUrl = 'https://www.setn.com'; diff --git a/lib/routes/seu/cse/index.ts b/lib/routes/seu/cse/index.ts index 27925e2c69..5482b0e5b0 100644 --- a/lib/routes/seu/cse/index.ts +++ b/lib/routes/seu/cse/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/seu/cyber/index.ts b/lib/routes/seu/cyber/index.ts index 43274f9c5d..3aa782e4bd 100644 --- a/lib/routes/seu/cyber/index.ts +++ b/lib/routes/seu/cyber/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/seu/radio/academic.ts b/lib/routes/seu/radio/academic.ts index aa3569d6cc..26413c0afc 100644 --- a/lib/routes/seu/radio/academic.ts +++ b/lib/routes/seu/radio/academic.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/seu/yjs.ts b/lib/routes/seu/yjs.ts index 792d264199..7f28b23ad8 100644 --- a/lib/routes/seu/yjs.ts +++ b/lib/routes/seu/yjs.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; const url = 'https://seugs.seu.edu.cn/26671/list.htm'; diff --git a/lib/routes/seu/yzb/index.ts b/lib/routes/seu/yzb/index.ts index 57aed72cbb..d4a05e5086 100644 --- a/lib/routes/seu/yzb/index.ts +++ b/lib/routes/seu/yzb/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/sfacg/novel-chapter.ts b/lib/routes/sfacg/novel-chapter.ts index 965f0c16cc..103c76de5f 100644 --- a/lib/routes/sfacg/novel-chapter.ts +++ b/lib/routes/sfacg/novel-chapter.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/shcstheatre/programs.ts b/lib/routes/shcstheatre/programs.ts index 90ddc22570..6d5d6d966b 100644 --- a/lib/routes/shcstheatre/programs.ts +++ b/lib/routes/shcstheatre/programs.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { art } from '@/utils/render'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; -import { load } from 'cheerio'; -import path from 'node:path'; export const route: Route = { path: '/programs', diff --git a/lib/routes/shiep/index.ts b/lib/routes/shiep/index.ts index 83af844bf3..3c95bf790f 100644 --- a/lib/routes/shiep/index.ts +++ b/lib/routes/shiep/index.ts @@ -1,15 +1,17 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import dayjs from 'dayjs'; -import path from 'node:path'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; + import { config } from './config'; import { radar } from './radar'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; export const route: Route = { path: '/:type/:id?', diff --git a/lib/routes/shisu/en.ts b/lib/routes/shisu/en.ts index 6d89518ccf..62438ea48c 100644 --- a/lib/routes/shisu/en.ts +++ b/lib/routes/shisu/en.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const url = 'http://en.shisu.edu.cn'; diff --git a/lib/routes/shisu/news.ts b/lib/routes/shisu/news.ts index 79b983b9c6..b7f2c6b6c5 100644 --- a/lib/routes/shisu/news.ts +++ b/lib/routes/shisu/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const url = 'https://news.shisu.edu.cn'; diff --git a/lib/routes/shmeea/index.ts b/lib/routes/shmeea/index.ts index 900820b1f8..2291935e9e 100644 --- a/lib/routes/shmeea/index.ts +++ b/lib/routes/shmeea/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/:id?', diff --git a/lib/routes/shmeea/self-study.ts b/lib/routes/shmeea/self-study.ts index b5434032b1..1e1dc8d850 100644 --- a/lib/routes/shmeea/self-study.ts +++ b/lib/routes/shmeea/self-study.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/shmtu/jwc.ts b/lib/routes/shmtu/jwc.ts index 9b51d6dd6d..e588409ee9 100644 --- a/lib/routes/shmtu/jwc.ts +++ b/lib/routes/shmtu/jwc.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + const host = 'https://jwc.shmtu.edu.cn'; async function loadContent(link) { diff --git a/lib/routes/shmtu/portal.ts b/lib/routes/shmtu/portal.ts index 76f2236371..d520a7a133 100644 --- a/lib/routes/shmtu/portal.ts +++ b/lib/routes/shmtu/portal.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; -import path from 'node:path'; import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; const bootstrapHost = 'https://weixin.shmtu.edu.cn/dynamic/shmtuHttps'; const host = 'https://portal.shmtu.edu.cn/api'; diff --git a/lib/routes/shmtu/www.ts b/lib/routes/shmtu/www.ts index 5c86c2a4d8..b7480eff6e 100644 --- a/lib/routes/shmtu/www.ts +++ b/lib/routes/shmtu/www.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const host = 'https://www.shmtu.edu.cn'; async function loadContent(link) { diff --git a/lib/routes/shoac/recent-show.ts b/lib/routes/shoac/recent-show.ts index a6b43f4b13..61d7308c14 100644 --- a/lib/routes/shoac/recent-show.ts +++ b/lib/routes/shoac/recent-show.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import path from 'node:path'; -import { art } from '@/utils/render'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; export const route: Route = { path: '/recent-show', diff --git a/lib/routes/shopback/store.ts b/lib/routes/shopback/store.ts index af21e4db64..738fd111b3 100644 --- a/lib/routes/shopback/store.ts +++ b/lib/routes/shopback/store.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/:store', categories: ['shopping'], diff --git a/lib/routes/shopify/apps/[handle].reviews.ts b/lib/routes/shopify/apps/[handle].reviews.ts index 91e4ed8619..e124416eb1 100644 --- a/lib/routes/shopify/apps/[handle].reviews.ts +++ b/lib/routes/shopify/apps/[handle].reviews.ts @@ -1,8 +1,10 @@ -import { Data, DataItem, Route } from '@/types'; -import { Context } from 'hono'; -import { baseURL } from './const'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { Data, DataItem, Route } from '@/types'; +import got from '@/utils/got'; + +import { baseURL } from './const'; export const route: Route = { path: '/apps/:handle/reviews/:page?', diff --git a/lib/routes/shopify/apps/search.ts b/lib/routes/shopify/apps/search.ts index 9da81cc6d9..f08968a648 100644 --- a/lib/routes/shopify/apps/search.ts +++ b/lib/routes/shopify/apps/search.ts @@ -1,7 +1,9 @@ -import { Data, DataItem, Route } from '@/types'; -import type { Context } from 'hono'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { Data, DataItem, Route } from '@/types'; +import got from '@/utils/got'; + import { baseURL } from './const'; export const route: Route = { diff --git a/lib/routes/shoppingdesign/posts.ts b/lib/routes/shoppingdesign/posts.ts index 0e8c4beac7..4a4595a618 100644 --- a/lib/routes/shoppingdesign/posts.ts +++ b/lib/routes/shoppingdesign/posts.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import pMap from 'p-map'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import pMap from 'p-map'; export const route: Route = { path: '/posts', diff --git a/lib/routes/showstart/artist.ts b/lib/routes/showstart/artist.ts index 564253e7a8..1a18e443a6 100644 --- a/lib/routes/showstart/artist.ts +++ b/lib/routes/showstart/artist.ts @@ -1,8 +1,10 @@ -import { Data, Route } from '@/types'; -import { TITLE, HOST } from './const'; -import { fetchPerformerInfo } from './service'; import type { Context } from 'hono'; +import type { Data, Route } from '@/types'; + +import { HOST, TITLE } from './const'; +import { fetchPerformerInfo } from './service'; + export const route: Route = { path: '/artist/:id', categories: ['shopping'], diff --git a/lib/routes/showstart/brand.ts b/lib/routes/showstart/brand.ts index ffb7c70c1b..5dfafc70af 100644 --- a/lib/routes/showstart/brand.ts +++ b/lib/routes/showstart/brand.ts @@ -1,8 +1,10 @@ -import { Data, Route } from '@/types'; -import { TITLE, HOST } from './const'; -import { fetchBrandInfo } from './service'; import type { Context } from 'hono'; +import type { Data, Route } from '@/types'; + +import { HOST, TITLE } from './const'; +import { fetchBrandInfo } from './service'; + export const route: Route = { path: '/brand/:id', categories: ['shopping'], diff --git a/lib/routes/showstart/event.ts b/lib/routes/showstart/event.ts index 5b822baa98..57f8237b7a 100644 --- a/lib/routes/showstart/event.ts +++ b/lib/routes/showstart/event.ts @@ -1,8 +1,10 @@ -import { Data, Route } from '@/types'; -import { TITLE, HOST } from './const'; -import { fetchActivityList, fetchDictionary } from './service'; import type { Context } from 'hono'; +import type { Data, Route } from '@/types'; + +import { HOST, TITLE } from './const'; +import { fetchActivityList, fetchDictionary } from './service'; + export const route: Route = { path: '/event/:cityCode/:showStyle?', categories: ['shopping'], diff --git a/lib/routes/showstart/search.ts b/lib/routes/showstart/search.ts index 0794ac08fb..3568248986 100644 --- a/lib/routes/showstart/search.ts +++ b/lib/routes/showstart/search.ts @@ -1,8 +1,10 @@ -import { Data, Route } from '@/types'; -import { TITLE, HOST } from './const'; -import { fetchActivityList, fetchPerformerList, fetchSiteList, fetchBrandList, fetchCityList, fetchStyleList } from './service'; import type { Context } from 'hono'; +import type { Data, Route } from '@/types'; + +import { HOST, TITLE } from './const'; +import { fetchActivityList, fetchBrandList, fetchCityList, fetchPerformerList, fetchSiteList, fetchStyleList } from './service'; + export const route: Route = { path: '/search/:type/:keyword?', categories: ['shopping'], diff --git a/lib/routes/showstart/service.ts b/lib/routes/showstart/service.ts index 0ba5b8cbcc..519233a80b 100644 --- a/lib/routes/showstart/service.ts +++ b/lib/routes/showstart/service.ts @@ -183,4 +183,4 @@ async function fetchDictionary(cityCode: string, showStyle: string) { }; } -export { fetchActivityList, fetchCityList, fetchStyleList, fetchPerformerList, fetchPerformerInfo, fetchSiteList, fetchSiteInfo, fetchBrandList, fetchBrandInfo, fetchDictionary }; +export { fetchActivityList, fetchBrandInfo, fetchBrandList, fetchCityList, fetchDictionary, fetchPerformerInfo, fetchPerformerList, fetchSiteInfo, fetchSiteList, fetchStyleList }; diff --git a/lib/routes/showstart/site.ts b/lib/routes/showstart/site.ts index 46da8ca951..2c4c625c9b 100644 --- a/lib/routes/showstart/site.ts +++ b/lib/routes/showstart/site.ts @@ -1,7 +1,9 @@ -import { Data, Route } from '@/types'; -import { TITLE, HOST } from './const'; +import type { Context } from 'hono'; + +import type { Data, Route } from '@/types'; + +import { HOST, TITLE } from './const'; import { fetchActivityList, fetchSiteInfo } from './service'; -import { Context } from 'hono'; export const route: Route = { path: '/site/:siteId', diff --git a/lib/routes/showstart/utils.ts b/lib/routes/showstart/utils.ts index 5cf63d4c98..2b3e7d9b6b 100644 --- a/lib/routes/showstart/utils.ts +++ b/lib/routes/showstart/utils.ts @@ -84,4 +84,4 @@ function uniqBy(items: any[], key: string) { }); } -export { post, getAccessToken, uuid, sortBy, uniqBy }; +export { getAccessToken, post, sortBy, uniqBy, uuid }; diff --git a/lib/routes/shu/global.ts b/lib/routes/shu/global.ts index f1e255a181..54ea2844c8 100644 --- a/lib/routes/shu/global.ts +++ b/lib/routes/shu/global.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; // cheerio@1.0.0 + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; // cheerio@1.0.0 import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/shu/gs.ts b/lib/routes/shu/gs.ts index 9b693ae89c..a6ff6bac56 100644 --- a/lib/routes/shu/gs.ts +++ b/lib/routes/shu/gs.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; // cheerio@1.0.0 + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; // cheerio@1.0.0 import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/shu/index.ts b/lib/routes/shu/index.ts index abdf79a0b1..a18462c1db 100644 --- a/lib/routes/shu/index.ts +++ b/lib/routes/shu/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; // cheerio@1.0.0 + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; // cheerio@1.0.0 import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/shu/jwb.ts b/lib/routes/shu/jwb.ts index 61d908777f..83cb7b1b4d 100644 --- a/lib/routes/shu/jwb.ts +++ b/lib/routes/shu/jwb.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const host = 'https://jwb.shu.edu.cn/'; diff --git a/lib/routes/shu/society.ts b/lib/routes/shu/society.ts index 6da04f7760..3e32376bd2 100644 --- a/lib/routes/shu/society.ts +++ b/lib/routes/shu/society.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/shu/xxgk.ts b/lib/routes/shu/xxgk.ts index e2ab63dec3..6484e584d0 100644 --- a/lib/routes/shu/xxgk.ts +++ b/lib/routes/shu/xxgk.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/shu/xykd.ts b/lib/routes/shu/xykd.ts index 15a3cef593..69c6bc8e36 100644 --- a/lib/routes/shu/xykd.ts +++ b/lib/routes/shu/xykd.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; // cheerio@1.0.0 + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; // cheerio@1.0.0 import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/shuiguopai/index.ts b/lib/routes/shuiguopai/index.ts index 73949f23d6..c4f00defe7 100644 --- a/lib/routes/shuiguopai/index.ts +++ b/lib/routes/shuiguopai/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/', diff --git a/lib/routes/sicau/dky.ts b/lib/routes/sicau/dky.ts index d98801a34b..e0f9b23500 100644 --- a/lib/routes/sicau/dky.ts +++ b/lib/routes/sicau/dky.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/sicau/jiaowu.ts b/lib/routes/sicau/jiaowu.ts index b320f189e7..6f9e7c6e31 100644 --- a/lib/routes/sicau/jiaowu.ts +++ b/lib/routes/sicau/jiaowu.ts @@ -1,10 +1,11 @@ -import { DataItem, Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import { Language } from '@/routes/kurogames/wutheringwaves/constants'; +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { Language } from '@/routes/kurogames/wutheringwaves/constants'; const $get = async (url: string, encoding = 'gb2312') => new TextDecoder(encoding).decode(await ofetch(url, { responseType: 'arrayBuffer' })); const $trim = (str: string) => { diff --git a/lib/routes/sicau/jk.ts b/lib/routes/sicau/jk.ts index 21262bb127..44bf784769 100644 --- a/lib/routes/sicau/jk.ts +++ b/lib/routes/sicau/jk.ts @@ -1,6 +1,6 @@ -import { DataItem, Route } from '@/types'; -import ofetch from '@/utils/ofetch'; +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/sicau/yan.ts b/lib/routes/sicau/yan.ts index 1838df0716..9cf9dbab04 100644 --- a/lib/routes/sicau/yan.ts +++ b/lib/routes/sicau/yan.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/sicau/zsjy.ts b/lib/routes/sicau/zsjy.ts index 7c07626252..197be16cde 100644 --- a/lib/routes/sicau/zsjy.ts +++ b/lib/routes/sicau/zsjy.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/sigsac/ccs.ts b/lib/routes/sigsac/ccs.ts index 0647652739..3074edd244 100644 --- a/lib/routes/sigsac/ccs.ts +++ b/lib/routes/sigsac/ccs.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -const url = 'https://www.sigsac.org/'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; + +const url = 'https://www.sigsac.org/'; // https://www.sigsac.org/ccs/CCS2022/program/accepted-papers.html export const route: Route = { diff --git a/lib/routes/simpleinfo/index.ts b/lib/routes/simpleinfo/index.ts index 1fd3ad1f12..8130f2c780 100644 --- a/lib/routes/simpleinfo/index.ts +++ b/lib/routes/simpleinfo/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; -import path from 'node:path'; -import { art } from '@/utils/render'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/sina/chuangshiji.ts b/lib/routes/sina/chuangshiji.ts index 74e8a47239..50355859d4 100644 --- a/lib/routes/sina/chuangshiji.ts +++ b/lib/routes/sina/chuangshiji.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { getRollNewsList, parseRollNewsList, parseArticle } from './utils'; + +import { getRollNewsList, parseArticle, parseRollNewsList } from './utils'; export const route: Route = { path: '/csj', diff --git a/lib/routes/sina/discovery.ts b/lib/routes/sina/discovery.ts index aa63a2a989..39af3bbd9c 100644 --- a/lib/routes/sina/discovery.ts +++ b/lib/routes/sina/discovery.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { getRollNewsList, parseRollNewsList, parseArticle } from './utils'; + +import { getRollNewsList, parseArticle, parseRollNewsList } from './utils'; const link = 'https://tech.sina.com.cn/discovery/'; const map = new Map([ diff --git a/lib/routes/sina/finance/china.ts b/lib/routes/sina/finance/china.ts index 6b88d0433d..b4568ff9fd 100644 --- a/lib/routes/sina/finance/china.ts +++ b/lib/routes/sina/finance/china.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { getRollNewsList, parseRollNewsList, parseArticle } from '../utils'; + +import { getRollNewsList, parseArticle, parseRollNewsList } from '../utils'; export const route: Route = { path: '/finance/china/:lid?', diff --git a/lib/routes/sina/finance/stock/usstock.ts b/lib/routes/sina/finance/stock/usstock.ts index 251b107ad2..9b036fd102 100644 --- a/lib/routes/sina/finance/stock/usstock.ts +++ b/lib/routes/sina/finance/stock/usstock.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { parseArticle } from '../../utils'; export const route: Route = { diff --git a/lib/routes/sina/rollnews.ts b/lib/routes/sina/rollnews.ts index e6af3fa09c..b23e14c4f0 100644 --- a/lib/routes/sina/rollnews.ts +++ b/lib/routes/sina/rollnews.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { getRollNewsList, parseRollNewsList, parseArticle } from './utils'; + +import { getRollNewsList, parseArticle, parseRollNewsList } from './utils'; export const route: Route = { path: '/rollnews/:lid?', diff --git a/lib/routes/sina/sports.ts b/lib/routes/sina/sports.ts index d8915d4005..20d739b5ec 100644 --- a/lib/routes/sina/sports.ts +++ b/lib/routes/sina/sports.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import { parseArticle } from './utils'; export const route: Route = { diff --git a/lib/routes/sina/utils.ts b/lib/routes/sina/utils.ts index 2251c8f004..977510e5f7 100644 --- a/lib/routes/sina/utils.ts +++ b/lib/routes/sina/utils.ts @@ -1,10 +1,12 @@ -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; + const getRollNewsList = (pageid, lid, limit) => got('https://feed.mix.sina.com.cn/api/roll/get', { headers: { @@ -97,4 +99,4 @@ const parseArticle = (item, tryGet) => return item; }); -export { getRollNewsList, parseRollNewsList, parseArticle }; +export { getRollNewsList, parseArticle, parseRollNewsList }; diff --git a/lib/routes/sinchew/index.ts b/lib/routes/sinchew/index.ts index 8e8e611147..200c7b77a2 100644 --- a/lib/routes/sinchew/index.ts +++ b/lib/routes/sinchew/index.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; +import path from 'node:path'; -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 type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '*', diff --git a/lib/routes/sis001/author.ts b/lib/routes/sis001/author.ts index 5f3e629ba1..8f2b33568d 100644 --- a/lib/routes/sis001/author.ts +++ b/lib/routes/sis001/author.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; -import { config } from '@/config'; import { load } from 'cheerio'; import type { Context } from 'hono'; + +import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + import { getCookie, getThread } from './common'; export const route: Route = { diff --git a/lib/routes/sis001/common.ts b/lib/routes/sis001/common.ts index 92ee06aea8..1dbcb72911 100644 --- a/lib/routes/sis001/common.ts +++ b/lib/routes/sis001/common.ts @@ -1,11 +1,12 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; +import CryptoJS from 'crypto-js'; + +import { config } from '@/config'; +import type { DataItem } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { DataItem } from '@/types'; -import CryptoJS from 'crypto-js'; -import cache from '@/utils/cache'; -import { config } from '@/config'; function getCookie(url: string): Promise { return cache.tryGet( diff --git a/lib/routes/sis001/forum.ts b/lib/routes/sis001/forum.ts index 1c1ac5bd88..8b8d165a75 100644 --- a/lib/routes/sis001/forum.ts +++ b/lib/routes/sis001/forum.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; -import { config } from '@/config'; import { load } from 'cheerio'; import type { Context } from 'hono'; + +import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + import { getCookie, getThread } from './common'; export const route: Route = { diff --git a/lib/routes/sjtu/gs.ts b/lib/routes/sjtu/gs.ts index 8d3d9fdb41..401d24926f 100644 --- a/lib/routes/sjtu/gs.ts +++ b/lib/routes/sjtu/gs.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; import { fetchArticle } from '@/utils/wechat-mp'; diff --git a/lib/routes/sjtu/jwc.ts b/lib/routes/sjtu/jwc.ts index 2f1c9d33b5..c9278d3646 100644 --- a/lib/routes/sjtu/jwc.ts +++ b/lib/routes/sjtu/jwc.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const urlRoot = 'https://jwc.sjtu.edu.cn'; diff --git a/lib/routes/sjtu/seiee/icisee.ts b/lib/routes/sjtu/seiee/icisee.ts index 0535a932ea..a6a1b0512e 100644 --- a/lib/routes/sjtu/seiee/icisee.ts +++ b/lib/routes/sjtu/seiee/icisee.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import ofetch from '@/utils/ofetch'; import { finishArticleItem } from '@/utils/wechat-mp'; export const route: Route = { diff --git a/lib/routes/sjtu/seiee/index.ts b/lib/routes/sjtu/seiee/index.ts index d7ec9548dc..89fec8c7ae 100644 --- a/lib/routes/sjtu/seiee/index.ts +++ b/lib/routes/sjtu/seiee/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import ofetch from '@/utils/ofetch'; export const route: Route = { path: '/seiee/:path/:catID?/:searchCatCode?', diff --git a/lib/routes/sjtu/seiee/utils.ts b/lib/routes/sjtu/seiee/utils.ts index 9cd5394bea..3ca5e5db0f 100644 --- a/lib/routes/sjtu/seiee/utils.ts +++ b/lib/routes/sjtu/seiee/utils.ts @@ -1,6 +1,7 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const host = 'https://bjwb.seiee.sjtu.edu.cn'; diff --git a/lib/routes/sjtu/tongqu/activity.ts b/lib/routes/sjtu/tongqu/activity.ts index e5f0490bfc..3290b1eef7 100644 --- a/lib/routes/sjtu/tongqu/activity.ts +++ b/lib/routes/sjtu/tongqu/activity.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; const urlRoot = 'https://tongqu.sjtu.edu.cn'; diff --git a/lib/routes/sjtu/yzb/zkxx.ts b/lib/routes/sjtu/yzb/zkxx.ts index ab2ce285e1..f4d673fcf5 100644 --- a/lib/routes/sjtu/yzb/zkxx.ts +++ b/lib/routes/sjtu/yzb/zkxx.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { fetchArticle } from '@/utils/wechat-mp'; -import ofetch from '@/utils/ofetch'; const baseTitle = '上海交通大学研究生招生网招考信息'; const baseUrl = 'https://yzb.sjtu.edu.cn/index/zkxx/'; diff --git a/lib/routes/skeb/following-creators.ts b/lib/routes/skeb/following-creators.ts index 5ad246c159..9b89e967b1 100644 --- a/lib/routes/skeb/following-creators.ts +++ b/lib/routes/skeb/following-creators.ts @@ -1,6 +1,7 @@ -import { Data, DataItem, Route } from '@/types'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Data, DataItem, Route } from '@/types'; + import { getFollowingsItems } from './utils'; export const route: Route = { diff --git a/lib/routes/skeb/following-works.ts b/lib/routes/skeb/following-works.ts index dcc8c3216b..1f9682a576 100644 --- a/lib/routes/skeb/following-works.ts +++ b/lib/routes/skeb/following-works.ts @@ -1,6 +1,7 @@ -import { Data, DataItem, Route } from '@/types'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Data, DataItem, Route } from '@/types'; + import { getFollowingsItems } from './utils'; export const route: Route = { diff --git a/lib/routes/skeb/friend-works.ts b/lib/routes/skeb/friend-works.ts index cb6c0124b3..4f4bb11754 100644 --- a/lib/routes/skeb/friend-works.ts +++ b/lib/routes/skeb/friend-works.ts @@ -1,6 +1,7 @@ -import { Data, DataItem, Route } from '@/types'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Data, DataItem, Route } from '@/types'; + import { getFollowingsItems } from './utils'; export const route: Route = { diff --git a/lib/routes/skeb/index.ts b/lib/routes/skeb/index.ts index ee96147410..596a8ed441 100644 --- a/lib/routes/skeb/index.ts +++ b/lib/routes/skeb/index.ts @@ -1,8 +1,9 @@ -import { Route, Data, DataItem } from '@/types'; -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; -import { baseUrl, processWork, processCreator } from './utils'; import { config } from '@/config'; +import type { Data, DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + +import { baseUrl, processCreator, processWork } from './utils'; const categoryMap = { // Works categories diff --git a/lib/routes/skeb/search.ts b/lib/routes/skeb/search.ts index 3a4978a011..4df1dae4e7 100644 --- a/lib/routes/skeb/search.ts +++ b/lib/routes/skeb/search.ts @@ -1,8 +1,9 @@ -import { Data, DataItem, Route } from '@/types'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { processWork, baseUrl } from './utils'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; + +import { baseUrl, processWork } from './utils'; export const route: Route = { path: '/search/:keyword', diff --git a/lib/routes/skeb/utils.ts b/lib/routes/skeb/utils.ts index 41d822ca4b..3d03bc9e31 100644 --- a/lib/routes/skeb/utils.ts +++ b/lib/routes/skeb/utils.ts @@ -1,9 +1,10 @@ +import path from 'node:path'; + import { config } from '@/config'; -import { DataItem } from '@/types'; +import type { DataItem } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { art } from '@/utils/render'; -import path from 'node:path'; export const baseUrl = 'https://skeb.jp'; diff --git a/lib/routes/skeb/works.ts b/lib/routes/skeb/works.ts index d92e714ac1..017702de6b 100644 --- a/lib/routes/skeb/works.ts +++ b/lib/routes/skeb/works.ts @@ -1,10 +1,11 @@ -import { Data, DataItem, Route } from '@/types'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; -import { baseUrl, processWork } from './utils'; +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; import logger from '@/utils/logger'; +import ofetch from '@/utils/ofetch'; + +import { baseUrl, processWork } from './utils'; export const route: Route = { path: '/works/:username', diff --git a/lib/routes/skebetter/illust.ts b/lib/routes/skebetter/illust.ts index 9abcb46894..ea8c5ac7c2 100644 --- a/lib/routes/skebetter/illust.ts +++ b/lib/routes/skebetter/illust.ts @@ -1,7 +1,8 @@ -import { Data, DataItem, Route } from '@/types'; -import cache from '@/utils/cache'; -import { processItems, fetchData } from './utils'; import { config } from '@/config'; +import type { Data, DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; + +import { fetchData, processItems } from './utils'; export const route: Route = { path: '/illust/:type', diff --git a/lib/routes/skebetter/index.ts b/lib/routes/skebetter/index.ts index 2740ded526..563eb27699 100644 --- a/lib/routes/skebetter/index.ts +++ b/lib/routes/skebetter/index.ts @@ -1,7 +1,8 @@ -import { Data, DataItem, Route } from '@/types'; -import cache from '@/utils/cache'; -import { processItems, fetchData } from './utils'; import { config } from '@/config'; +import type { Data, DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; + +import { fetchData, processItems } from './utils'; export const route: Route = { path: '/:type', diff --git a/lib/routes/skebetter/manga.ts b/lib/routes/skebetter/manga.ts index a728a35971..5965ae4d4c 100644 --- a/lib/routes/skebetter/manga.ts +++ b/lib/routes/skebetter/manga.ts @@ -1,7 +1,8 @@ -import { Data, DataItem, Route } from '@/types'; -import cache from '@/utils/cache'; -import { processItems, fetchData } from './utils'; import { config } from '@/config'; +import type { Data, DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; + +import { fetchData, processItems } from './utils'; export const route: Route = { path: '/manga/:order', diff --git a/lib/routes/skebetter/utils.ts b/lib/routes/skebetter/utils.ts index 271fe55398..40de43522b 100644 --- a/lib/routes/skebetter/utils.ts +++ b/lib/routes/skebetter/utils.ts @@ -1,4 +1,4 @@ -import { DataItem } from '@/types'; +import type { DataItem } from '@/types'; import ofetch from '@/utils/ofetch'; export interface MediaUrl { diff --git a/lib/routes/sketis/isabelle-dev/blog/index.ts b/lib/routes/sketis/isabelle-dev/blog/index.ts index f2c39ec19c..24001b9aed 100644 --- a/lib/routes/sketis/isabelle-dev/blog/index.ts +++ b/lib/routes/sketis/isabelle-dev/blog/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; const source = [ diff --git a/lib/routes/skysports/news.ts b/lib/routes/skysports/news.ts index 5c297fbff4..93b105c4f1 100644 --- a/lib/routes/skysports/news.ts +++ b/lib/routes/skysports/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/slowmist/slowmist.ts b/lib/routes/slowmist/slowmist.ts index ce34b02dbe..905fd6ced5 100644 --- a/lib/routes/slowmist/slowmist.ts +++ b/lib/routes/slowmist/slowmist.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -const baseUrl = 'https://www.slowmist.com'; import { finishArticleItem } from '@/utils/wechat-mp'; +const baseUrl = 'https://www.slowmist.com'; + export const route: Route = { path: '/:type?', categories: ['new-media'], diff --git a/lib/routes/smartlink/index.ts b/lib/routes/smartlink/index.ts index 235fc805ba..7d8e05104e 100644 --- a/lib/routes/smartlink/index.ts +++ b/lib/routes/smartlink/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import { toTitleCase } from '@/utils/common-utils'; import ofetch from '@/utils/ofetch'; diff --git a/lib/routes/smashingmagazine/category.ts b/lib/routes/smashingmagazine/category.ts index ebf06eb14f..bbe17e4858 100644 --- a/lib/routes/smashingmagazine/category.ts +++ b/lib/routes/smashingmagazine/category.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/smzdm/article.ts b/lib/routes/smzdm/article.ts index f87cbb81d5..8a19c4aff1 100644 --- a/lib/routes/smzdm/article.ts +++ b/lib/routes/smzdm/article.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { config } from '@/config'; + import { getHeaders } from './utils'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; export const route: Route = { path: '/article/:uid', diff --git a/lib/routes/smzdm/baoliao.ts b/lib/routes/smzdm/baoliao.ts index a3314e5d27..bc89f17c23 100644 --- a/lib/routes/smzdm/baoliao.ts +++ b/lib/routes/smzdm/baoliao.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { config } from '@/config'; + import { getHeaders } from './utils'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; export const route: Route = { path: '/baoliao/:uid', diff --git a/lib/routes/smzdm/haowen-fenlei.ts b/lib/routes/smzdm/haowen-fenlei.ts index 35ece724ba..281675dbf2 100644 --- a/lib/routes/smzdm/haowen-fenlei.ts +++ b/lib/routes/smzdm/haowen-fenlei.ts @@ -1,12 +1,15 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; 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 { config } from '@/config'; +import timezone from '@/utils/timezone'; + import { getHeaders } from './utils'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; + export const route: Route = { path: '/haowen/fenlei/:name/:sort?', categories: ['shopping'], diff --git a/lib/routes/smzdm/haowen.ts b/lib/routes/smzdm/haowen.ts index 11e5aa5ddb..2b616a0e81 100644 --- a/lib/routes/smzdm/haowen.ts +++ b/lib/routes/smzdm/haowen.ts @@ -1,12 +1,14 @@ -import { DataItem, Route } from '@/types'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { getHeaders } from './utils'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; -import { config } from '@/config'; export const route: Route = { path: '/haowen/:day?', diff --git a/lib/routes/smzdm/keyword.ts b/lib/routes/smzdm/keyword.ts index 30c146cc6b..1c30b1bf5a 100644 --- a/lib/routes/smzdm/keyword.ts +++ b/lib/routes/smzdm/keyword.ts @@ -1,11 +1,14 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { getHeaders } from './utils'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; -import { config } from '@/config'; export const route: Route = { path: '/keyword/:keyword', diff --git a/lib/routes/smzdm/product.ts b/lib/routes/smzdm/product.ts index d8673e4f9a..ccd06dd571 100644 --- a/lib/routes/smzdm/product.ts +++ b/lib/routes/smzdm/product.ts @@ -1,10 +1,12 @@ -import { Route, DataItem } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import cache from '@/utils/cache'; -import { getHeaders } from './utils'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; + import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + +import { getHeaders } from './utils'; export const route: Route = { path: '/product/:id', diff --git a/lib/routes/smzdm/ranking.ts b/lib/routes/smzdm/ranking.ts index 4a7956a8ca..0736b5da1f 100644 --- a/lib/routes/smzdm/ranking.ts +++ b/lib/routes/smzdm/ranking.ts @@ -1,9 +1,11 @@ import { config } from '@/config'; -import { Route, ViewType } from '@/types'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import timezone from '@/utils/timezone'; + import { getHeaders } from './utils'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; const getTrueHour = (rank_type, rank_id, hour) => { const rank_two_hour = ['11', '17', '28', '29']; diff --git a/lib/routes/snowpeak/us-new-arrivals.ts b/lib/routes/snowpeak/us-new-arrivals.ts index 091a39e047..7826369293 100644 --- a/lib/routes/snowpeak/us-new-arrivals.ts +++ b/lib/routes/snowpeak/us-new-arrivals.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { load } from 'cheerio'; + const host = 'https://www.snowpeak.com'; export const route: Route = { path: '/us/new-arrivals', diff --git a/lib/routes/sobooks/date.ts b/lib/routes/sobooks/date.ts index 1a559a8310..aa958e205f 100644 --- a/lib/routes/sobooks/date.ts +++ b/lib/routes/sobooks/date.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/sobooks/index.ts b/lib/routes/sobooks/index.ts index 3d53bbdfab..0c90598e20 100644 --- a/lib/routes/sobooks/index.ts +++ b/lib/routes/sobooks/index.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/sobooks/tag.ts b/lib/routes/sobooks/tag.ts index 9fe0ddb319..3fe68508fb 100644 --- a/lib/routes/sobooks/tag.ts +++ b/lib/routes/sobooks/tag.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import utils from './utils'; export const route: Route = { diff --git a/lib/routes/sobooks/utils.ts b/lib/routes/sobooks/utils.ts index 7437978147..902a264d90 100644 --- a/lib/routes/sobooks/utils.ts +++ b/lib/routes/sobooks/utils.ts @@ -1,6 +1,7 @@ +import { load } from 'cheerio'; + import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const utils = async (ctx, currentUrl) => { diff --git a/lib/routes/sogou/doodles.ts b/lib/routes/sogou/doodles.ts index 1ee23c7900..2f868213b9 100644 --- a/lib/routes/sogou/doodles.ts +++ b/lib/routes/sogou/doodles.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/sogou/search.ts b/lib/routes/sogou/search.ts index 6b2918069c..9ed582c81a 100644 --- a/lib/routes/sogou/search.ts +++ b/lib/routes/sogou/search.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; -import path from 'node:path'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; +import { art } from '@/utils/render'; const renderDescription = (description, images) => art(path.join(__dirname, './templates/description.art'), { description, images }); diff --git a/lib/routes/sohu/mobile.ts b/lib/routes/sohu/mobile.ts index b3db164bee..5fc65c0322 100644 --- a/lib/routes/sohu/mobile.ts +++ b/lib/routes/sohu/mobile.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; import * as cheerio from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import logger from '@/utils/logger'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/sohu/mp.ts b/lib/routes/sohu/mp.ts index ac2b3d9173..f01cdc54aa 100644 --- a/lib/routes/sohu/mp.ts +++ b/lib/routes/sohu/mp.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import * as cheerio from 'cheerio'; +import CryptoJS from 'crypto-js'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import * as cheerio from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; -import path from 'node:path'; import { art } from '@/utils/render'; -import CryptoJS from 'crypto-js'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/mp/:xpt', diff --git a/lib/routes/solidot/_article.ts b/lib/routes/solidot/_article.ts index 270651f3e1..341db83b36 100644 --- a/lib/routes/solidot/_article.ts +++ b/lib/routes/solidot/_article.ts @@ -1,5 +1,6 @@ -import got from '@/utils/got'; // get web content import { load } from 'cheerio'; // html parser + +import got from '@/utils/got'; // get web content import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/solidot/main.ts b/lib/routes/solidot/main.ts index b919e0adb0..a6de6560b7 100644 --- a/lib/routes/solidot/main.ts +++ b/lib/routes/solidot/main.ts @@ -1,15 +1,16 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; // html parser + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; // Warning: The author still knows nothing about javascript! - // params: // type: subject type - import got from '@/utils/got'; // get web content -import { load } from 'cheerio'; // html parser -import get_article from './_article'; import { isValidHost } from '@/utils/valid-host'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; + +import get_article from './_article'; export const route: Route = { path: '/:type?', diff --git a/lib/routes/sony/downloads.ts b/lib/routes/sony/downloads.ts index 2bfb5b3657..da6ff3f244 100644 --- a/lib/routes/sony/downloads.ts +++ b/lib/routes/sony/downloads.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; + const host = 'https://www.sony.com'; export const route: Route = { path: '/downloads/:productType/:productId', diff --git a/lib/routes/sorrycc/index.ts b/lib/routes/sorrycc/index.ts index 6d96a4db93..5008fb02fd 100644 --- a/lib/routes/sorrycc/index.ts +++ b/lib/routes/sorrycc/index.ts @@ -1,12 +1,14 @@ -import { type DataItem, ViewType, type Data, type Route } from '@/types'; -import type { Context } from 'hono'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import cache from '@/utils/cache'; -import type { Post } from './types'; +import type { Context } from 'hono'; + import { config } from '@/config'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import type { Post } from './types'; + const WORDPRESS_HASH = 'f05fca638390aed897fbe3c2fff03000'; export const route: Route = { diff --git a/lib/routes/sotwe/user.ts b/lib/routes/sotwe/user.ts index a51219f407..c53b139641 100644 --- a/lib/routes/sotwe/user.ts +++ b/lib/routes/sotwe/user.ts @@ -1,11 +1,12 @@ -import { Route, ViewType } from '@/types'; - -import { parseDate } from '@/utils/parse-date'; import sanitizeHtml from 'sanitize-html'; -import puppeteer from '@/utils/puppeteer'; -import logger from '@/utils/logger'; -import cache from '@/utils/cache'; + import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import logger from '@/utils/logger'; +import { parseDate } from '@/utils/parse-date'; +import puppeteer from '@/utils/puppeteer'; export const route: Route = { path: '/user/:id', diff --git a/lib/routes/soundofhope/channel.ts b/lib/routes/soundofhope/channel.ts index d2cc00e3c4..34d869b337 100644 --- a/lib/routes/soundofhope/channel.ts +++ b/lib/routes/soundofhope/channel.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/soundon/podcast.ts b/lib/routes/soundon/podcast.ts index d8163dfc29..abadabb271 100644 --- a/lib/routes/soundon/podcast.ts +++ b/lib/routes/soundon/podcast.ts @@ -1,9 +1,11 @@ -import { Route, ViewType } from '@/types'; import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { Podcast, PodcastInfo } from './types'; + +import type { Podcast, PodcastInfo } from './types'; const handler = async (ctx) => { const { id } = ctx.req.param(); diff --git a/lib/routes/sourceforge/index.ts b/lib/routes/sourceforge/index.ts index b3f181d432..1ede6067a2 100644 --- a/lib/routes/sourceforge/index.ts +++ b/lib/routes/sourceforge/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/southcn/nfapp/column.ts b/lib/routes/southcn/nfapp/column.ts index 385a3ba63d..17743309ca 100644 --- a/lib/routes/southcn/nfapp/column.ts +++ b/lib/routes/southcn/nfapp/column.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; + import { parseArticle } from './utils'; export const route: Route = { diff --git a/lib/routes/southcn/nfapp/reporter.ts b/lib/routes/southcn/nfapp/reporter.ts index 2d69ed61da..b6934b94b3 100644 --- a/lib/routes/southcn/nfapp/reporter.ts +++ b/lib/routes/southcn/nfapp/reporter.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; + import { parseArticle } from './utils'; -import path from 'node:path'; export const route: Route = { path: '/nfapp/reporter/:reporter', diff --git a/lib/routes/southcn/nfapp/utils.ts b/lib/routes/southcn/nfapp/utils.ts index 9a3d28d3ef..3adfb36847 100644 --- a/lib/routes/southcn/nfapp/utils.ts +++ b/lib/routes/southcn/nfapp/utils.ts @@ -1,6 +1,7 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; +import got from '@/utils/got'; + const parseArticle = (item, tryGet) => tryGet(item.link, async () => { const detailResponse = await got({ diff --git a/lib/routes/spankbang/new-videos.ts b/lib/routes/spankbang/new-videos.ts index d1497041bc..57ff9b1463 100644 --- a/lib/routes/spankbang/new-videos.ts +++ b/lib/routes/spankbang/new-videos.ts @@ -1,12 +1,13 @@ -import { Data, Route } from '@/types'; - -import puppeteer from '@/utils/puppeteer'; -import * as cheerio from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import * as cheerio from 'cheerio'; + import { config } from '@/config'; -import logger from '@/utils/logger'; +import type { Data, Route } from '@/types'; import cache from '@/utils/cache'; +import logger from '@/utils/logger'; +import puppeteer from '@/utils/puppeteer'; +import { art } from '@/utils/render'; const render = (data) => art(path.join(__dirname, 'templates/video.art'), data); diff --git a/lib/routes/spglobal/ratings.ts b/lib/routes/spglobal/ratings.ts index c8c172d1cf..c550c67810 100644 --- a/lib/routes/spglobal/ratings.ts +++ b/lib/routes/spglobal/ratings.ts @@ -1,6 +1,7 @@ -import { Route, ViewType } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/ratings/:language?', diff --git a/lib/routes/spotify/artist.ts b/lib/routes/spotify/artist.ts index d7a55f82ff..aa95320dc2 100644 --- a/lib/routes/spotify/artist.ts +++ b/lib/routes/spotify/artist.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; -import utils from './utils'; -import { parseDate } from '@/utils/parse-date'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + +import utils from './utils'; export const route: Route = { path: '/artist/:id', diff --git a/lib/routes/spotify/artists-top.ts b/lib/routes/spotify/artists-top.ts index eff2367053..e0d19559be 100644 --- a/lib/routes/spotify/artists-top.ts +++ b/lib/routes/spotify/artists-top.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import utils from './utils'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import utils from './utils'; + export const route: Route = { path: '/top/artists', categories: ['multimedia'], diff --git a/lib/routes/spotify/playlist.ts b/lib/routes/spotify/playlist.ts index fcd12bb6fc..8364ab02dd 100644 --- a/lib/routes/spotify/playlist.ts +++ b/lib/routes/spotify/playlist.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; -import utils from './utils'; -import { parseDate } from '@/utils/parse-date'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + +import utils from './utils'; export const route: Route = { path: '/playlist/:id', diff --git a/lib/routes/spotify/saved.ts b/lib/routes/spotify/saved.ts index 5ff59dae6c..ef434e73dc 100644 --- a/lib/routes/spotify/saved.ts +++ b/lib/routes/spotify/saved.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import utils from './utils'; -import { parseDate } from '@/utils/parse-date'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + +import utils from './utils'; export const route: Route = { path: '/saved/:limit?', diff --git a/lib/routes/spotify/show.ts b/lib/routes/spotify/show.ts index b478cff815..77942cba47 100644 --- a/lib/routes/spotify/show.ts +++ b/lib/routes/spotify/show.ts @@ -1,8 +1,10 @@ -import { Route, ViewType } from '@/types'; -import utils from './utils'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import utils from './utils'; + export const route: Route = { path: '/show/:id', categories: ['multimedia'], diff --git a/lib/routes/spotify/tracks-top.ts b/lib/routes/spotify/tracks-top.ts index c9b732bba4..3cf106712a 100644 --- a/lib/routes/spotify/tracks-top.ts +++ b/lib/routes/spotify/tracks-top.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import utils from './utils'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import utils from './utils'; + export const route: Route = { path: '/top/tracks', categories: ['multimedia'], diff --git a/lib/routes/springer/journal.ts b/lib/routes/springer/journal.ts index d3d0fe66d2..552269f944 100644 --- a/lib/routes/springer/journal.ts +++ b/lib/routes/springer/journal.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; +import { CookieJar } from 'tough-cookie'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import path from 'node:path'; import { art } from '@/utils/render'; -import { CookieJar } from 'tough-cookie'; const cookieJar = new CookieJar(); export const route: Route = { diff --git a/lib/routes/sputniknews/index.ts b/lib/routes/sputniknews/index.ts index af31a49962..d69ce71145 100644 --- a/lib/routes/sputniknews/index.ts +++ b/lib/routes/sputniknews/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const languages = { diff --git a/lib/routes/sqmc/www.ts b/lib/routes/sqmc/www.ts index 4181edb382..1f3eb5af1c 100644 --- a/lib/routes/sqmc/www.ts +++ b/lib/routes/sqmc/www.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/www/:category?', diff --git a/lib/routes/sse/convert.ts b/lib/routes/sse/convert.ts index 622d55eced..2311bffd84 100644 --- a/lib/routes/sse/convert.ts +++ b/lib/routes/sse/convert.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/sse/disclosure.ts b/lib/routes/sse/disclosure.ts index 5d4dce1fc2..960953fd2b 100644 --- a/lib/routes/sse/disclosure.ts +++ b/lib/routes/sse/disclosure.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/sse/inquire.ts b/lib/routes/sse/inquire.ts index fbc2cc9f99..2e404426ed 100644 --- a/lib/routes/sse/inquire.ts +++ b/lib/routes/sse/inquire.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/inquire', diff --git a/lib/routes/sse/renewal.ts b/lib/routes/sse/renewal.ts index 12155e5544..053a54c5dd 100644 --- a/lib/routes/sse/renewal.ts +++ b/lib/routes/sse/renewal.ts @@ -1,12 +1,15 @@ -import { Route } from '@/types'; +import 'dayjs/locale/zh-cn.js'; +import path from 'node:path'; + +import dayjs from 'dayjs'; +import localizedFormat from 'dayjs/plugin/localizedFormat.js'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import dayjs from 'dayjs'; -import localizedFormat from 'dayjs/plugin/localizedFormat.js'; -import 'dayjs/locale/zh-cn.js'; + dayjs.extend(localizedFormat); const currStatusName = ['全部', '已受理', '已询问', '通过', '未通过', '提交注册', '补充审核', '注册结果', '中止', '终止']; diff --git a/lib/routes/sse/sselawsrules.ts b/lib/routes/sse/sselawsrules.ts index a33e3989ee..b40b7f7b72 100644 --- a/lib/routes/sse/sselawsrules.ts +++ b/lib/routes/sse/sselawsrules.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const handler = async (ctx) => { const { category = 'latest' } = ctx.req.param(); diff --git a/lib/routes/ssm/news.ts b/lib/routes/ssm/news.ts index d2f9bd8392..8a5160c98f 100644 --- a/lib/routes/ssm/news.ts +++ b/lib/routes/ssm/news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; const rootUrl = `https://www.ssm.gov.mo`; diff --git a/lib/routes/sspai/activity.ts b/lib/routes/sspai/activity.ts index bb1855d5ac..d837c4a61d 100644 --- a/lib/routes/sspai/activity.ts +++ b/lib/routes/sspai/activity.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/sspai/author.ts b/lib/routes/sspai/author.ts index 48f13bcf45..c942240ab6 100644 --- a/lib/routes/sspai/author.ts +++ b/lib/routes/sspai/author.ts @@ -1,5 +1,5 @@ import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/sspai/bookmarks.ts b/lib/routes/sspai/bookmarks.ts index 5fba4ec04a..9d648a0606 100644 --- a/lib/routes/sspai/bookmarks.ts +++ b/lib/routes/sspai/bookmarks.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/sspai/column.ts b/lib/routes/sspai/column.ts index e16eaea84a..aa56608a92 100644 --- a/lib/routes/sspai/column.ts +++ b/lib/routes/sspai/column.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/sspai/index.ts b/lib/routes/sspai/index.ts index 44359a3ae7..fc9d9a395a 100644 --- a/lib/routes/sspai/index.ts +++ b/lib/routes/sspai/index.ts @@ -1,4 +1,5 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/sspai/matrix.ts b/lib/routes/sspai/matrix.ts index a222d27aaa..c107fbb1d5 100644 --- a/lib/routes/sspai/matrix.ts +++ b/lib/routes/sspai/matrix.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/sspai/prime-community.ts b/lib/routes/sspai/prime-community.ts index 86c332aeb4..407443bde0 100644 --- a/lib/routes/sspai/prime-community.ts +++ b/lib/routes/sspai/prime-community.ts @@ -1,5 +1,5 @@ import { config } from '@/config'; -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; diff --git a/lib/routes/sspai/series-update.ts b/lib/routes/sspai/series-update.ts index 52d03b8cc4..62f8638a28 100644 --- a/lib/routes/sspai/series-update.ts +++ b/lib/routes/sspai/series-update.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/sspai/series.ts b/lib/routes/sspai/series.ts index 98703357f1..ddc4d00f74 100644 --- a/lib/routes/sspai/series.ts +++ b/lib/routes/sspai/series.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; export const route: Route = { path: '/series', diff --git a/lib/routes/sspai/shortcuts-gallery.ts b/lib/routes/sspai/shortcuts-gallery.ts index 751fde0dee..88a05ae6a2 100644 --- a/lib/routes/sspai/shortcuts-gallery.ts +++ b/lib/routes/sspai/shortcuts-gallery.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/sspai/tag.ts b/lib/routes/sspai/tag.ts index 2734268a7c..2b48a34142 100644 --- a/lib/routes/sspai/tag.ts +++ b/lib/routes/sspai/tag.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/sspai/topic.ts b/lib/routes/sspai/topic.ts index 5a53383a70..2530d6af8f 100644 --- a/lib/routes/sspai/topic.ts +++ b/lib/routes/sspai/topic.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/sspai/topics.ts b/lib/routes/sspai/topics.ts index 90d7ecfd7d..a7744c6e42 100644 --- a/lib/routes/sspai/topics.ts +++ b/lib/routes/sspai/topics.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/sspu/jwc.ts b/lib/routes/sspu/jwc.ts index 9089156115..dfcfaa323f 100644 --- a/lib/routes/sspu/jwc.ts +++ b/lib/routes/sspu/jwc.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/sspu/pe.ts b/lib/routes/sspu/pe.ts index 1987ba322e..21edfd56dd 100644 --- a/lib/routes/sspu/pe.ts +++ b/lib/routes/sspu/pe.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/stanford/blog.ts b/lib/routes/stanford/blog.ts index 0d56f9baa4..cc77698034 100644 --- a/lib/routes/stanford/blog.ts +++ b/lib/routes/stanford/blog.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/startuplatte/index.ts b/lib/routes/startuplatte/index.ts index 6dfcd0a79f..24e5a41949 100644 --- a/lib/routes/startuplatte/index.ts +++ b/lib/routes/startuplatte/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/stbu/jsjxy.ts b/lib/routes/stbu/jsjxy.ts index 669432e624..d386d393dd 100644 --- a/lib/routes/stbu/jsjxy.ts +++ b/lib/routes/stbu/jsjxy.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/stbu/xyxw.ts b/lib/routes/stbu/xyxw.ts index a93e25beda..4a85d24af8 100644 --- a/lib/routes/stbu/xyxw.ts +++ b/lib/routes/stbu/xyxw.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/stcn/index.ts b/lib/routes/stcn/index.ts index e625a7a68e..3343c3ddc7 100644 --- a/lib/routes/stcn/index.ts +++ b/lib/routes/stcn/index.ts @@ -1,14 +1,13 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const { id = 'yw' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/stcn/kx.ts b/lib/routes/stcn/kx.ts index 2697e4a632..f8adaa5020 100644 --- a/lib/routes/stcn/kx.ts +++ b/lib/routes/stcn/kx.ts @@ -1,13 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type CheerioAPI, load } from 'cheerio'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, load } from 'cheerio'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/stcn/rank.ts b/lib/routes/stcn/rank.ts index 1ba8105e0c..ef531fbeb4 100644 --- a/lib/routes/stcn/rank.ts +++ b/lib/routes/stcn/rank.ts @@ -1,13 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type CheerioAPI, load } from 'cheerio'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, load } from 'cheerio'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const { id = 'yw' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/stdaily/digitalpaper.ts b/lib/routes/stdaily/digitalpaper.ts index 4c33df7949..67493d2b3f 100644 --- a/lib/routes/stdaily/digitalpaper.ts +++ b/lib/routes/stdaily/digitalpaper.ts @@ -1,13 +1,16 @@ -import type { Data, DataItem, Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; -import type { ArticleDetailResponse, ArticleListResponse, DateListResponse, SectionListResponse } from './types'; -import { art } from '@/utils/render'; import path from 'node:path'; -import timezone from '@/utils/timezone'; -import dayjs from 'dayjs'; + import { load } from 'cheerio'; +import dayjs from 'dayjs'; + +import type { Data, DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; + +import type { ArticleDetailResponse, ArticleListResponse, DateListResponse, SectionListResponse } from './types'; const SITE_ID = '811c18b08cf04e79be3b67d6902ee1a7'; const CODE = 'KJRB'; diff --git a/lib/routes/steam/appcommunityfeed.ts b/lib/routes/steam/appcommunityfeed.ts index 44faf44ed0..185f3ec060 100644 --- a/lib/routes/steam/appcommunityfeed.ts +++ b/lib/routes/steam/appcommunityfeed.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { art } from '@/utils/render'; -import path from 'node:path'; const workshopFileTypes = { 0: 'Community', diff --git a/lib/routes/steam/curator.ts b/lib/routes/steam/curator.ts index ef109ff3f4..633cffbcf0 100644 --- a/lib/routes/steam/curator.ts +++ b/lib/routes/steam/curator.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; export const route: Route = { diff --git a/lib/routes/steam/news.ts b/lib/routes/steam/news.ts index 9c94e2e1cf..81a4c39421 100644 --- a/lib/routes/steam/news.ts +++ b/lib/routes/steam/news.ts @@ -1,13 +1,13 @@ -import { Route, Data, DataItem } from '@/types'; -import type { BBobCoreTagNodeTree, PresetFactory, NodeContent } from '@bbob/types'; - -import got from '@/utils/got'; import bbobHTML from '@bbob/html'; -import presetHTML5 from '@bbob/preset-html5'; import { getUniqAttr } from '@bbob/plugin-helper'; -import { parseDate } from '@/utils/parse-date'; +import presetHTML5 from '@bbob/preset-html5'; +import type { BBobCoreTagNodeTree, NodeContent, PresetFactory } from '@bbob/types'; import type { Context } from 'hono'; +import type { Data, DataItem, Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + export const route: Route = { path: '/news/:appid/:language?', name: 'News', diff --git a/lib/routes/steam/search.ts b/lib/routes/steam/search.ts index 4bc046e0d4..19ea613ba1 100644 --- a/lib/routes/steam/search.ts +++ b/lib/routes/steam/search.ts @@ -1,6 +1,7 @@ +import { load } from 'cheerio'; + import type { Route } from '@/types'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/search/:params', diff --git a/lib/routes/steam/sharefile-changelog.ts b/lib/routes/steam/sharefile-changelog.ts index 8a0fe49ea2..ecedec433c 100644 --- a/lib/routes/steam/sharefile-changelog.ts +++ b/lib/routes/steam/sharefile-changelog.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/steam/workshop-search.ts b/lib/routes/steam/workshop-search.ts index a4bf9ce8bb..083fa47f76 100644 --- a/lib/routes/steam/workshop-search.ts +++ b/lib/routes/steam/workshop-search.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { art } from '@/utils/render'; + export const route: Route = { path: '/workshopsearch/:appid?/:routeParams?', categories: ['game'], diff --git a/lib/routes/stheadline/std/realtime.ts b/lib/routes/stheadline/std/realtime.ts index e4d0728124..d11558bca4 100644 --- a/lib/routes/stheadline/std/realtime.ts +++ b/lib/routes/stheadline/std/realtime.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://www.stheadline.com'; diff --git a/lib/routes/stockedge/daily-news.ts b/lib/routes/stockedge/daily-news.ts index a5eb8c5474..2f91b1c303 100644 --- a/lib/routes/stockedge/daily-news.ts +++ b/lib/routes/stockedge/daily-news.ts @@ -1,5 +1,7 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; + import { getData, getList } from './utils'; export const route: Route = { diff --git a/lib/routes/stockedge/utils.ts b/lib/routes/stockedge/utils.ts index 33bd2b42ff..812f3af289 100644 --- a/lib/routes/stockedge/utils.ts +++ b/lib/routes/stockedge/utils.ts @@ -1,4 +1,4 @@ -import { DataItem } from '@/types'; +import type { DataItem } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/storm/channel.ts b/lib/routes/storm/channel.ts index b668efb91b..1eda985a8d 100644 --- a/lib/routes/storm/channel.ts +++ b/lib/routes/storm/channel.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/storm/index.ts b/lib/routes/storm/index.ts index 4705f7cb20..306667b218 100644 --- a/lib/routes/storm/index.ts +++ b/lib/routes/storm/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/storyfm/episodes.ts b/lib/routes/storyfm/episodes.ts index d5615e4c0f..dc0dd02ae8 100644 --- a/lib/routes/storyfm/episodes.ts +++ b/lib/routes/storyfm/episodes.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/episodes', diff --git a/lib/routes/storyfm/index.ts b/lib/routes/storyfm/index.ts index 1512a78740..134ff21b28 100644 --- a/lib/routes/storyfm/index.ts +++ b/lib/routes/storyfm/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/index', categories: ['multimedia'], diff --git a/lib/routes/straitstimes/index.ts b/lib/routes/straitstimes/index.ts index a72c264403..d48f200e43 100644 --- a/lib/routes/straitstimes/index.ts +++ b/lib/routes/straitstimes/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import path from 'node:path'; import { art } from '@/utils/render'; export const route: Route = { diff --git a/lib/routes/stratechery/index.ts b/lib/routes/stratechery/index.ts index d4625b9d44..613192c951 100644 --- a/lib/routes/stratechery/index.ts +++ b/lib/routes/stratechery/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import buildData from '@/utils/common-config'; export const route: Route = { diff --git a/lib/routes/stream-capital/search.ts b/lib/routes/stream-capital/search.ts index c1adec9478..f88af15531 100644 --- a/lib/routes/stream-capital/search.ts +++ b/lib/routes/stream-capital/search.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { encrypt, decrypt } from './utils'; -import { EncryptedResponse, WebBlog } from './types'; -import cache from '@/utils/cache'; + +import type { EncryptedResponse, WebBlog } from './types'; +import { decrypt, encrypt } from './utils'; export const route: Route = { path: '/search', diff --git a/lib/routes/studygolang/go.ts b/lib/routes/studygolang/go.ts index 1a699e119e..332ecb249a 100644 --- a/lib/routes/studygolang/go.ts +++ b/lib/routes/studygolang/go.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { FetchGoItems } from './utils'; export const route: Route = { diff --git a/lib/routes/studygolang/jobs.ts b/lib/routes/studygolang/jobs.ts index 0effa9448c..39133b02ad 100644 --- a/lib/routes/studygolang/jobs.ts +++ b/lib/routes/studygolang/jobs.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { FetchGoItems } from './utils'; export const route: Route = { diff --git a/lib/routes/studygolang/utils.ts b/lib/routes/studygolang/utils.ts index 60dd6bdb61..7fec467bb2 100644 --- a/lib/routes/studygolang/utils.ts +++ b/lib/routes/studygolang/utils.ts @@ -1,9 +1,11 @@ +import { load } from 'cheerio'; +import MarkdownIt from 'markdown-it'; + 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 MarkdownIt from 'markdown-it'; +import timezone from '@/utils/timezone'; + const md = MarkdownIt({ html: true, linkify: true, diff --git a/lib/routes/studygolang/weekly.ts b/lib/routes/studygolang/weekly.ts index 8360856503..4cfcb48eae 100644 --- a/lib/routes/studygolang/weekly.ts +++ b/lib/routes/studygolang/weekly.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { FetchGoItems } from './utils'; export const route: Route = { diff --git a/lib/routes/subhd/index.ts b/lib/routes/subhd/index.ts index 7033df3998..926c2855b1 100644 --- a/lib/routes/subhd/index.ts +++ b/lib/routes/subhd/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; const config = { sub: { diff --git a/lib/routes/substack/subscribe.ts b/lib/routes/substack/subscribe.ts index a04b6150d5..9cc946654c 100644 --- a/lib/routes/substack/subscribe.ts +++ b/lib/routes/substack/subscribe.ts @@ -1,9 +1,10 @@ -import { Route, ViewType } from '@/types'; -import ofetch from '@/utils/ofetch'; -import parser from '@/utils/rss-parser'; -import { parseDate } from '@/utils/parse-date'; -import { isValidHost } from '@/utils/valid-host'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import parser from '@/utils/rss-parser'; +import { isValidHost } from '@/utils/valid-host'; export const route: Route = { path: '/subscribe/:user', diff --git a/lib/routes/supchina/index.ts b/lib/routes/supchina/index.ts index e6092d5a37..a2965c0975 100644 --- a/lib/routes/supchina/index.ts +++ b/lib/routes/supchina/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/supchina/podcasts.ts b/lib/routes/supchina/podcasts.ts index ae35b509ca..106d0c842a 100644 --- a/lib/routes/supchina/podcasts.ts +++ b/lib/routes/supchina/podcasts.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/surfshark/blog.ts b/lib/routes/surfshark/blog.ts index ab48265f1e..92a2cf4185 100644 --- a/lib/routes/surfshark/blog.ts +++ b/lib/routes/surfshark/blog.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { category } = ctx.req.param(); diff --git a/lib/routes/sustainabilitymag/articles.ts b/lib/routes/sustainabilitymag/articles.ts index a4a27ae77d..69637e88f1 100644 --- a/lib/routes/sustainabilitymag/articles.ts +++ b/lib/routes/sustainabilitymag/articles.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import oftech from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; export const route: Route = { path: '/articles', diff --git a/lib/routes/sustech/bidding.ts b/lib/routes/sustech/bidding.ts index 1ec548dfa8..da4f8874ad 100644 --- a/lib/routes/sustech/bidding.ts +++ b/lib/routes/sustech/bidding.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/sustech/newshub-zh.ts b/lib/routes/sustech/newshub-zh.ts index 8744a8b991..0bcaa05d32 100644 --- a/lib/routes/sustech/newshub-zh.ts +++ b/lib/routes/sustech/newshub-zh.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/sustech/yjs.ts b/lib/routes/sustech/yjs.ts index e88e325f07..5fc9090a32 100644 --- a/lib/routes/sustech/yjs.ts +++ b/lib/routes/sustech/yjs.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/swissinfo/index.ts b/lib/routes/swissinfo/index.ts index aa2bc3a1a0..2de079e864 100644 --- a/lib/routes/swissinfo/index.ts +++ b/lib/routes/swissinfo/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/swjtu/gsee/yjs.ts b/lib/routes/swjtu/gsee/yjs.ts index 4c747778c3..290891fc76 100644 --- a/lib/routes/swjtu/gsee/yjs.ts +++ b/lib/routes/swjtu/gsee/yjs.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootURL = 'https://gsee.swjtu.edu.cn'; diff --git a/lib/routes/swjtu/jtys/yjs.ts b/lib/routes/swjtu/jtys/yjs.ts index 9ee5cbb4a0..9093865df7 100644 --- a/lib/routes/swjtu/jtys/yjs.ts +++ b/lib/routes/swjtu/jtys/yjs.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootURL = 'https://ctt.swjtu.edu.cn'; diff --git a/lib/routes/swjtu/jwc.ts b/lib/routes/swjtu/jwc.ts index 0bce77dacb..0dd6a72372 100644 --- a/lib/routes/swjtu/jwc.ts +++ b/lib/routes/swjtu/jwc.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootURL = 'http://jwc.swjtu.edu.cn'; diff --git a/lib/routes/swjtu/jyzpxx.ts b/lib/routes/swjtu/jyzpxx.ts index 1c3b3d130c..2c91d87408 100644 --- a/lib/routes/swjtu/jyzpxx.ts +++ b/lib/routes/swjtu/jyzpxx.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import utils from './utils'; import got from '@/utils/got'; +import utils from './utils'; + const rootURL = 'https://jiuye.swjtu.edu.cn/career'; export const route: Route = { diff --git a/lib/routes/swjtu/scai.ts b/lib/routes/swjtu/scai.ts index 35fc42cf8e..92dc473464 100644 --- a/lib/routes/swjtu/scai.ts +++ b/lib/routes/swjtu/scai.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; const rootURL = 'https://scai.swjtu.edu.cn'; diff --git a/lib/routes/swjtu/sports.ts b/lib/routes/swjtu/sports.ts index 3ab502ac1b..edaaa63d52 100644 --- a/lib/routes/swjtu/sports.ts +++ b/lib/routes/swjtu/sports.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; const rootURL = 'https://sports.swjtu.edu.cn'; const pageURL = `${rootURL}/xwzx.htm`; diff --git a/lib/routes/swjtu/utils.ts b/lib/routes/swjtu/utils.ts index 779f4a7d57..e4725cf97b 100644 --- a/lib/routes/swjtu/utils.ts +++ b/lib/routes/swjtu/utils.ts @@ -1,8 +1,9 @@ -import got from '@/utils/got'; -import { art } from '@/utils/render'; -import { parseDate } from '@/utils/parse-date'; import path from 'node:path'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + const renderDetail = (jobs) => art(path.join(__dirname, 'templates/job_detail.art'), { jobs }); const renderDesc = (intro) => art(path.join(__dirname, 'templates/job_desc.art'), { diff --git a/lib/routes/swjtu/xg.ts b/lib/routes/swjtu/xg.ts index 2556b8a52c..648d282515 100644 --- a/lib/routes/swjtu/xg.ts +++ b/lib/routes/swjtu/xg.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const rootURL = 'http://xg.swjtu.edu.cn'; const listURL = { diff --git a/lib/routes/swpu/bgw.ts b/lib/routes/swpu/bgw.ts index 48800ee6c0..852426039b 100644 --- a/lib/routes/swpu/bgw.ts +++ b/lib/routes/swpu/bgw.ts @@ -1,11 +1,13 @@ -import { DataItem, Route, Data } from '@/types'; -import cache from '@/utils/cache'; -import { joinUrl } from './utils'; -import { parseDate } from '@/utils/parse-date'; import { load } from 'cheerio'; + +import type { Data, DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; +import { joinUrl } from './utils'; + export const route: Route = { path: '/bgw/:code', categories: ['university'], diff --git a/lib/routes/swpu/cjxy.ts b/lib/routes/swpu/cjxy.ts index 0b65c05995..83f4ccf88a 100644 --- a/lib/routes/swpu/cjxy.ts +++ b/lib/routes/swpu/cjxy.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/swpu/dean.ts b/lib/routes/swpu/dean.ts index f2c2f4bae7..cf3403eb13 100644 --- a/lib/routes/swpu/dean.ts +++ b/lib/routes/swpu/dean.ts @@ -1,11 +1,13 @@ -import { DataItem, Route, Data } from '@/types'; -import cache from '@/utils/cache'; -import { joinUrl } from './utils'; -import { parseDate } from '@/utils/parse-date'; import { load } from 'cheerio'; + +import type { Data, DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; +import { joinUrl } from './utils'; + export const route: Route = { path: '/dean/:code', categories: ['university'], diff --git a/lib/routes/swpu/dxy.ts b/lib/routes/swpu/dxy.ts index 535d6cffb8..b5258d9077 100644 --- a/lib/routes/swpu/dxy.ts +++ b/lib/routes/swpu/dxy.ts @@ -1,11 +1,13 @@ -import { DataItem, Route, Data } from '@/types'; -import cache from '@/utils/cache'; -import { joinUrl } from './utils'; -import { parseDate } from '@/utils/parse-date'; import { load } from 'cheerio'; + +import type { Data, DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; +import { joinUrl } from './utils'; + export const route: Route = { path: '/dxy/:code', categories: ['university'], diff --git a/lib/routes/swpu/is.ts b/lib/routes/swpu/is.ts index c4baf57338..4924d2c345 100644 --- a/lib/routes/swpu/is.ts +++ b/lib/routes/swpu/is.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/swpu/scs.ts b/lib/routes/swpu/scs.ts index 0a39d6e723..f1999ef097 100644 --- a/lib/routes/swpu/scs.ts +++ b/lib/routes/swpu/scs.ts @@ -1,11 +1,13 @@ -import { DataItem, Route, Data } from '@/types'; -import cache from '@/utils/cache'; -import { joinUrl } from './utils'; -import { parseDate } from '@/utils/parse-date'; import { load } from 'cheerio'; + +import type { Data, DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; +import { joinUrl } from './utils'; + export const route: Route = { path: '/scs/:code', categories: ['university'], diff --git a/lib/routes/sycl/feeds.ts b/lib/routes/sycl/feeds.ts index 6da6f50b41..488cbac2ac 100644 --- a/lib/routes/sycl/feeds.ts +++ b/lib/routes/sycl/feeds.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/syosetu/dev.ts b/lib/routes/syosetu/dev.ts index 4456e13e90..61ea237809 100644 --- a/lib/routes/syosetu/dev.ts +++ b/lib/routes/syosetu/dev.ts @@ -1,7 +1,8 @@ -import { Data, Route } from '@/types'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Data, Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/dev', diff --git a/lib/routes/syosetu/index.ts b/lib/routes/syosetu/index.ts index efa36951c7..1a2116f024 100644 --- a/lib/routes/syosetu/index.ts +++ b/lib/routes/syosetu/index.ts @@ -1,8 +1,10 @@ -import { Route, Data, DataItem } from '@/types'; -import { fetchNovelInfo, fetchChapterContent } from './utils'; -import { Context } from 'hono'; +import type { Context } from 'hono'; import { NovelType } from 'narou'; +import type { Data, DataItem, Route } from '@/types'; + +import { fetchChapterContent, fetchNovelInfo } from './utils'; + export const route: Route = { path: '/:ncode', categories: ['reading'], diff --git a/lib/routes/syosetu/ranking-isekai.ts b/lib/routes/syosetu/ranking-isekai.ts index 76059e427f..99c3ef9e22 100644 --- a/lib/routes/syosetu/ranking-isekai.ts +++ b/lib/routes/syosetu/ranking-isekai.ts @@ -1,10 +1,14 @@ -import { Data, DataItem } from '@/types'; -import { NarouNovelFetch, SearchBuilder, SearchParams, BigGenre } from 'narou'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import type { SearchParams } from 'narou'; +import { BigGenre, NarouNovelFetch, SearchBuilder } from 'narou'; +import type { Join } from 'narou/util/type'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { Join } from 'narou/util/type'; -import { RankingPeriod, NovelType, periodToJapanese, novelTypeToJapanese, periodToOrder, periodToPointField, IsekaiCategory, isekaiCategoryToJapanese } from './types/ranking'; +import type { Data, DataItem } from '@/types'; +import { art } from '@/utils/render'; + +import { IsekaiCategory, isekaiCategoryToJapanese, NovelType, novelTypeToJapanese, periodToJapanese, periodToOrder, periodToPointField, RankingPeriod } from './types/ranking'; export function parseIsekaiRankingType(type: string): { period: RankingPeriod; category: IsekaiCategory; novelType: NovelType } { const [periodStr, categoryStr, novelTypeStr = NovelType.TOTAL] = type.split('_'); diff --git a/lib/routes/syosetu/ranking-r18.ts b/lib/routes/syosetu/ranking-r18.ts index cc09f0be38..7b09e4894e 100644 --- a/lib/routes/syosetu/ranking-r18.ts +++ b/lib/routes/syosetu/ranking-r18.ts @@ -1,10 +1,14 @@ -import { Route, Data, DataItem } from '@/types'; -import { art } from '@/utils/render'; import path from 'node:path'; -import { Context } from 'hono'; -import { SearchBuilderR18, SearchParams, NarouNovelFetch } from 'narou'; + +import type { Context } from 'hono'; +import type { SearchParams } from 'narou'; +import { NarouNovelFetch, SearchBuilderR18 } from 'narou'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { RankingPeriod, periodToJapanese, novelTypeToJapanese, periodToOrder, NovelType, SyosetuSub, syosetuSubToJapanese, syosetuSubToNocgenre } from './types/ranking-r18'; +import type { Data, DataItem, Route } from '@/types'; +import { art } from '@/utils/render'; + +import { NovelType, novelTypeToJapanese, periodToJapanese, periodToOrder, RankingPeriod, SyosetuSub, syosetuSubToJapanese, syosetuSubToNocgenre } from './types/ranking-r18'; /** * Implementation of "Syosetu" R18 Rankings diff --git a/lib/routes/syosetu/ranking.ts b/lib/routes/syosetu/ranking.ts index 7683a5074d..165eb1d62a 100644 --- a/lib/routes/syosetu/ranking.ts +++ b/lib/routes/syosetu/ranking.ts @@ -1,11 +1,15 @@ -import { Route, Data, DataItem } from '@/types'; -import { art } from '@/utils/render'; import path from 'node:path'; -import { Context } from 'hono'; -import { Genre, SearchBuilder, SearchParams, NarouNovelFetch, GenreNotation } from 'narou'; + +import type { Context } from 'hono'; +import type { SearchParams } from 'narou'; +import { Genre, GenreNotation, NarouNovelFetch, SearchBuilder } from 'narou'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Data, DataItem, Route } from '@/types'; +import { art } from '@/utils/render'; + import { handleIsekaiRanking } from './ranking-isekai'; -import { RankingPeriod, periodToJapanese, novelTypeToJapanese, periodToOrder, RankingType, NovelType, isekaiCategoryToJapanese, IsekaiCategory } from './types/ranking'; +import { IsekaiCategory, isekaiCategoryToJapanese, NovelType, novelTypeToJapanese, periodToJapanese, periodToOrder, RankingPeriod, RankingType } from './types/ranking'; const getParameters = () => { // Generate ranking type options diff --git a/lib/routes/syosetu/search.ts b/lib/routes/syosetu/search.ts index 09403b957b..7c61a91be8 100644 --- a/lib/routes/syosetu/search.ts +++ b/lib/routes/syosetu/search.ts @@ -1,12 +1,17 @@ -import { Route, Data } from '@/types'; -import { art } from '@/utils/render'; import path from 'node:path'; -import { Context } from 'hono'; -import { Genre, GenreNotation, NarouNovelFetch, NovelTypeParam, Order, R18Site, SearchBuilder, SearchBuilderR18, SearchParams } from 'narou'; + +import type { Context } from 'hono'; +import type { Genre, NovelTypeParam, Order, SearchParams } from 'narou'; +import { GenreNotation, NarouNovelFetch, R18Site, SearchBuilder, SearchBuilderR18 } from 'narou'; +import type { Join } from 'narou/util/type'; import queryString from 'query-string'; -import { Join } from 'narou/util/type'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { SyosetuSub, NarouSearchParams, syosetuSubToJapanese } from './types/search'; +import type { Data, Route } from '@/types'; +import { art } from '@/utils/render'; + +import type { NarouSearchParams} from './types/search'; +import { SyosetuSub, syosetuSubToJapanese } from './types/search'; export const route: Route = { path: '/search/:sub/:query', diff --git a/lib/routes/syosetu/utils.ts b/lib/routes/syosetu/utils.ts index 9970c6dc3d..c927f49c55 100644 --- a/lib/routes/syosetu/utils.ts +++ b/lib/routes/syosetu/utils.ts @@ -1,10 +1,12 @@ -import { DataItem } from '@/types'; +import { load } from 'cheerio'; +import type { NarouSearchResult} from 'narou'; +import { NarouNovelFetch, SearchBuilder, SearchBuilderR18 } from 'narou'; + +import { config } from '@/config'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { DataItem } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { config } from '@/config'; -import { NarouNovelFetch, NarouSearchResult, SearchBuilder, SearchBuilderR18 } from 'narou'; export async function fetchNovelInfo(ncode: string): Promise<{ baseUrl: string; novel: NarouSearchResult }> { const api = new NarouNovelFetch(); diff --git a/lib/routes/sysu/cse.ts b/lib/routes/sysu/cse.ts index e40575e897..8512d45cdf 100644 --- a/lib/routes/sysu/cse.ts +++ b/lib/routes/sysu/cse.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/cse', categories: ['university'], diff --git a/lib/routes/sysu/ygafz.ts b/lib/routes/sysu/ygafz.ts index 017b52c964..6e6c214ef0 100644 --- a/lib/routes/sysu/ygafz.ts +++ b/lib/routes/sysu/ygafz.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/szftedu/dongtai.ts b/lib/routes/szftedu/dongtai.ts index c2acc657f0..320f4766c8 100644 --- a/lib/routes/szftedu/dongtai.ts +++ b/lib/routes/szftedu/dongtai.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/szftedu/gonggao.ts b/lib/routes/szftedu/gonggao.ts index 359451db1f..d0f58191f8 100644 --- a/lib/routes/szftedu/gonggao.ts +++ b/lib/routes/szftedu/gonggao.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/szse/disclosure/listed-notice.ts b/lib/routes/szse/disclosure/listed-notice.ts index e96f3e34d8..b7fa0b929d 100644 --- a/lib/routes/szse/disclosure/listed-notice.ts +++ b/lib/routes/szse/disclosure/listed-notice.ts @@ -1,10 +1,10 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type CheerioAPI, load } from 'cheerio'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, load } from 'cheerio'; -import { type Context } from 'hono'; function isValidDate(dateString: string): boolean { // 正则表达式检查格式:YYYY-MM-DD diff --git a/lib/routes/szse/inquire.ts b/lib/routes/szse/inquire.ts index 70d19387c0..780be1e201 100644 --- a/lib/routes/szse/inquire.ts +++ b/lib/routes/szse/inquire.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/inquire/:category?/:select?/:keyword?', diff --git a/lib/routes/szse/notice.ts b/lib/routes/szse/notice.ts index 2c4a7df903..585b9f286a 100644 --- a/lib/routes/szse/notice.ts +++ b/lib/routes/szse/notice.ts @@ -1,8 +1,11 @@ -import { Route } from '@/types'; +import * as url from 'node:url'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import * as url from 'node:url'; + const host = 'http://www.szse.cn/'; export const route: Route = { path: '/notice', diff --git a/lib/routes/szse/projectdynamic.ts b/lib/routes/szse/projectdynamic.ts index 3660a9c2b7..1eb3cf641f 100644 --- a/lib/routes/szse/projectdynamic.ts +++ b/lib/routes/szse/projectdynamic.ts @@ -1,11 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/projectdynamic/:type?/:stage?/:status?', diff --git a/lib/routes/szse/rule.ts b/lib/routes/szse/rule.ts index cbb7f9674e..b7b6805c4c 100644 --- a/lib/routes/szse/rule.ts +++ b/lib/routes/szse/rule.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const handler = async (ctx) => { diff --git a/lib/routes/szu/yz/index.ts b/lib/routes/szu/yz/index.ts index 37a921b24c..815d6e56d8 100644 --- a/lib/routes/szu/yz/index.ts +++ b/lib/routes/szu/yz/index.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; + import util from './utils'; const map = new Map([ diff --git a/lib/routes/szu/yz/utils.ts b/lib/routes/szu/yz/utils.ts index e23096bcde..a479966b3f 100644 --- a/lib/routes/szu/yz/utils.ts +++ b/lib/routes/szu/yz/utils.ts @@ -1,4 +1,5 @@ import { load } from 'cheerio'; + import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/t66y/index.ts b/lib/routes/t66y/index.ts index 751293d60e..27e95f0406 100644 --- a/lib/routes/t66y/index.ts +++ b/lib/routes/t66y/index.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; import * as cheerio from 'cheerio'; -import got from '@/utils/got'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { baseUrl, parseContent } from './utils'; export const route: Route = { diff --git a/lib/routes/t66y/post.ts b/lib/routes/t66y/post.ts index a4ace5a57f..301c6327d2 100644 --- a/lib/routes/t66y/post.ts +++ b/lib/routes/t66y/post.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; import * as cheerio from 'cheerio'; -import got from '@/utils/got'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { baseUrl, parseContent } from './utils'; function parseItems(tid: string, $: cheerio.CheerioAPI) { diff --git a/lib/routes/tableau/viz-of-the-day.ts b/lib/routes/tableau/viz-of-the-day.ts index 43d913cbad..fc7976fb28 100644 --- a/lib/routes/tableau/viz-of-the-day.ts +++ b/lib/routes/tableau/viz-of-the-day.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; // import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/tailwindcss/blog.ts b/lib/routes/tailwindcss/blog.ts index afcb8b411f..a2a484cce6 100644 --- a/lib/routes/tailwindcss/blog.ts +++ b/lib/routes/tailwindcss/blog.ts @@ -1,5 +1,7 @@ -import { Route } from '@/types'; -import { Context } from 'hono'; +import type { Context } from 'hono'; + +import type { Route } from '@/types'; + import { fetchFeed } from './utils'; export const handler = (ctx: Context) => { diff --git a/lib/routes/tailwindcss/utils.ts b/lib/routes/tailwindcss/utils.ts index b0e1ec0df6..65d1dd75dd 100644 --- a/lib/routes/tailwindcss/utils.ts +++ b/lib/routes/tailwindcss/utils.ts @@ -1,9 +1,11 @@ -import ofetch from '@/utils/ofetch'; -import { Data, DataItem } from '@/types'; -import { BASE_URL } from './constants'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; +import type { Data, DataItem } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + +import { BASE_URL } from './constants'; + /** Fetch the content of a given article. */ export const fetchArticleContent = async (url: string): Promise => { const data = await ofetch(url, { responseType: 'text' }); diff --git a/lib/routes/taiwanmobile/rate-plans.ts b/lib/routes/taiwanmobile/rate-plans.ts index 2eda102ce7..cf3ff96681 100644 --- a/lib/routes/taiwanmobile/rate-plans.ts +++ b/lib/routes/taiwanmobile/rate-plans.ts @@ -1,8 +1,9 @@ -import { DataItem, Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/rate-plans', diff --git a/lib/routes/taiwannews/hot.ts b/lib/routes/taiwannews/hot.ts index 018089cfb3..8123033269 100644 --- a/lib/routes/taiwannews/hot.ts +++ b/lib/routes/taiwannews/hot.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/tangshufang/index.ts b/lib/routes/tangshufang/index.ts index 913777196f..d5b39509fc 100644 --- a/lib/routes/tangshufang/index.ts +++ b/lib/routes/tangshufang/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/taobao/mysql.ts b/lib/routes/taobao/mysql.ts index d4291cdb4c..64902957e3 100644 --- a/lib/routes/taobao/mysql.ts +++ b/lib/routes/taobao/mysql.ts @@ -1,13 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/taobao/zhongchou.ts b/lib/routes/taobao/zhongchou.ts index 9670e8ba83..394acd209c 100644 --- a/lib/routes/taobao/zhongchou.ts +++ b/lib/routes/taobao/zhongchou.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/zhongchou/:type?', diff --git a/lib/routes/taoguba/blog.ts b/lib/routes/taoguba/blog.ts index 6b15d56a5f..b0c1ad5ff8 100644 --- a/lib/routes/taoguba/blog.ts +++ b/lib/routes/taoguba/blog.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { rootUrl, renderPostDetail } from './util'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import { renderPostDetail, rootUrl } from './util'; export const route: Route = { path: '/blog/:id', diff --git a/lib/routes/taoguba/index.ts b/lib/routes/taoguba/index.ts index b062740e01..4e8282f4ac 100644 --- a/lib/routes/taoguba/index.ts +++ b/lib/routes/taoguba/index.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { rootUrl, renderPostDetail } from './util'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import { renderPostDetail, rootUrl } from './util'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/taoguba/util.ts b/lib/routes/taoguba/util.ts index 8d2400ef9e..11aa5fcd51 100644 --- a/lib/routes/taoguba/util.ts +++ b/lib/routes/taoguba/util.ts @@ -1,8 +1,9 @@ +import { load } from 'cheerio'; + 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 timezone from '@/utils/timezone'; const rootUrl = 'https://www.tgb.cn'; @@ -45,4 +46,4 @@ const renderPostDetail = async (item) => return item; }); -export { rootUrl, renderPostDetail }; +export { renderPostDetail, rootUrl }; diff --git a/lib/routes/taptap/changelog-cn.ts b/lib/routes/taptap/changelog-cn.ts index 52c9574b03..f121c5fe40 100644 --- a/lib/routes/taptap/changelog-cn.ts +++ b/lib/routes/taptap/changelog-cn.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { handler } from './common/changelog'; export const route: Route = { diff --git a/lib/routes/taptap/changelog-intl.ts b/lib/routes/taptap/changelog-intl.ts index 11163c1815..c7acf14ce4 100644 --- a/lib/routes/taptap/changelog-intl.ts +++ b/lib/routes/taptap/changelog-intl.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { handler } from './common/changelog'; export const route: Route = { diff --git a/lib/routes/taptap/common/changelog.ts b/lib/routes/taptap/common/changelog.ts index fd320e3a0a..6fcb41bd73 100644 --- a/lib/routes/taptap/common/changelog.ts +++ b/lib/routes/taptap/common/changelog.ts @@ -1,6 +1,7 @@ import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { getRootUrl, appDetail, X_UA } from '../utils'; + +import { appDetail, getRootUrl, X_UA } from '../utils'; export async function handler(ctx) { const requestPath = ctx.req.path.replace('/taptap', ''); diff --git a/lib/routes/taptap/common/review.ts b/lib/routes/taptap/common/review.ts index 80bb0602e6..47b02c4a41 100644 --- a/lib/routes/taptap/common/review.ts +++ b/lib/routes/taptap/common/review.ts @@ -1,6 +1,7 @@ import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { getRootUrl, appDetail, X_UA } from '../utils'; + +import { appDetail, getRootUrl, X_UA } from '../utils'; /* const sortMap = { diff --git a/lib/routes/taptap/review-cn.ts b/lib/routes/taptap/review-cn.ts index dc38b771a2..788484a4d4 100644 --- a/lib/routes/taptap/review-cn.ts +++ b/lib/routes/taptap/review-cn.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { handler } from './common/review'; export const route: Route = { diff --git a/lib/routes/taptap/review-intl.ts b/lib/routes/taptap/review-intl.ts index 88936dec4a..264fdb8dca 100644 --- a/lib/routes/taptap/review-intl.ts +++ b/lib/routes/taptap/review-intl.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { handler } from './common/review'; export const route: Route = { diff --git a/lib/routes/taptap/topic.ts b/lib/routes/taptap/topic.ts index 43ed435371..2954d43779 100644 --- a/lib/routes/taptap/topic.ts +++ b/lib/routes/taptap/topic.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { getRootUrl, X_UA, appDetail, imagePost, topicPost, videoPost } from './utils'; + +import { appDetail, getRootUrl, imagePost, topicPost, videoPost, X_UA } from './utils'; const typeMap = { feed: { diff --git a/lib/routes/taptap/utils.ts b/lib/routes/taptap/utils.ts index c020ea5603..0dd4519903 100644 --- a/lib/routes/taptap/utils.ts +++ b/lib/routes/taptap/utils.ts @@ -1,9 +1,12 @@ -import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import path from 'node:path'; -import { art } from '@/utils/render'; + +import { load } from 'cheerio'; + import cache from '@/utils/cache'; -import { Detail } from './types'; +import ofetch from '@/utils/ofetch'; +import { art } from '@/utils/render'; + +import type { Detail } from './types'; const X_UA = (lang = 'zh_CN') => `X-UA=${encodeURIComponent(`V=1&PN=WebApp&VN=0.1.0&LANG=${lang}&PLT=PC`)}`; @@ -44,4 +47,4 @@ const videoPost = (video) => previewUrl: video.thumbnail.original_url || video.thumbnail.url, }); -export { getRootUrl, X_UA, appDetail, imagePost, topicPost, videoPost }; +export { appDetail, getRootUrl, imagePost, topicPost, videoPost, X_UA }; diff --git a/lib/routes/tass/news.ts b/lib/routes/tass/news.ts index c9f472ead7..8463e762ea 100644 --- a/lib/routes/tass/news.ts +++ b/lib/routes/tass/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/techcrunch/category.ts b/lib/routes/techcrunch/category.ts index ddb52ddb65..b7552293ef 100644 --- a/lib/routes/techcrunch/category.ts +++ b/lib/routes/techcrunch/category.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; +import path from 'node:path'; + import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const host = 'https://techcrunch.com'; export const route: Route = { diff --git a/lib/routes/techcrunch/news.ts b/lib/routes/techcrunch/news.ts index a093641cd7..25548dba1a 100644 --- a/lib/routes/techcrunch/news.ts +++ b/lib/routes/techcrunch/news.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; +import path from 'node:path'; + import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const host = 'https://techcrunch.com'; export const route: Route = { diff --git a/lib/routes/techflowpost/express.ts b/lib/routes/techflowpost/express.ts index 4cc21e73ad..8ebac2a725 100644 --- a/lib/routes/techflowpost/express.ts +++ b/lib/routes/techflowpost/express.ts @@ -1,9 +1,11 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; -import timezone from '@/utils/timezone'; -import { parseDate } from '@/utils/parse-date'; import dayjs from 'dayjs'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; + export const route: Route = { path: '/express', categories: ['finance'], diff --git a/lib/routes/techflowpost/index.ts b/lib/routes/techflowpost/index.ts index cb06b97749..362232def4 100644 --- a/lib/routes/techflowpost/index.ts +++ b/lib/routes/techflowpost/index.ts @@ -1,7 +1,8 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/', diff --git a/lib/routes/techpowerup/index.ts b/lib/routes/techpowerup/index.ts index b6f4f05900..b7f24bf136 100644 --- a/lib/routes/techpowerup/index.ts +++ b/lib/routes/techpowerup/index.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { baseUrl, headers, fixImages, parseReviews } from './utils'; + +import { baseUrl, fixImages, headers, parseReviews } from './utils'; export const route: Route = { path: '/', diff --git a/lib/routes/techpowerup/review.ts b/lib/routes/techpowerup/review.ts index b3f2abdeec..870523559d 100644 --- a/lib/routes/techpowerup/review.ts +++ b/lib/routes/techpowerup/review.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { baseUrl, headers, fixImages, parseReviews } from './utils'; + +import { baseUrl, fixImages, headers, parseReviews } from './utils'; export const route: Route = { path: '/review/:keyword?', diff --git a/lib/routes/techpowerup/utils.ts b/lib/routes/techpowerup/utils.ts index 81c0cb9f9b..249f44b72f 100644 --- a/lib/routes/techpowerup/utils.ts +++ b/lib/routes/techpowerup/utils.ts @@ -1,7 +1,8 @@ -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + import md5 from '@/utils/md5'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://www.techpowerup.com'; @@ -73,4 +74,4 @@ const parseReviews = async ($, item) => { item.description = content.html(); }; -export { baseUrl, headers, fixImages, hdImage, parseReviews, removeFigureStyle, removeResponsiveStyle }; +export { baseUrl, fixImages, hdImage, headers, parseReviews, removeFigureStyle, removeResponsiveStyle }; diff --git a/lib/routes/techsir/index.ts b/lib/routes/techsir/index.ts index a2ceb44ac1..a479a9f8d3 100644 --- a/lib/routes/techsir/index.ts +++ b/lib/routes/techsir/index.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; export const route: Route = { path: '/', diff --git a/lib/routes/telecompaper/news.ts b/lib/routes/telecompaper/news.ts index b6c9147c5e..9cc179043c 100644 --- a/lib/routes/telecompaper/news.ts +++ b/lib/routes/telecompaper/news.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import FormData from 'form-data'; import tough from 'tough-cookie'; -import FormData from 'form-data'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; export const route: Route = { path: '/news/:caty/:year?/:country?/:type?', diff --git a/lib/routes/telecompaper/search.ts b/lib/routes/telecompaper/search.ts index 33cfb92862..4a7ba310d1 100644 --- a/lib/routes/telecompaper/search.ts +++ b/lib/routes/telecompaper/search.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/search/:keyword?/:company?/:sort?/:period?', diff --git a/lib/routes/telegram/blog.ts b/lib/routes/telegram/blog.ts index 1155554b21..cb2bd12ddf 100644 --- a/lib/routes/telegram/blog.ts +++ b/lib/routes/telegram/blog.ts @@ -1,6 +1,8 @@ -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; import * as cheerio from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/telegram/channel-media.ts b/lib/routes/telegram/channel-media.ts index c1118aa18e..a5c639acaa 100644 --- a/lib/routes/telegram/channel-media.ts +++ b/lib/routes/telegram/channel-media.ts @@ -1,14 +1,17 @@ -import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { Route } from '@/types'; -import { Context } from 'hono'; +import type { Context } from 'hono'; import { stream } from 'hono/streaming'; -import { Api, TelegramClient } from 'telegram'; -import { IterDownloadFunction } from 'telegram/client/downloads.js'; -import { getAppropriatedPartSize } from 'telegram/Utils.js'; -import { config } from '@/config'; -import cacheModule from '@/utils/cache/index'; -import { getClient, getDocument, getFilename, unwrapMedia } from './tglib/client'; +import type { TelegramClient } from 'telegram'; +import { Api } from 'telegram'; +import type { IterDownloadFunction } from 'telegram/client/downloads.js'; import { returnBigInt as bigInt } from 'telegram/Helpers.js'; +import { getAppropriatedPartSize } from 'telegram/Utils.js'; + +import { config } from '@/config'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import cacheModule from '@/utils/cache/index'; + +import { getClient, getDocument, getFilename, unwrapMedia } from './tglib/client'; /** * https://core.telegram.org/api/files#stripped-thumbnails diff --git a/lib/routes/telegram/channel.ts b/lib/routes/telegram/channel.ts index d3d27f59d5..0c47cd076b 100644 --- a/lib/routes/telegram/channel.ts +++ b/lib/routes/telegram/channel.ts @@ -1,13 +1,17 @@ -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; -import { config } from '@/config'; -import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import { art } from '@/utils/render'; import path from 'node:path'; import querystring from 'node:querystring'; + +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import { fallback, queryToBoolean } from '@/utils/readable-social'; +import { art } from '@/utils/render'; + import tglibchannel from './tglib/channel'; /* message types */ diff --git a/lib/routes/telegram/stickerpack.ts b/lib/routes/telegram/stickerpack.ts index 96021960c7..5a5d5b7b93 100644 --- a/lib/routes/telegram/stickerpack.ts +++ b/lib/routes/telegram/stickerpack.ts @@ -1,8 +1,9 @@ -import { Route, ViewType } from '@/types'; -import ofetch from '@/utils/ofetch'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; export const route: Route = { path: '/stickerpack/:name', diff --git a/lib/routes/telegram/stories.ts b/lib/routes/telegram/stories.ts index fbeb9cb49b..14468315aa 100644 --- a/lib/routes/telegram/stories.ts +++ b/lib/routes/telegram/stories.ts @@ -1,11 +1,13 @@ /* eslint-disable no-await-in-loop */ +import type { Context } from 'hono'; +import { Api } from 'telegram'; + import NotFoundError from '@/errors/types/not-found'; import { configureMiddlewares, handleMedia } from '@/routes/telegram/channel-media'; -import { Data, DataItem, Route } from '@/types'; -import { Context } from 'hono'; -import { Api } from 'telegram'; -import { getClient, getStory, unwrapMedia } from './tglib/client'; +import type { Data, DataItem, Route } from '@/types'; + import { getGeoLink, getMediaLink } from './tglib/channel'; +import { getClient, getStory, unwrapMedia } from './tglib/client'; export const route: Route = { path: '/stories/:username/:story?', diff --git a/lib/routes/telegram/tglib/channel.ts b/lib/routes/telegram/tglib/channel.ts index ca604c6c86..6863cd07fa 100644 --- a/lib/routes/telegram/tglib/channel.ts +++ b/lib/routes/telegram/tglib/channel.ts @@ -1,12 +1,14 @@ /* eslint-disable no-await-in-loop */ -import { DataItem } from '@/types'; -import { Context } from 'hono'; +import type { Context } from 'hono'; import { Api } from 'telegram'; import { HTMLParser } from 'telegram/extensions/html.js'; -import { getClient, getDocument, getFilename, unwrapMedia } from './client'; -import { getDisplayName } from 'telegram/Utils.js'; -import cache from '@/utils/cache'; import { returnBigInt } from 'telegram/Helpers.js'; +import { getDisplayName } from 'telegram/Utils.js'; + +import type { DataItem } from '@/types'; +import cache from '@/utils/cache'; + +import { getClient, getDocument, getFilename, unwrapMedia } from './client'; export function getGeoLink(geo: Api.GeoPoint) { return `Geo LatLon: ${geo.lat}, ${geo.long}`; diff --git a/lib/routes/telegram/tglib/client.ts b/lib/routes/telegram/tglib/client.ts index 82241a3b8b..21a3268a05 100644 --- a/lib/routes/telegram/tglib/client.ts +++ b/lib/routes/telegram/tglib/client.ts @@ -1,5 +1,5 @@ import { Api, TelegramClient } from 'telegram'; -import { UserAuthParams } from 'telegram/client/auth'; +import type { UserAuthParams } from 'telegram/client/auth'; import { StringSession } from 'telegram/sessions/index.js'; import { config } from '@/config'; diff --git a/lib/routes/tencent/cloud/developer/column.ts b/lib/routes/tencent/cloud/developer/column.ts index 8cf0cbd202..182f8c04d6 100644 --- a/lib/routes/tencent/cloud/developer/column.ts +++ b/lib/routes/tencent/cloud/developer/column.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; // 统一使用的请求库 import { parseDate } from '@/utils/parse-date'; -import cache from '@/utils/cache'; const PAGE = 1; const PAGE_SIZE = 20; diff --git a/lib/routes/tencent/news/author.ts b/lib/routes/tencent/news/author.ts index 0b36e938e2..3711673033 100644 --- a/lib/routes/tencent/news/author.ts +++ b/lib/routes/tencent/news/author.ts @@ -1,12 +1,13 @@ -import { Route, Data } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Data, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/news/author/:mid', diff --git a/lib/routes/tencent/news/coronavirus/data.ts b/lib/routes/tencent/news/coronavirus/data.ts index 4564d795ad..fac85b08b9 100644 --- a/lib/routes/tencent/news/coronavirus/data.ts +++ b/lib/routes/tencent/news/coronavirus/data.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import { getData } from './utils'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; + +import { getData } from './utils'; export const route: Route = { path: '/news/coronavirus/data/:province?/:city?', diff --git a/lib/routes/tencent/news/coronavirus/total.ts b/lib/routes/tencent/news/coronavirus/total.ts index 8e5b4e47ff..cef1c3396b 100644 --- a/lib/routes/tencent/news/coronavirus/total.ts +++ b/lib/routes/tencent/news/coronavirus/total.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import { getData } from './utils'; +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; + +import { getData } from './utils'; export const route: Route = { path: '/news/coronavirus/total', diff --git a/lib/routes/tencent/pvp/newsindex.ts b/lib/routes/tencent/pvp/newsindex.ts index 37870b2fb5..c23d03ad02 100644 --- a/lib/routes/tencent/pvp/newsindex.ts +++ b/lib/routes/tencent/pvp/newsindex.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + const map = new Map([ ['rm', { name: '热门', channelid: 1760 }], ['xw', { name: '新闻', channelid: 1761 }], diff --git a/lib/routes/tencent/qq/sdk/changelog.ts b/lib/routes/tencent/qq/sdk/changelog.ts index 6f58b7c8c9..6ff1a0ca20 100644 --- a/lib/routes/tencent/qq/sdk/changelog.ts +++ b/lib/routes/tencent/qq/sdk/changelog.ts @@ -1,8 +1,9 @@ -import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/qq/sdk/changelog/:platform', categories: ['program-update'], diff --git a/lib/routes/tesla/cx.ts b/lib/routes/tesla/cx.ts index 9ab6bdd7d5..734b0532f3 100644 --- a/lib/routes/tesla/cx.ts +++ b/lib/routes/tesla/cx.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/cx/:category?/:city?', diff --git a/lib/routes/tesla/price/get-price.ts b/lib/routes/tesla/price/get-price.ts index 1b5ab8b58f..0517efd3ab 100644 --- a/lib/routes/tesla/price/get-price.ts +++ b/lib/routes/tesla/price/get-price.ts @@ -1,6 +1,7 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; +import got from '@/utils/got'; + async function getTeslaPrice(link) { const response = await got(link); diff --git a/lib/routes/tesla/price/index.ts b/lib/routes/tesla/price/index.ts index 090598e99a..4ab92c38b4 100644 --- a/lib/routes/tesla/price/index.ts +++ b/lib/routes/tesla/price/index.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { getTeslaPrice } from './get-price'; export const route: Route = { diff --git a/lib/routes/test/api-index.ts b/lib/routes/test/api-index.ts index ee0b894797..0d3ac4b4b7 100644 --- a/lib/routes/test/api-index.ts +++ b/lib/routes/test/api-index.ts @@ -1,4 +1,4 @@ -import { APIRoute } from '@/types'; +import type { APIRoute } from '@/types'; export const apiRoute: APIRoute = { path: '/', diff --git a/lib/routes/test/index.ts b/lib/routes/test/index.ts index e3637b6f72..7555c61480 100644 --- a/lib/routes/test/index.ts +++ b/lib/routes/test/index.ts @@ -1,12 +1,12 @@ -import { Route, DataItem } from '@/types'; import { config } from '@/config'; -import got from '@/utils/got'; -import wait from '@/utils/wait'; -import cache from '@/utils/cache'; -import { fetchArticle } from '@/utils/wechat-mp'; +import CaptchaError from '@/errors/types/captcha'; import ConfigNotFoundError from '@/errors/types/config-not-found'; import InvalidParameterError from '@/errors/types/invalid-parameter'; -import CaptchaError from '@/errors/types/captcha'; +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import wait from '@/utils/wait'; +import { fetchArticle } from '@/utils/wechat-mp'; let cacheIndex = 0; diff --git a/lib/routes/tfc-taiwan/category.ts b/lib/routes/tfc-taiwan/category.ts index a82c10c6a5..c59d0fd953 100644 --- a/lib/routes/tfc-taiwan/category.ts +++ b/lib/routes/tfc-taiwan/category.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import { baseUrl, parsePost, parseItem } from './utils'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + +import { baseUrl, parseItem, parsePost } from './utils'; const handler = async (ctx) => { const { category } = ctx.req.param(); diff --git a/lib/routes/tfc-taiwan/index.ts b/lib/routes/tfc-taiwan/index.ts index b1516149f1..c7874c0022 100644 --- a/lib/routes/tfc-taiwan/index.ts +++ b/lib/routes/tfc-taiwan/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; -import { baseUrl, parsePost, parseItem } from './utils'; + +import { baseUrl, parseItem, parsePost } from './utils'; const handler = async (ctx) => { const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : undefined; diff --git a/lib/routes/tfc-taiwan/utils.ts b/lib/routes/tfc-taiwan/utils.ts index afdb791ef5..3d25e02152 100644 --- a/lib/routes/tfc-taiwan/utils.ts +++ b/lib/routes/tfc-taiwan/utils.ts @@ -1,6 +1,6 @@ +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import cache from '@/utils/cache'; export const baseUrl = 'https://tfc-taiwan.org.tw'; diff --git a/lib/routes/tgbus/list.ts b/lib/routes/tgbus/list.ts index 4b26806493..572fe66587 100644 --- a/lib/routes/tgbus/list.ts +++ b/lib/routes/tgbus/list.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { parseArticle } from './utils'; type Category = 'news' | 'review' | 'video' | 'special' | 'hardware'; diff --git a/lib/routes/tgbus/utils.ts b/lib/routes/tgbus/utils.ts index 6715c8c0e3..3dbd608c91 100644 --- a/lib/routes/tgbus/utils.ts +++ b/lib/routes/tgbus/utils.ts @@ -1,5 +1,6 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/the/index.ts b/lib/routes/the/index.ts index ed130546ff..c736feb9bc 100644 --- a/lib/routes/the/index.ts +++ b/lib/routes/the/index.ts @@ -1,14 +1,15 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import { art } from '@/utils/render'; import path from 'node:path'; -import { apiSlug, bakeFilterSearchParams, bakeFiltersWithPair, bakeUrl, fetchData, getFilterParamsForUrl, parseFilterStr } from './util'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; +import { apiSlug, bakeFilterSearchParams, bakeFiltersWithPair, bakeUrl, fetchData, getFilterParamsForUrl, parseFilterStr } from './util'; + export const handler = async (ctx) => { const { filter } = ctx.req.param(); const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 40; diff --git a/lib/routes/the/util.ts b/lib/routes/the/util.ts index fbbdc853fa..1e7960cdbd 100644 --- a/lib/routes/the/util.ts +++ b/lib/routes/the/util.ts @@ -1,6 +1,7 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; +import got from '@/utils/got'; + const apiSlug = 'wp-json/wp/v2'; interface Filter { diff --git a/lib/routes/theatlantic/news.ts b/lib/routes/theatlantic/news.ts index 6cc2bd3452..fc86811c41 100644 --- a/lib/routes/theatlantic/news.ts +++ b/lib/routes/theatlantic/news.ts @@ -1,7 +1,10 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + import { getArticleDetails } from './utils'; + export const route: Route = { path: '/:category', categories: ['traditional-media'], diff --git a/lib/routes/theatlantic/utils.ts b/lib/routes/theatlantic/utils.ts index edca05dfcd..60adbb36e7 100644 --- a/lib/routes/theatlantic/utils.ts +++ b/lib/routes/theatlantic/utils.ts @@ -1,10 +1,12 @@ -import cache from '@/utils/cache'; +import path from 'node:path'; + import { load } from 'cheerio'; + +import cache from '@/utils/cache'; +import { PRESETS } from '@/utils/header-generator'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { PRESETS } from '@/utils/header-generator'; const getArticleDetails = async (items) => { const list = await Promise.all( diff --git a/lib/routes/theblock/index.ts b/lib/routes/theblock/index.ts index e34b53c83e..fb435a167a 100644 --- a/lib/routes/theblock/index.ts +++ b/lib/routes/theblock/index.ts @@ -1,9 +1,10 @@ -import { Route, Data } from '@/types'; +import { load } from 'cheerio'; + +import type { Data, Route } from '@/types'; import cache from '@/utils/cache'; +import logger from '@/utils/logger'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; -import logger from '@/utils/logger'; export const route: Route = { path: '/category/:category', diff --git a/lib/routes/theblockbeats/index.ts b/lib/routes/theblockbeats/index.ts index b01c78997d..dfd5dddc6b 100644 --- a/lib/routes/theblockbeats/index.ts +++ b/lib/routes/theblockbeats/index.ts @@ -1,9 +1,12 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import path from 'node:path'; import { art } from '@/utils/render'; const domain = 'theblockbeats.info'; diff --git a/lib/routes/thecover/channel.ts b/lib/routes/thecover/channel.ts index f26a287e83..9d3dfe39d6 100644 --- a/lib/routes/thecover/channel.ts +++ b/lib/routes/thecover/channel.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + const rootUrl = 'https://www.thecover.cn'; const nodes = { diff --git a/lib/routes/thegadgetflow/rss.ts b/lib/routes/thegadgetflow/rss.ts index d91afb9b37..8ec091501c 100644 --- a/lib/routes/thegadgetflow/rss.ts +++ b/lib/routes/thegadgetflow/rss.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { load } from 'cheerio'; -import cache from '@/utils/cache'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/thegradient/index.ts b/lib/routes/thegradient/index.ts index f255f7ad54..9eece5aaf8 100644 --- a/lib/routes/thegradient/index.ts +++ b/lib/routes/thegradient/index.ts @@ -1,8 +1,9 @@ -import { Route, DataItem } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/posts', diff --git a/lib/routes/thehindu/topic.ts b/lib/routes/thehindu/topic.ts index 54f8c4f50d..a615b29527 100644 --- a/lib/routes/thehindu/topic.ts +++ b/lib/routes/thehindu/topic.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/theinitium/app.ts b/lib/routes/theinitium/app.ts index 2b3cc4c77d..b2783a2e09 100644 --- a/lib/routes/theinitium/app.ts +++ b/lib/routes/theinitium/app.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import { load, type CheerioAPI } from 'cheerio'; -import type { Element } from 'domhandler'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; + import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import { art } from '@/utils/render'; const appUrl = 'https://app.theinitium.com/'; const userAgent = 'PugpigBolt v4.1.8 (iPhone, iOS 18.2.1) on phone (model iPhone15,2)'; diff --git a/lib/routes/theinitium/author.ts b/lib/routes/theinitium/author.ts index a1d5dbc600..253848047f 100644 --- a/lib/routes/theinitium/author.ts +++ b/lib/routes/theinitium/author.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { processFeed } from './utils'; const handler = (ctx) => processFeed('author', ctx); diff --git a/lib/routes/theinitium/channel.ts b/lib/routes/theinitium/channel.ts index b00f3b1fdd..da63ae056a 100644 --- a/lib/routes/theinitium/channel.ts +++ b/lib/routes/theinitium/channel.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { processFeed } from './utils'; const handler = (ctx) => processFeed('channel', ctx); diff --git a/lib/routes/theinitium/follow.ts b/lib/routes/theinitium/follow.ts index 6c4d1d4d2a..50f9ceb7c7 100644 --- a/lib/routes/theinitium/follow.ts +++ b/lib/routes/theinitium/follow.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { processFeed } from './utils'; const handler = (ctx) => processFeed('follow', ctx); diff --git a/lib/routes/theinitium/tags.ts b/lib/routes/theinitium/tags.ts index fd0beb1a28..fb209acda5 100644 --- a/lib/routes/theinitium/tags.ts +++ b/lib/routes/theinitium/tags.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { processFeed } from './utils'; const handler = (ctx) => processFeed('tags', ctx); diff --git a/lib/routes/theinitium/utils.ts b/lib/routes/theinitium/utils.ts index 5ede1da125..902ff5aedc 100644 --- a/lib/routes/theinitium/utils.ts +++ b/lib/routes/theinitium/utils.ts @@ -1,11 +1,12 @@ -import { Context } from 'hono'; +import { load } from 'cheerio'; +import type { Context } from 'hono'; +import { FetchError } from 'ofetch'; + +import { config } from '@/config'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { config } from '@/config'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { FetchError } from 'ofetch'; const TOKEN = 'Basic YW5vbnltb3VzOkdpQ2VMRWp4bnFCY1ZwbnA2Y0xzVXZKaWV2dlJRY0FYTHY='; diff --git a/lib/routes/themoviedb/collection.ts b/lib/routes/themoviedb/collection.ts index b1f5298607..cb1c0b651f 100644 --- a/lib/routes/themoviedb/collection.ts +++ b/lib/routes/themoviedb/collection.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import apiKey from './api-key'; import { handleMovieItem } from './utils'; diff --git a/lib/routes/themoviedb/episodes.ts b/lib/routes/themoviedb/episodes.ts index d2ff3a3b1f..152c2bb0b1 100644 --- a/lib/routes/themoviedb/episodes.ts +++ b/lib/routes/themoviedb/episodes.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import apiKey from './api-key'; import { handleDescription } from './utils'; diff --git a/lib/routes/themoviedb/seasons.ts b/lib/routes/themoviedb/seasons.ts index a74f885e90..02d6217405 100644 --- a/lib/routes/themoviedb/seasons.ts +++ b/lib/routes/themoviedb/seasons.ts @@ -1,6 +1,8 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import apiKey from './api-key'; import { handleDescription } from './utils'; diff --git a/lib/routes/themoviedb/sheet.ts b/lib/routes/themoviedb/sheet.ts index 9f30be13b6..0392cf20b4 100644 --- a/lib/routes/themoviedb/sheet.ts +++ b/lib/routes/themoviedb/sheet.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import apiKey from './api-key'; import { MEDIA_TYPE_TO_ITEM_HANDLE } from './utils'; diff --git a/lib/routes/themoviedb/trending.ts b/lib/routes/themoviedb/trending.ts index f43754aa82..0804486edc 100644 --- a/lib/routes/themoviedb/trending.ts +++ b/lib/routes/themoviedb/trending.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import apiKey from './api-key'; import { MEDIA_TYPE_TO_ITEM_HANDLE } from './utils'; diff --git a/lib/routes/themoviedb/utils.ts b/lib/routes/themoviedb/utils.ts index 9d618202c6..3594cacee9 100644 --- a/lib/routes/themoviedb/utils.ts +++ b/lib/routes/themoviedb/utils.ts @@ -1,6 +1,7 @@ import path from 'node:path'; -import { art } from '@/utils/render'; + import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; const handleDescription = (item) => { const poster_path = item.poster_path ?? item.still_path; diff --git a/lib/routes/thenewslens/index.ts b/lib/routes/thenewslens/index.ts index da8779e375..00546d5021 100644 --- a/lib/routes/thenewslens/index.ts +++ b/lib/routes/thenewslens/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '*', diff --git a/lib/routes/thepaper/839studio/category.ts b/lib/routes/thepaper/839studio/category.ts index 1244e15909..d14b46f8e6 100644 --- a/lib/routes/thepaper/839studio/category.ts +++ b/lib/routes/thepaper/839studio/category.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/839studio/:id', radar: [ diff --git a/lib/routes/thepaper/839studio/studio.ts b/lib/routes/thepaper/839studio/studio.ts index ea5639992a..81c86ecdd6 100644 --- a/lib/routes/thepaper/839studio/studio.ts +++ b/lib/routes/thepaper/839studio/studio.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/839studio', name: '澎湃美数课作品集', diff --git a/lib/routes/thepaper/channel.ts b/lib/routes/thepaper/channel.ts index 872d41d2ce..48c605347e 100644 --- a/lib/routes/thepaper/channel.ts +++ b/lib/routes/thepaper/channel.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import utils from './utils'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; +import utils from './utils'; + export const route: Route = { path: '/channel/:id', categories: ['new-media'], diff --git a/lib/routes/thepaper/factpaper.ts b/lib/routes/thepaper/factpaper.ts index dd136624c2..701e359b39 100644 --- a/lib/routes/thepaper/factpaper.ts +++ b/lib/routes/thepaper/factpaper.ts @@ -1,11 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/factpaper/:status?', diff --git a/lib/routes/thepaper/featured.ts b/lib/routes/thepaper/featured.ts index 1f4127e49b..9de15d90e7 100644 --- a/lib/routes/thepaper/featured.ts +++ b/lib/routes/thepaper/featured.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import utils from './utils'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; +import utils from './utils'; + export const route: Route = { path: '/featured', categories: ['new-media'], diff --git a/lib/routes/thepaper/list.ts b/lib/routes/thepaper/list.ts index a9bf0e6782..df01b7fb14 100644 --- a/lib/routes/thepaper/list.ts +++ b/lib/routes/thepaper/list.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import utils from './utils'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; +import utils from './utils'; + export const route: Route = { path: '/list/:id', categories: ['new-media'], diff --git a/lib/routes/thepaper/sidebar.ts b/lib/routes/thepaper/sidebar.ts index 9170ca1d56..3b3bdedc5c 100644 --- a/lib/routes/thepaper/sidebar.ts +++ b/lib/routes/thepaper/sidebar.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import utils from './utils'; +import type { Route } from '@/types'; import got from '@/utils/got'; +import utils from './utils'; + const sections = { hotNews: '澎湃热榜', financialInformationNews: '澎湃财讯', diff --git a/lib/routes/thepaper/user.ts b/lib/routes/thepaper/user.ts index d072f00248..ed019dd674 100644 --- a/lib/routes/thepaper/user.ts +++ b/lib/routes/thepaper/user.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; import * as cheerio from 'cheerio'; -import ofetch from '@/utils/ofetch'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/thepaper/utils.ts b/lib/routes/thepaper/utils.ts index b9c8fe23a3..c36f33c2ae 100644 --- a/lib/routes/thepaper/utils.ts +++ b/lib/routes/thepaper/utils.ts @@ -1,10 +1,12 @@ -import cache from '@/utils/cache'; -import { load } from 'cheerio'; -import { parseDate, parseRelativeDate } from '@/utils/parse-date'; -import got from '@/utils/got'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate, parseRelativeDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + const defaultRssItem = (item) => ({ title: item.name, link: item.link, diff --git a/lib/routes/thepetcity/index.ts b/lib/routes/thepetcity/index.ts index b8ecdb5904..3b63cc4735 100644 --- a/lib/routes/thepetcity/index.ts +++ b/lib/routes/thepetcity/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; + import { termsMap } from './terms-map'; const baseUrl = 'https://thepetcity.co'; diff --git a/lib/routes/theverge/index.ts b/lib/routes/theverge/index.ts index ef197adc05..6ba303006d 100644 --- a/lib/routes/theverge/index.ts +++ b/lib/routes/theverge/index.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import parser from '@/utils/rss-parser'; -import { load } from 'cheerio'; -import path from 'node:path'; import { art } from '@/utils/render'; +import parser from '@/utils/rss-parser'; const excludeTypes = new Set(['NewsletterBlockType', 'RelatedPostsBlockType', 'ProductsTableBlockType', 'TableOfContentsBlockType']); diff --git a/lib/routes/thewirehindi/category.ts b/lib/routes/thewirehindi/category.ts index 5a629b5f89..8adf757144 100644 --- a/lib/routes/thewirehindi/category.ts +++ b/lib/routes/thewirehindi/category.ts @@ -1,5 +1,6 @@ -import { Data, Route } from '@/types'; +import type { Data, Route } from '@/types'; import got from '@/utils/got'; + import { mapPostToItem } from './utils'; const categories = [ diff --git a/lib/routes/thewirehindi/index.ts b/lib/routes/thewirehindi/index.ts index 8d63f53302..4b4499b1b5 100644 --- a/lib/routes/thewirehindi/index.ts +++ b/lib/routes/thewirehindi/index.ts @@ -1,5 +1,6 @@ -import { Data, Route } from '@/types'; +import type { Data, Route } from '@/types'; import got from '@/utils/got'; + import { mapPostToItem } from './utils'; export const route: Route = { diff --git a/lib/routes/thewirehindi/utils.ts b/lib/routes/thewirehindi/utils.ts index 0f2200baa1..730ded2bc9 100644 --- a/lib/routes/thewirehindi/utils.ts +++ b/lib/routes/thewirehindi/utils.ts @@ -1,7 +1,8 @@ -import { DataItem } from '@/types'; +import path from 'node:path'; + +import type { DataItem } from '@/types'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export function mapPostToItem(post): DataItem { const featuredMedia = post._embedded?.['wp:featuredmedia']?.find((v) => v.id === post.featured_media); diff --git a/lib/routes/thoughtco/index.ts b/lib/routes/thoughtco/index.ts index 9d6e98341f..f3bbe04586 100644 --- a/lib/routes/thoughtco/index.ts +++ b/lib/routes/thoughtco/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/thoughtworks/index.ts b/lib/routes/thoughtworks/index.ts index daa652eec1..1df1b2d76d 100644 --- a/lib/routes/thoughtworks/index.ts +++ b/lib/routes/thoughtworks/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; // 统一使用的请求库 import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/threads/index.ts b/lib/routes/threads/index.ts index 9dc62ec187..6c40d644f7 100644 --- a/lib/routes/threads/index.ts +++ b/lib/routes/threads/index.ts @@ -1,9 +1,12 @@ -import { Route, ViewType } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import { threadUrl, profileUrl, extractTokens, getUserId, buildContent } from './utils'; import { JSDOM } from 'jsdom'; import { JSONPath } from 'jsonpath-plus'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + +import { buildContent, extractTokens, getUserId, profileUrl, threadUrl } from './utils'; export const route: Route = { path: '/:user/:routeParams?', diff --git a/lib/routes/threads/utils.ts b/lib/routes/threads/utils.ts index 1b35c346a5..d26a887514 100644 --- a/lib/routes/threads/utils.ts +++ b/lib/routes/threads/utils.ts @@ -1,11 +1,12 @@ import { load } from 'cheerio'; import dayjs from 'dayjs'; -import cache from '@/utils/cache'; -import NotFoundError from '@/errors/types/not-found'; -import ofetch from '@/utils/ofetch'; import { JSDOM } from 'jsdom'; import { JSONPath } from 'jsonpath-plus'; +import NotFoundError from '@/errors/types/not-found'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + const profileUrl = (user: string) => `https://www.threads.com/@${user}`; const threadUrl = (code: string) => `https://www.threads.com/t/${code}`; @@ -167,4 +168,4 @@ const buildContent = (item, options) => { return { title, description }; }; -export { profileUrl, threadUrl, extractTokens, getUserId, buildContent }; +export { buildContent, extractTokens, getUserId, profileUrl, threadUrl }; diff --git a/lib/routes/thwiki/index.ts b/lib/routes/thwiki/index.ts index 92399fb123..7f0f6e072c 100644 --- a/lib/routes/thwiki/index.ts +++ b/lib/routes/thwiki/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import dayjs from 'dayjs'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/calendar/:before?/:after?', categories: ['anime'], diff --git a/lib/routes/thzt/index.ts b/lib/routes/thzt/index.ts index aac9768cea..8102e6ef7a 100644 --- a/lib/routes/thzt/index.ts +++ b/lib/routes/thzt/index.ts @@ -1,8 +1,8 @@ -import { Route, DataItem } from '@/types'; +import { load } from 'cheerio'; +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/tidb/blog.ts b/lib/routes/tidb/blog.ts index 5470783cfd..ebd22505eb 100644 --- a/lib/routes/tidb/blog.ts +++ b/lib/routes/tidb/blog.ts @@ -1,12 +1,11 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type CheerioAPI, load } from 'cheerio'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { type CheerioAPI, load } from 'cheerio'; -import { type Context } from 'hono'; - const escapeHtml = (text: string): string => text?.replaceAll('&', '&')?.replaceAll('<', '<')?.replaceAll('>', '>')?.replaceAll("'", '"')?.replaceAll("'", ''') ?? text; const parseTextChildren = (children: any[]): string => children.map((child: any) => escapeHtml(child.text)).join(''); diff --git a/lib/routes/tiddlywiki/releases.ts b/lib/routes/tiddlywiki/releases.ts index cbc9174a60..622a309ab5 100644 --- a/lib/routes/tiddlywiki/releases.ts +++ b/lib/routes/tiddlywiki/releases.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/tiktok/user.ts b/lib/routes/tiktok/user.ts index 9c2927ed2f..e7d405ad64 100644 --- a/lib/routes/tiktok/user.ts +++ b/lib/routes/tiktok/user.ts @@ -1,12 +1,12 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; -import { config } from '@/config'; -import { parseDate } from '@/utils/parse-date'; -import { art } from '@/utils/render'; import path from 'node:path'; -import { queryToBoolean } from '@/utils/readable-social'; + +import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; +import { queryToBoolean } from '@/utils/readable-social'; +import { art } from '@/utils/render'; const baseUrl = 'https://www.tiktok.com'; diff --git a/lib/routes/timednews/news.ts b/lib/routes/timednews/news.ts index fe6f242ea8..c3b66a5893 100644 --- a/lib/routes/timednews/news.ts +++ b/lib/routes/timednews/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const BASE = 'https://www.timednews.com/topic'; diff --git a/lib/routes/tingshuitz/changsha.ts b/lib/routes/tingshuitz/changsha.ts index 1cf041f65e..4513a04eb7 100644 --- a/lib/routes/tingshuitz/changsha.ts +++ b/lib/routes/tingshuitz/changsha.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + const baseUrl = 'http://www.supplywater.com'; export const route: Route = { diff --git a/lib/routes/tingshuitz/dalian.ts b/lib/routes/tingshuitz/dalian.ts index 1d18118902..274314ac06 100644 --- a/lib/routes/tingshuitz/dalian.ts +++ b/lib/routes/tingshuitz/dalian.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/tingshuitz/dongguan.ts b/lib/routes/tingshuitz/dongguan.ts index ef0e4a53b3..362bcb3184 100644 --- a/lib/routes/tingshuitz/dongguan.ts +++ b/lib/routes/tingshuitz/dongguan.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/tingshuitz/guangzhou.ts b/lib/routes/tingshuitz/guangzhou.ts index 0142497f4a..c76d1601b3 100644 --- a/lib/routes/tingshuitz/guangzhou.ts +++ b/lib/routes/tingshuitz/guangzhou.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/tingshuitz/hangzhou.ts b/lib/routes/tingshuitz/hangzhou.ts index 234307b484..9baade89b9 100644 --- a/lib/routes/tingshuitz/hangzhou.ts +++ b/lib/routes/tingshuitz/hangzhou.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/hangzhou', categories: ['forecast'], diff --git a/lib/routes/tingshuitz/nanjing.ts b/lib/routes/tingshuitz/nanjing.ts index e17dd88d77..e2d2aa899b 100644 --- a/lib/routes/tingshuitz/nanjing.ts +++ b/lib/routes/tingshuitz/nanjing.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + const HOME_PAGE = 'http://www.jlwater.com/'; export const route: Route = { diff --git a/lib/routes/tingshuitz/shenzhen.ts b/lib/routes/tingshuitz/shenzhen.ts index 8f3f5e1aeb..6bc5792b80 100644 --- a/lib/routes/tingshuitz/shenzhen.ts +++ b/lib/routes/tingshuitz/shenzhen.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/shenzhen', diff --git a/lib/routes/tingshuitz/wuhan.ts b/lib/routes/tingshuitz/wuhan.ts index f2a03e8f59..415452b97a 100644 --- a/lib/routes/tingshuitz/wuhan.ts +++ b/lib/routes/tingshuitz/wuhan.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + const baseUrl = 'https://www.whwater.com'; export const route: Route = { diff --git a/lib/routes/tingshuitz/xian.ts b/lib/routes/tingshuitz/xian.ts index 560b08f1a8..855cf7755f 100644 --- a/lib/routes/tingshuitz/xian.ts +++ b/lib/routes/tingshuitz/xian.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/xian', categories: ['forecast'], diff --git a/lib/routes/tingshuitz/xiaoshan.ts b/lib/routes/tingshuitz/xiaoshan.ts index 444de1cdd0..5ec44886fd 100644 --- a/lib/routes/tingshuitz/xiaoshan.ts +++ b/lib/routes/tingshuitz/xiaoshan.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/xiaoshan', categories: ['forecast'], diff --git a/lib/routes/tingshuitz/yangjiang.ts b/lib/routes/tingshuitz/yangjiang.ts index dab09a273c..b4570f7f8b 100644 --- a/lib/routes/tingshuitz/yangjiang.ts +++ b/lib/routes/tingshuitz/yangjiang.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/tingtingfm/program.ts b/lib/routes/tingtingfm/program.ts index e73eb33a3e..a6c6afe120 100644 --- a/lib/routes/tingtingfm/program.ts +++ b/lib/routes/tingtingfm/program.ts @@ -1,11 +1,13 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { config } from '@/config'; -import { art } from '@/utils/render'; -import path from 'node:path'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + import { getClientVal, sign } from './utils'; export const route: Route = { diff --git a/lib/routes/tisi/index.ts b/lib/routes/tisi/index.ts index 5c6427aa41..537e63a5e3 100644 --- a/lib/routes/tisi/index.ts +++ b/lib/routes/tisi/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootUrl = 'https://www.tisi.org'; diff --git a/lib/routes/tju/cic/index.ts b/lib/routes/tju/cic/index.ts index bf08e241ba..6ce3a999b7 100644 --- a/lib/routes/tju/cic/index.ts +++ b/lib/routes/tju/cic/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/tju/news/index.ts b/lib/routes/tju/news/index.ts index b2f8a98a4b..e5d0b116fa 100644 --- a/lib/routes/tju/news/index.ts +++ b/lib/routes/tju/news/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/tju/oaa/index.ts b/lib/routes/tju/oaa/index.ts index 923c62dded..b65e2872a5 100644 --- a/lib/routes/tju/oaa/index.ts +++ b/lib/routes/tju/oaa/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { finishArticleItem } from '@/utils/wechat-mp'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; +import { finishArticleItem } from '@/utils/wechat-mp'; const oaa_base_url = 'http://oaa.tju.edu.cn/'; const repo_url = 'https://github.com/DIYgod/RSSHub/issues'; diff --git a/lib/routes/tju/yzb/index.ts b/lib/routes/tju/yzb/index.ts index 1fc5b77486..8f7f6147d0 100644 --- a/lib/routes/tju/yzb/index.ts +++ b/lib/routes/tju/yzb/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/tkww/index.ts b/lib/routes/tkww/index.ts index 4a00ab114a..61e0b81dee 100644 --- a/lib/routes/tkww/index.ts +++ b/lib/routes/tkww/index.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { config } from '@/config'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; export const route: Route = { path: '/:column{.+}?', diff --git a/lib/routes/tmtpost/column.ts b/lib/routes/tmtpost/column.ts index a611f8beeb..43e7a3c3d4 100644 --- a/lib/routes/tmtpost/column.ts +++ b/lib/routes/tmtpost/column.ts @@ -1,8 +1,8 @@ -import { type Data, type Route, ViewType } from '@/types'; - import { type Context } from 'hono'; -import { baseUrl, apiBaseUrl, processItems } from './util'; +import { type Data, type Route, ViewType } from '@/types'; + +import { apiBaseUrl, baseUrl, processItems } from './util'; export const handler = async (ctx: Context): Promise => { const { id } = ctx.req.param(); diff --git a/lib/routes/tmtpost/new.ts b/lib/routes/tmtpost/new.ts index aa29f2212f..6231949148 100644 --- a/lib/routes/tmtpost/new.ts +++ b/lib/routes/tmtpost/new.ts @@ -1,8 +1,8 @@ -import { type Data, type Route, ViewType } from '@/types'; - import { type Context } from 'hono'; -import { baseUrl, apiBaseUrl, processItems } from './util'; +import { type Data, type Route, ViewType } from '@/types'; + +import { apiBaseUrl, baseUrl, processItems } from './util'; export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/tmtpost/nictation.ts b/lib/routes/tmtpost/nictation.ts index 0b8f4204f7..50d773310e 100644 --- a/lib/routes/tmtpost/nictation.ts +++ b/lib/routes/tmtpost/nictation.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/tmtpost/util.ts b/lib/routes/tmtpost/util.ts index 70a3d446c8..87c21da810 100644 --- a/lib/routes/tmtpost/util.ts +++ b/lib/routes/tmtpost/util.ts @@ -1,12 +1,12 @@ -import { type Data, type DataItem } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type CheerioAPI, load } from 'cheerio'; + +import { type Data, type DataItem } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, load } from 'cheerio'; -import path from 'node:path'; +import { art } from '@/utils/render'; const baseUrl: string = 'https://www.tmtpost.com'; const apiBaseUrl: string = 'https://api.tmtpost.com'; @@ -201,4 +201,4 @@ const processItems = async (limit: number, query: Record, apiUrl: s }; }; -export { baseUrl, apiBaseUrl, processItems }; +export { apiBaseUrl, baseUrl, processItems }; diff --git a/lib/routes/tokeninsight/blog.ts b/lib/routes/tokeninsight/blog.ts index 9adc43c7a9..35b38fcea6 100644 --- a/lib/routes/tokeninsight/blog.ts +++ b/lib/routes/tokeninsight/blog.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const baseURL = 'https://www.tokeninsight.com/'; const title = 'TokenInsight'; const link = 'https://www.tokeninsight.com/'; diff --git a/lib/routes/tokeninsight/bulletin.ts b/lib/routes/tokeninsight/bulletin.ts index fc50d30e37..fe39c6dcfd 100644 --- a/lib/routes/tokeninsight/bulletin.ts +++ b/lib/routes/tokeninsight/bulletin.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const baseURL = 'https://www.tokeninsight.com/'; const title = 'TokenInsight'; const link = 'https://www.tokeninsight.com/'; diff --git a/lib/routes/tokeninsight/report.ts b/lib/routes/tokeninsight/report.ts index 68eee16f9b..7e26add654 100644 --- a/lib/routes/tokeninsight/report.ts +++ b/lib/routes/tokeninsight/report.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const baseURL = 'https://www.tokeninsight.com/'; const title = 'TokenInsight'; const link = 'https://www.tokeninsight.com/'; diff --git a/lib/routes/tongji/bks.ts b/lib/routes/tongji/bks.ts index 01266aa1e9..9bef2e53e1 100644 --- a/lib/routes/tongji/bks.ts +++ b/lib/routes/tongji/bks.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/tongji/gs.ts b/lib/routes/tongji/gs.ts index 4d1917344c..1c7712eed6 100644 --- a/lib/routes/tongji/gs.ts +++ b/lib/routes/tongji/gs.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/gs', diff --git a/lib/routes/tongji/sem/_utils.ts b/lib/routes/tongji/sem/_utils.ts index 090d1fce94..b735acac7f 100644 --- a/lib/routes/tongji/sem/_utils.ts +++ b/lib/routes/tongji/sem/_utils.ts @@ -1,7 +1,8 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + import { config } from '@/config'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export async function getNotifByPage(url): Promise<{ title: string; link: string; pubDate: Date }[]> { const pageUrl: string = url; diff --git a/lib/routes/tongji/sem/notice.ts b/lib/routes/tongji/sem/notice.ts index 790e67ce15..f5e398d3a5 100644 --- a/lib/routes/tongji/sem/notice.ts +++ b/lib/routes/tongji/sem/notice.ts @@ -1,8 +1,9 @@ // Warning: The author still knows nothing about javascript! -import { Route } from '@/types'; -import { getNotifByPage, getArticle } from './_utils'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import { getArticle, getNotifByPage } from './_utils'; + export const route: Route = { path: '/sem/:type?', categories: ['university'], diff --git a/lib/routes/tongji/sse/_article.ts b/lib/routes/tongji/sse/_article.ts index 4f8891760d..d976a79f6e 100644 --- a/lib/routes/tongji/sse/_article.ts +++ b/lib/routes/tongji/sse/_article.ts @@ -1,6 +1,7 @@ -import got from '@/utils/got'; // get web content import { load } from 'cheerio'; // html parser +import got from '@/utils/got'; // get web content + export default async function getArticle(item) { const response = await got({ method: 'get', diff --git a/lib/routes/tongji/sse/notice.ts b/lib/routes/tongji/sse/notice.ts index 87beaf7b79..1babd33159 100644 --- a/lib/routes/tongji/sse/notice.ts +++ b/lib/routes/tongji/sse/notice.ts @@ -1,15 +1,15 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; // html parser + +import type { Route } from '@/types'; import cache from '@/utils/cache'; // Warning: The author still knows nothing about javascript! - // params: // type: notification type - import got from '@/utils/got'; // get web content -import { load } from 'cheerio'; // html parser -import getArticle from './_article'; import { parseDate } from '@/utils/parse-date'; +import getArticle from './_article'; + export const route: Route = { path: '/sse/:type?', categories: ['university'], diff --git a/lib/routes/tongji/yjs.ts b/lib/routes/tongji/yjs.ts index afdfb0a013..b187395309 100644 --- a/lib/routes/tongji/yjs.ts +++ b/lib/routes/tongji/yjs.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/yjs', diff --git a/lib/routes/tongli/news.ts b/lib/routes/tongli/news.ts index da9072b13e..df3a59a4ab 100644 --- a/lib/routes/tongli/news.ts +++ b/lib/routes/tongli/news.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import * as cheerio from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import * as cheerio from 'cheerio'; export const route: Route = { path: '/news/:type', diff --git a/lib/routes/toodaylab/index.ts b/lib/routes/toodaylab/index.ts index 09f7703501..6bf80982b2 100644 --- a/lib/routes/toodaylab/index.ts +++ b/lib/routes/toodaylab/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:params{.+}?', diff --git a/lib/routes/tophub/index.ts b/lib/routes/tophub/index.ts index a753fa47e3..c25b0d3595 100644 --- a/lib/routes/tophub/index.ts +++ b/lib/routes/tophub/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + import { config } from '@/config'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; export const route: Route = { path: '/:id', diff --git a/lib/routes/tophub/list.ts b/lib/routes/tophub/list.ts index 9ce0230043..14dd039fed 100644 --- a/lib/routes/tophub/list.ts +++ b/lib/routes/tophub/list.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; -import { config } from '@/config'; import path from 'node:path'; -import { art } from '@/utils/render'; + +import { load } from 'cheerio'; import xxhash from 'xxhash-wasm'; +import { config } from '@/config'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { art } from '@/utils/render'; + export const route: Route = { path: '/list/:id', categories: ['new-media'], diff --git a/lib/routes/topys/index.ts b/lib/routes/topys/index.ts index 1428fb3d91..a956f3903e 100644 --- a/lib/routes/topys/index.ts +++ b/lib/routes/topys/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/toranoana/news.ts b/lib/routes/toranoana/news.ts index 404c1f513f..9c60d77f03 100644 --- a/lib/routes/toranoana/news.ts +++ b/lib/routes/toranoana/news.ts @@ -1,7 +1,8 @@ -import { Route, Data, DataItem } from '@/types'; +import { load } from 'cheerio'; + +import type { Data, DataItem, Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; export const route: Route = { path: '/news/:category?', diff --git a/lib/routes/toutiao/user.ts b/lib/routes/toutiao/user.ts index fbddd91b5d..c72224bd61 100644 --- a/lib/routes/toutiao/user.ts +++ b/lib/routes/toutiao/user.ts @@ -1,15 +1,17 @@ -import { Route } from '@/types'; +import path from 'node:path'; + +import { config } from '@/config'; +import RejectError from '@/errors/types/reject'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import { generateHeaders, PRESETS } from '@/utils/header-generator'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { PRESETS, generateHeaders } from '@/utils/header-generator'; -import { generate_a_bogus } from './a-bogus'; -import { Feed } from './types'; -import RejectError from '@/errors/types/reject'; -import { config } from '@/config'; -import path from 'node:path'; import { art } from '@/utils/render'; +import { generate_a_bogus } from './a-bogus'; +import type { Feed } from './types'; + export const route: Route = { path: '/user/token/:token', categories: ['new-media'], diff --git a/lib/routes/towardsdatascience/latest.ts b/lib/routes/towardsdatascience/latest.ts index 38ddf2f790..22eb9712cf 100644 --- a/lib/routes/towardsdatascience/latest.ts +++ b/lib/routes/towardsdatascience/latest.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/latest', diff --git a/lib/routes/tradingview/blog.ts b/lib/routes/tradingview/blog.ts index 8ffca34d16..02d3b62c9f 100644 --- a/lib/routes/tradingview/blog.ts +++ b/lib/routes/tradingview/blog.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; +import pMap from 'p-map'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import pMap from 'p-map'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/blog/:category{.+}?', diff --git a/lib/routes/tradingview/desktop.ts b/lib/routes/tradingview/desktop.ts index 09375cc71f..6873678fb1 100644 --- a/lib/routes/tradingview/desktop.ts +++ b/lib/routes/tradingview/desktop.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/desktop', diff --git a/lib/routes/tradingview/pine.ts b/lib/routes/tradingview/pine.ts index cc2167dab6..d78848fa5e 100644 --- a/lib/routes/tradingview/pine.ts +++ b/lib/routes/tradingview/pine.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/transcriptforest/index.ts b/lib/routes/transcriptforest/index.ts index 3bf8f75d50..7fcea4d0ee 100644 --- a/lib/routes/transcriptforest/index.ts +++ b/lib/routes/transcriptforest/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const bakeTimestamp = (seconds) => { const hours = Math.floor(seconds / 3600); diff --git a/lib/routes/transformer-circuits/index.ts b/lib/routes/transformer-circuits/index.ts index f5a40235f0..1586228b9a 100644 --- a/lib/routes/transformer-circuits/index.ts +++ b/lib/routes/transformer-circuits/index.ts @@ -1,11 +1,13 @@ -import { Route, DataItem } from '@/types'; -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; +import path from 'node:path'; + import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import logger from '@/utils/logger'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import logger from '@/utils/logger'; // Define the main route path export const route: Route = { diff --git a/lib/routes/trendforce/new.ts b/lib/routes/trendforce/new.ts index 7a9591d342..101013f1c7 100644 --- a/lib/routes/trendforce/new.ts +++ b/lib/routes/trendforce/new.ts @@ -1,11 +1,10 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; - import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '10', 10); diff --git a/lib/routes/trendingpapers/papers.ts b/lib/routes/trendingpapers/papers.ts index db5b76e20a..33d3a11cc9 100644 --- a/lib/routes/trendingpapers/papers.ts +++ b/lib/routes/trendingpapers/papers.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/tribalfootball/latest.ts b/lib/routes/tribalfootball/latest.ts index 11acd4cb5d..149f87e896 100644 --- a/lib/routes/tribalfootball/latest.ts +++ b/lib/routes/tribalfootball/latest.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { art } from '@/utils/render'; -import path from 'node:path'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; const rssUrl = 'https://www.tribalfootball.com/rss/mediafed/general/rss.xml'; diff --git a/lib/routes/trow/portal.ts b/lib/routes/trow/portal.ts index 8f086ae82f..c814477d30 100644 --- a/lib/routes/trow/portal.ts +++ b/lib/routes/trow/portal.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/tsdm39/bd.ts b/lib/routes/tsdm39/bd.ts index 2f65bda688..399a1db38b 100644 --- a/lib/routes/tsdm39/bd.ts +++ b/lib/routes/tsdm39/bd.ts @@ -1,9 +1,10 @@ -import type { DataItem, Route } from '@/types'; -import { config } from '@/config'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { DataItem, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; // type id => display name type Mapping = Record; diff --git a/lib/routes/tsinghua/lib/tzgg.ts b/lib/routes/tsinghua/lib/tzgg.ts index 73ff5975fa..b78f63a784 100644 --- a/lib/routes/tsinghua/lib/tzgg.ts +++ b/lib/routes/tsinghua/lib/tzgg.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; export const route: Route = { path: '/lib/tzgg/:category', diff --git a/lib/routes/tsinghua/lib/zydt.ts b/lib/routes/tsinghua/lib/zydt.ts index 6083c27f2a..37274420cf 100644 --- a/lib/routes/tsinghua/lib/zydt.ts +++ b/lib/routes/tsinghua/lib/zydt.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const handler = async (ctx) => { diff --git a/lib/routes/tsinghua/news.ts b/lib/routes/tsinghua/news.ts index 4158a6f813..1f23a0f327 100644 --- a/lib/routes/tsinghua/news.ts +++ b/lib/routes/tsinghua/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ttv/index.ts b/lib/routes/ttv/index.ts index b670f0104a..cab774a2ae 100644 --- a/lib/routes/ttv/index.ts +++ b/lib/routes/ttv/index.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/tumblr/posts.ts b/lib/routes/tumblr/posts.ts index 622df014c1..908fafa687 100644 --- a/lib/routes/tumblr/posts.ts +++ b/lib/routes/tumblr/posts.ts @@ -1,11 +1,13 @@ -import { Data, Route } from '@/types'; -import got from '@/utils/got'; -import utils from './utils'; import type { Context } from 'hono'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Data, Route } from '@/types'; +import got from '@/utils/got'; import { fallback, queryToInteger } from '@/utils/readable-social'; +import utils from './utils'; + export const route: Route = { path: '/posts/:blog', categories: ['blog'], diff --git a/lib/routes/tumblr/utils.ts b/lib/routes/tumblr/utils.ts index 97f584c650..8ac2eb26c5 100644 --- a/lib/routes/tumblr/utils.ts +++ b/lib/routes/tumblr/utils.ts @@ -1,9 +1,9 @@ -import { parseDate } from '@/utils/parse-date'; -import { DataItem } from '@/types'; import { config } from '@/config'; +import type { DataItem } from '@/types'; import cache from '@/utils/cache'; -import logger from '@/utils/logger'; import got from '@/utils/got'; +import logger from '@/utils/logger'; +import { parseDate } from '@/utils/parse-date'; const getAccessToken: () => Promise = async () => { let accessToken: string | null = await cache.get('tumblr:accessToken', false); diff --git a/lib/routes/tvb/news.ts b/lib/routes/tvb/news.ts index df834931f3..f610bea1df 100644 --- a/lib/routes/tvb/news.ts +++ b/lib/routes/tvb/news.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const titles = { focus: { diff --git a/lib/routes/tver/series.ts b/lib/routes/tver/series.ts index bc3f8e7f50..18e821d564 100644 --- a/lib/routes/tver/series.ts +++ b/lib/routes/tver/series.ts @@ -1,8 +1,9 @@ -import { Route, Data, DataItem } from '@/types'; +import type { Context } from 'hono'; + +import type { Data, DataItem, Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { Context } from 'hono'; export const route: Route = { path: '/series/:id', diff --git a/lib/routes/tvtropes/featured.ts b/lib/routes/tvtropes/featured.ts index c1b4cb9de9..9e9677f5b2 100644 --- a/lib/routes/tvtropes/featured.ts +++ b/lib/routes/tvtropes/featured.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + const categories = { today: 'left', newest: 'right', diff --git a/lib/routes/twitch/live.ts b/lib/routes/twitch/live.ts index d6f0c29330..f7445b9209 100644 --- a/lib/routes/twitch/live.ts +++ b/lib/routes/twitch/live.ts @@ -1,4 +1,5 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/twitch/schedule.ts b/lib/routes/twitch/schedule.ts index 1f5af2c5e9..daad1d2f03 100644 --- a/lib/routes/twitch/schedule.ts +++ b/lib/routes/twitch/schedule.ts @@ -1,5 +1,5 @@ import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; // https://github.com/streamlink/streamlink/blob/master/src/streamlink/plugins/twitch.py#L286 diff --git a/lib/routes/twitch/video.ts b/lib/routes/twitch/video.ts index c9df3e7b8c..f3324dbc47 100644 --- a/lib/routes/twitch/video.ts +++ b/lib/routes/twitch/video.ts @@ -1,5 +1,6 @@ import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/twitter/api/index.ts b/lib/routes/twitter/api/index.ts index 9f17ad7517..59536b1387 100644 --- a/lib/routes/twitter/api/index.ts +++ b/lib/routes/twitter/api/index.ts @@ -1,7 +1,8 @@ +import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; + import mobileApi from './mobile-api/api'; import webApi from './web-api/api'; -import { config } from '@/config'; const enableThirdPartyApi = config.twitter.thirdPartyApi; const enableMobileApi = config.twitter.username && config.twitter.password; diff --git a/lib/routes/twitter/api/mobile-api/api.ts b/lib/routes/twitter/api/mobile-api/api.ts index 35d64c1036..4f3e12ce55 100644 --- a/lib/routes/twitter/api/mobile-api/api.ts +++ b/lib/routes/twitter/api/mobile-api/api.ts @@ -1,14 +1,16 @@ -import { baseUrl, gqlMap, gqlFeatures, consumerKey, consumerSecret } from './constants'; -import { config } from '@/config'; -import logger from '@/utils/logger'; -import OAuth from 'oauth-1.0a'; import CryptoJS from 'crypto-js'; +import OAuth from 'oauth-1.0a'; import queryString from 'query-string'; -import { getToken } from './token'; -import cache from '@/utils/cache'; + +import { config } from '@/config'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import cache from '@/utils/cache'; +import logger from '@/utils/logger'; import ofetch from '@/utils/ofetch'; +import { baseUrl, consumerKey, consumerSecret, gqlFeatures, gqlMap } from './constants'; +import { getToken } from './token'; + const twitterGot = async (url, params) => { const token = await getToken(); diff --git a/lib/routes/twitter/api/mobile-api/constants.ts b/lib/routes/twitter/api/mobile-api/constants.ts index cd9b92bbbf..01af424945 100644 --- a/lib/routes/twitter/api/mobile-api/constants.ts +++ b/lib/routes/twitter/api/mobile-api/constants.ts @@ -83,4 +83,4 @@ const bearerToken = 'Bearer AAAAAAAAAAAAAAAAAAAAAFXzAwAAAAAAMHCxpeSDG1gLNLghVe8d const guestActivateUrl = baseUrl + '/1.1/guest/activate.json'; -export { baseUrl, consumerKey, consumerSecret, gqlMap, gqlFeatures, timelineParams, bearerToken, guestActivateUrl }; +export { baseUrl, bearerToken, consumerKey, consumerSecret, gqlFeatures, gqlMap, guestActivateUrl, timelineParams }; diff --git a/lib/routes/twitter/api/mobile-api/login.ts b/lib/routes/twitter/api/mobile-api/login.ts index f266877ec0..5544ea2102 100644 --- a/lib/routes/twitter/api/mobile-api/login.ts +++ b/lib/routes/twitter/api/mobile-api/login.ts @@ -1,14 +1,17 @@ // https://github.com/BANKA2017/twitter-monitor/blob/node/apps/open_account/scripts/login.mjs -import { bearerToken, guestActivateUrl } from './constants'; -import got from '@/utils/got'; -import ofetch from '@/utils/ofetch'; import crypto from 'node:crypto'; -import { v5 as uuidv5 } from 'uuid'; + import { authenticator } from 'otplib'; -import logger from '@/utils/logger'; -import cache from '@/utils/cache'; import { RateLimiterMemory, RateLimiterQueue, RateLimiterRedis } from 'rate-limiter-flexible'; +import { v5 as uuidv5 } from 'uuid'; + +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import logger from '@/utils/logger'; +import ofetch from '@/utils/ofetch'; + +import { bearerToken, guestActivateUrl } from './constants'; const ENDPOINT = 'https://api.x.com/1.1/onboarding/task.json'; diff --git a/lib/routes/twitter/api/mobile-api/token.ts b/lib/routes/twitter/api/mobile-api/token.ts index 51d6eba44f..93a6069cec 100644 --- a/lib/routes/twitter/api/mobile-api/token.ts +++ b/lib/routes/twitter/api/mobile-api/token.ts @@ -1,7 +1,8 @@ import { config } from '@/config'; -import login from './login'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import login from './login'; + let tokenIndex = 0; async function getToken() { diff --git a/lib/routes/twitter/api/web-api/api.ts b/lib/routes/twitter/api/web-api/api.ts index 44fc3144e5..cd3686d852 100644 --- a/lib/routes/twitter/api/web-api/api.ts +++ b/lib/routes/twitter/api/web-api/api.ts @@ -1,10 +1,11 @@ -import { baseUrl, gqlMap, gqlFeatures } from './constants'; import { config } from '@/config'; -import cache from '@/utils/cache'; -import { twitterGot, paginationTweets, gatherLegacyFromData } from './utils'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import { baseUrl, gqlFeatures, gqlMap } from './constants'; +import { gatherLegacyFromData, paginationTweets, twitterGot } from './utils'; + const getUserData = (id) => cache.tryGet(`twitter-userdata-${id}`, () => { const params = { diff --git a/lib/routes/twitter/api/web-api/constants.ts b/lib/routes/twitter/api/web-api/constants.ts index aecefd1ab4..1b9856ecb3 100644 --- a/lib/routes/twitter/api/web-api/constants.ts +++ b/lib/routes/twitter/api/web-api/constants.ts @@ -114,4 +114,4 @@ const timelineParams = { const bearerToken = 'Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA'; -export { baseUrl, gqlMap, gqlFeatures, timelineParams, bearerToken, thirdPartySupportedAPI }; +export { baseUrl, bearerToken, gqlFeatures, gqlMap, thirdPartySupportedAPI, timelineParams }; diff --git a/lib/routes/twitter/api/web-api/login.ts b/lib/routes/twitter/api/web-api/login.ts index bb7474d73f..85f71a023d 100644 --- a/lib/routes/twitter/api/web-api/login.ts +++ b/lib/routes/twitter/api/web-api/login.ts @@ -1,10 +1,11 @@ import { authenticator } from 'otplib'; -import logger from '@/utils/logger'; -import cache from '@/utils/cache'; -import { RateLimiterMemory, RateLimiterRedis, RateLimiterQueue } from 'rate-limiter-flexible'; -import puppeteer from '@/utils/puppeteer'; +import { RateLimiterMemory, RateLimiterQueue, RateLimiterRedis } from 'rate-limiter-flexible'; import { CookieJar } from 'tough-cookie'; +import cache from '@/utils/cache'; +import logger from '@/utils/logger'; +import puppeteer from '@/utils/puppeteer'; + const loginLimiter = cache.clients.redisClient ? new RateLimiterRedis({ points: 1, diff --git a/lib/routes/twitter/api/web-api/utils.ts b/lib/routes/twitter/api/web-api/utils.ts index 91315e0957..7d99d00b5d 100644 --- a/lib/routes/twitter/api/web-api/utils.ts +++ b/lib/routes/twitter/api/web-api/utils.ts @@ -1,14 +1,16 @@ -import ConfigNotFoundError from '@/errors/types/config-not-found'; -import { baseUrl, gqlFeatures, bearerToken, gqlMap, thirdPartySupportedAPI } from './constants'; -import { config } from '@/config'; +import { cookie as HttpCookieAgentCookie, CookieAgent } from 'http-cookie-agent/undici'; import queryString from 'query-string'; import { Cookie, CookieJar } from 'tough-cookie'; -import { CookieAgent, cookie as HttpCookieAgentCookie } from 'http-cookie-agent/undici'; -import { ProxyAgent, Client } from 'undici'; +import { Client, ProxyAgent } from 'undici'; + +import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; import cache from '@/utils/cache'; import logger from '@/utils/logger'; import ofetch from '@/utils/ofetch'; import proxy from '@/utils/proxy'; + +import { baseUrl, bearerToken, gqlFeatures, gqlMap, thirdPartySupportedAPI } from './constants'; import login from './login'; let authTokenIndex = 0; diff --git a/lib/routes/twitter/home-latest.ts b/lib/routes/twitter/home-latest.ts index 6c1a7b51ba..df40889449 100644 --- a/lib/routes/twitter/home-latest.ts +++ b/lib/routes/twitter/home-latest.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import utils from './utils'; +import type { Route } from '@/types'; + import api from './api'; +import utils from './utils'; export const route: Route = { path: '/home_latest/:routeParams?', diff --git a/lib/routes/twitter/home.ts b/lib/routes/twitter/home.ts index 1516c6829f..64a8d103c8 100644 --- a/lib/routes/twitter/home.ts +++ b/lib/routes/twitter/home.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import utils from './utils'; +import type { Route } from '@/types'; + import api from './api'; +import utils from './utils'; export const route: Route = { path: '/home/:routeParams?', diff --git a/lib/routes/twitter/keyword.ts b/lib/routes/twitter/keyword.ts index bfa99cc978..7ffdf8fd71 100644 --- a/lib/routes/twitter/keyword.ts +++ b/lib/routes/twitter/keyword.ts @@ -1,4 +1,6 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; + import api from './api'; import utils from './utils'; diff --git a/lib/routes/twitter/likes.ts b/lib/routes/twitter/likes.ts index 76f3ebe984..d2dde8672f 100644 --- a/lib/routes/twitter/likes.ts +++ b/lib/routes/twitter/likes.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import utils from './utils'; +import type { Route } from '@/types'; + import api from './api'; +import utils from './utils'; export const route: Route = { path: '/likes/:id/:routeParams?', diff --git a/lib/routes/twitter/list.ts b/lib/routes/twitter/list.ts index a97e20e8f5..9d71f96366 100644 --- a/lib/routes/twitter/list.ts +++ b/lib/routes/twitter/list.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import api from './api'; import utils from './utils'; diff --git a/lib/routes/twitter/media.ts b/lib/routes/twitter/media.ts index 342fe4c738..a3faef1f93 100644 --- a/lib/routes/twitter/media.ts +++ b/lib/routes/twitter/media.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import logger from '@/utils/logger'; + import api from './api'; import utils from './utils'; -import logger from '@/utils/logger'; export const route: Route = { path: '/media/:id/:routeParams?', diff --git a/lib/routes/twitter/trends.ts b/lib/routes/twitter/trends.ts index 5bfb1d56e1..8b0e63c0c0 100644 --- a/lib/routes/twitter/trends.ts +++ b/lib/routes/twitter/trends.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import utils from './utils'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; + +import utils from './utils'; export const route: Route = { path: '/trends/:woeid?', diff --git a/lib/routes/twitter/tweet.ts b/lib/routes/twitter/tweet.ts index 9b809e4e76..02470cf5f7 100644 --- a/lib/routes/twitter/tweet.ts +++ b/lib/routes/twitter/tweet.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { config } from '@/config'; +import type { Route } from '@/types'; +import { fallback, queryToBoolean } from '@/utils/readable-social'; + import api from './api'; import utils from './utils'; -import { fallback, queryToBoolean } from '@/utils/readable-social'; -import { config } from '@/config'; export const route: Route = { path: '/tweet/:id/status/:status/:original?', diff --git a/lib/routes/twitter/user.ts b/lib/routes/twitter/user.ts index a8bb96e542..db1fae8b4f 100644 --- a/lib/routes/twitter/user.ts +++ b/lib/routes/twitter/user.ts @@ -1,8 +1,10 @@ -import { Route, ViewType } from '@/types'; -import utils from './utils'; -import api from './api'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import logger from '@/utils/logger'; +import api from './api'; +import utils from './utils'; + export const route: Route = { path: '/user/:id/:routeParams?', categories: ['social-media'], diff --git a/lib/routes/twitter/utils.ts b/lib/routes/twitter/utils.ts index 766c7da68f..7eb9c5481b 100644 --- a/lib/routes/twitter/utils.ts +++ b/lib/routes/twitter/utils.ts @@ -1,8 +1,10 @@ import URL from 'node:url'; -import { config } from '@/config'; + import { TwitterApi } from 'twitter-api-v2'; -import { fallback, queryToBoolean, queryToInteger } from '@/utils/readable-social'; + +import { config } from '@/config'; import { parseDate } from '@/utils/parse-date'; +import { fallback, queryToBoolean, queryToInteger } from '@/utils/readable-social'; const getQueryParams = (url) => URL.parse(url, true).query; const getOriginalImg = (url) => { diff --git a/lib/routes/twreporter/category.ts b/lib/routes/twreporter/category.ts index cf5f6bc597..acce9370eb 100644 --- a/lib/routes/twreporter/category.ts +++ b/lib/routes/twreporter/category.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; diff --git a/lib/routes/twreporter/fetch-article.ts b/lib/routes/twreporter/fetch-article.ts index a81876372a..fa1d40c510 100644 --- a/lib/routes/twreporter/fetch-article.ts +++ b/lib/routes/twreporter/fetch-article.ts @@ -1,7 +1,8 @@ +import path from 'node:path'; + import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export default async function fetch(slug: string) { const url = `https://go-api.twreporter.org/v2/posts/${slug}?full=true`; diff --git a/lib/routes/twreporter/newest.ts b/lib/routes/twreporter/newest.ts index 017ed06054..eb65efd6e4 100644 --- a/lib/routes/twreporter/newest.ts +++ b/lib/routes/twreporter/newest.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; diff --git a/lib/routes/txks/news.ts b/lib/routes/txks/news.ts index f267d4a773..dae83a9ccd 100644 --- a/lib/routes/txks/news.ts +++ b/lib/routes/txks/news.ts @@ -1,8 +1,9 @@ +import { load } from 'cheerio'; + import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; const BASE_URL = 'https://www.txks.org.cn/index/work.html'; diff --git a/lib/routes/txrjy/fornumtopic.ts b/lib/routes/txrjy/fornumtopic.ts index 5c2b44bf83..1103298401 100644 --- a/lib/routes/txrjy/fornumtopic.ts +++ b/lib/routes/txrjy/fornumtopic.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; const rootUrl = 'https://www.txrjy.com'; diff --git a/lib/routes/tynu/tynu.ts b/lib/routes/tynu/tynu.ts index bf53ba059f..99373ee6b2 100644 --- a/lib/routes/tynu/tynu.ts +++ b/lib/routes/tynu/tynu.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const baseUrl = 'http://www.tynu.edu.cn'; export const route: Route = { diff --git a/lib/routes/typora/changelog-dev.ts b/lib/routes/typora/changelog-dev.ts index fd59818f3f..6859758d58 100644 --- a/lib/routes/typora/changelog-dev.ts +++ b/lib/routes/typora/changelog-dev.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/changelog/dev', categories: ['program-update'], diff --git a/lib/routes/typora/changelog.ts b/lib/routes/typora/changelog.ts index 35aefca179..c6f7c23dff 100644 --- a/lib/routes/typora/changelog.ts +++ b/lib/routes/typora/changelog.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/typst/universe.ts b/lib/routes/typst/universe.ts index e8ca12409d..2ba9ae26bd 100644 --- a/lib/routes/typst/universe.ts +++ b/lib/routes/typst/universe.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; +import vm from 'node:vm'; + import { load } from 'cheerio'; import markdownit from 'markdown-it'; -import vm from 'node:vm'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; interface Package { name: string; diff --git a/lib/routes/u3c3/index.ts b/lib/routes/u3c3/index.ts index 17cf675949..01fea524c5 100644 --- a/lib/routes/u3c3/index.ts +++ b/lib/routes/u3c3/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: ['/search/:keyword/:preview?', '/:type?/:preview?'], diff --git a/lib/routes/u9a9/index.ts b/lib/routes/u9a9/index.ts index a430fd109e..dbf2ea70b4 100644 --- a/lib/routes/u9a9/index.ts +++ b/lib/routes/u9a9/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/uber/blog.ts b/lib/routes/uber/blog.ts index 985e51d117..aea54a2c92 100644 --- a/lib/routes/uber/blog.ts +++ b/lib/routes/uber/blog.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootURL = 'https://www.uber.com'; diff --git a/lib/routes/ucas/ai.ts b/lib/routes/ucas/ai.ts index 778faf40ba..8f09115399 100644 --- a/lib/routes/ucas/ai.ts +++ b/lib/routes/ucas/ai.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ucas/index.ts b/lib/routes/ucas/index.ts index 52a648030b..bf8c78e05f 100644 --- a/lib/routes/ucas/index.ts +++ b/lib/routes/ucas/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootUrl = 'https://zhaopin.ucas.ac.cn'; diff --git a/lib/routes/uchicago/current.ts b/lib/routes/uchicago/current.ts index 3d7516d383..5651e1984d 100644 --- a/lib/routes/uchicago/current.ts +++ b/lib/routes/uchicago/current.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import { getCookies, setCookies } from '@/utils/puppeteer-utils'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import logger from '@/utils/logger'; +import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; +import { getCookies, setCookies } from '@/utils/puppeteer-utils'; export const route: Route = { path: '/journals/current/:journal', diff --git a/lib/routes/udn/breaking-news.ts b/lib/routes/udn/breaking-news.ts index bf69259984..a8a2cb104b 100644 --- a/lib/routes/udn/breaking-news.ts +++ b/lib/routes/udn/breaking-news.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; -import { load } from 'cheerio'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/news/breakingnews/:id', diff --git a/lib/routes/udn/global/index.ts b/lib/routes/udn/global/index.ts index 1fa74ba0a6..0c4a4a8845 100644 --- a/lib/routes/udn/global/index.ts +++ b/lib/routes/udn/global/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/global/:category?', diff --git a/lib/routes/udn/global/tag.ts b/lib/routes/udn/global/tag.ts index 7a3fc9b080..b1d86c80a2 100644 --- a/lib/routes/udn/global/tag.ts +++ b/lib/routes/udn/global/tag.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/uestc/auto.ts b/lib/routes/uestc/auto.ts index 0ad59b338c..5db79cbbbe 100644 --- a/lib/routes/uestc/auto.ts +++ b/lib/routes/uestc/auto.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; diff --git a/lib/routes/uestc/bbs.ts b/lib/routes/uestc/bbs.ts index da8f590f7d..4020e608db 100644 --- a/lib/routes/uestc/bbs.ts +++ b/lib/routes/uestc/bbs.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; // 统一使用的请求库 import { parseDate } from '@/utils/parse-date'; // 解析日期的工具函数 import timezone from '@/utils/timezone'; -import { config } from '@/config'; -import { load } from 'cheerio'; -import cache from '@/utils/cache'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; export const route: Route = { path: '/bbs/:types?', diff --git a/lib/routes/uestc/cqe.ts b/lib/routes/uestc/cqe.ts index 3af115ae9a..650fae4e54 100644 --- a/lib/routes/uestc/cqe.ts +++ b/lib/routes/uestc/cqe.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const baseUrl = 'https://cqe.uestc.edu.cn/'; diff --git a/lib/routes/uestc/gr.ts b/lib/routes/uestc/gr.ts index 8ebe51475a..3d901d0f12 100644 --- a/lib/routes/uestc/gr.ts +++ b/lib/routes/uestc/gr.ts @@ -1,11 +1,12 @@ -import { Data, DataItem, Route } from '@/types'; +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; -import type { Context } from 'hono'; const baseUrl = 'https://gr.uestc.edu.cn/'; const detailUrl = 'https://gr.uestc.edu.cn/'; diff --git a/lib/routes/uestc/jwc.ts b/lib/routes/uestc/jwc.ts index 301a1e2573..00433e05e2 100644 --- a/lib/routes/uestc/jwc.ts +++ b/lib/routes/uestc/jwc.ts @@ -1,11 +1,12 @@ -import { Data, DataItem, Route } from '@/types'; +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; -import type { Context } from 'hono'; const baseUrl = 'https://www.jwc.uestc.edu.cn/'; const detailUrl = 'https://www.jwc.uestc.edu.cn/info/'; diff --git a/lib/routes/uestc/news.ts b/lib/routes/uestc/news.ts index c02a64c84d..60335e9305 100644 --- a/lib/routes/uestc/news.ts +++ b/lib/routes/uestc/news.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; const dateRegex = /(20\d{2}).(\d{2})-(\d{2})/; diff --git a/lib/routes/uestc/scse.ts b/lib/routes/uestc/scse.ts index 06f9fc92ca..71689707d7 100644 --- a/lib/routes/uestc/scse.ts +++ b/lib/routes/uestc/scse.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; import dayjs from 'dayjs'; + +import type { Route } from '@/types'; +import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; const baseIndexUrl = 'https://www.scse.uestc.edu.cn/index.htm'; diff --git a/lib/routes/uestc/sice.ts b/lib/routes/uestc/sice.ts index 91d08f0fff..7a401f1357 100644 --- a/lib/routes/uestc/sice.ts +++ b/lib/routes/uestc/sice.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; import dayjs from 'dayjs'; + +import type { Route } from '@/types'; +import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; const baseIndexUrl = 'https://www.sice.uestc.edu.cn/index.htm'; diff --git a/lib/routes/uestc/sise.ts b/lib/routes/uestc/sise.ts index 080a9428ad..eede6d8771 100644 --- a/lib/routes/uestc/sise.ts +++ b/lib/routes/uestc/sise.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; import dayjs from 'dayjs'; -import puppeteer from '@/utils/puppeteer'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import { parseDate } from '@/utils/parse-date'; +import puppeteer from '@/utils/puppeteer'; const baseUrl = 'https://sise.uestc.edu.cn/'; diff --git a/lib/routes/uibe/hr.ts b/lib/routes/uibe/hr.ts index 69ed2a5da4..be06f587a8 100644 --- a/lib/routes/uibe/hr.ts +++ b/lib/routes/uibe/hr.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ulapia/index.ts b/lib/routes/ulapia/index.ts index 84c08f80df..32f4a4cd8c 100644 --- a/lib/routes/ulapia/index.ts +++ b/lib/routes/ulapia/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const rootUrl = 'http://www.ulapia.com'; diff --git a/lib/routes/ulapia/research.ts b/lib/routes/ulapia/research.ts index 70f8e0f750..a78e27e77e 100644 --- a/lib/routes/ulapia/research.ts +++ b/lib/routes/ulapia/research.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootUrl = 'http://www.ulapia.com'; diff --git a/lib/routes/unipd/ilbolive/news.ts b/lib/routes/unipd/ilbolive/news.ts index 32fd5ed331..dfbc1ad104 100644 --- a/lib/routes/unipd/ilbolive/news.ts +++ b/lib/routes/unipd/ilbolive/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/uniqlo/new.ts b/lib/routes/uniqlo/new.ts index 7909d4ff9c..90f3e0504b 100644 --- a/lib/routes/uniqlo/new.ts +++ b/lib/routes/uniqlo/new.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/unraid/community-apps.ts b/lib/routes/unraid/community-apps.ts index 6cb0eb42c3..004a62e887 100644 --- a/lib/routes/unraid/community-apps.ts +++ b/lib/routes/unraid/community-apps.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/unusualwhales/news.ts b/lib/routes/unusualwhales/news.ts index ca79212273..9ed0755bf8 100644 --- a/lib/routes/unusualwhales/news.ts +++ b/lib/routes/unusualwhales/news.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/upc/jsj.ts b/lib/routes/upc/jsj.ts index 4092d37323..1dc8d9461b 100644 --- a/lib/routes/upc/jsj.ts +++ b/lib/routes/upc/jsj.ts @@ -1,13 +1,13 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; // 计算机科学与技术学院:http://computer.upc.edu.cn/ // - 学院新闻:http://computer.upc.edu.cn/6277/list.htm // - 学术关注:http://computer.upc.edu.cn/6278/list.htm // - 学工动态:http://computer.upc.edu.cn/6279/list.htm // - 通知公告:http://computer.upc.edu.cn/6280/list.htm - import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/upc/jwc.ts b/lib/routes/upc/jwc.ts index 10ed178d10..a2b21ccae4 100644 --- a/lib/routes/upc/jwc.ts +++ b/lib/routes/upc/jwc.ts @@ -1,9 +1,10 @@ // 导入必要的模组 -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; const handler = async (ctx) => { diff --git a/lib/routes/upc/main.ts b/lib/routes/upc/main.ts index b308fee8d2..ea41372a80 100644 --- a/lib/routes/upc/main.ts +++ b/lib/routes/upc/main.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; // 学校官网:http://www.upc.edu.cn/ import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/upc/yjs.ts b/lib/routes/upc/yjs.ts index 585f4b6d4e..a59b1ed8be 100644 --- a/lib/routes/upc/yjs.ts +++ b/lib/routes/upc/yjs.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/ups/track.ts b/lib/routes/ups/track.ts index d04352d6fe..f1069ca751 100644 --- a/lib/routes/ups/track.ts +++ b/lib/routes/ups/track.ts @@ -1,5 +1,6 @@ -import { Route, DataItem } from '@/types'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; diff --git a/lib/routes/uptimerobot/rss.ts b/lib/routes/uptimerobot/rss.ts index 550aabd856..ad7d4ff1a6 100644 --- a/lib/routes/uptimerobot/rss.ts +++ b/lib/routes/uptimerobot/rss.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; - -import Parser from 'rss-parser'; -import { art } from '@/utils/render'; import path from 'node:path'; + import dayjs from 'dayjs'; -import { fallback, queryToBoolean } from '@/utils/readable-social'; +import Parser from 'rss-parser'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import { fallback, queryToBoolean } from '@/utils/readable-social'; +import { art } from '@/utils/render'; const titleRegex = /(.+)\s+is\s+([A-Z]+)\s+\((.+)\)/; diff --git a/lib/routes/uraaka-joshi/uraaka-joshi-user.ts b/lib/routes/uraaka-joshi/uraaka-joshi-user.ts index 78d34cc77a..51933cbd90 100644 --- a/lib/routes/uraaka-joshi/uraaka-joshi-user.ts +++ b/lib/routes/uraaka-joshi/uraaka-joshi-user.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; export const route: Route = { diff --git a/lib/routes/uraaka-joshi/uraaka-joshi.ts b/lib/routes/uraaka-joshi/uraaka-joshi.ts index 0fa0e1016b..e10b6ab8a4 100644 --- a/lib/routes/uraaka-joshi/uraaka-joshi.ts +++ b/lib/routes/uraaka-joshi/uraaka-joshi.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; import puppeteer from '@/utils/puppeteer'; diff --git a/lib/routes/urbandictionary/random.ts b/lib/routes/urbandictionary/random.ts index 0a2fc13601..405ba1d698 100644 --- a/lib/routes/urbandictionary/random.ts +++ b/lib/routes/urbandictionary/random.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/random', diff --git a/lib/routes/usenix/loginonline.ts b/lib/routes/usenix/loginonline.ts index 661455a82b..2c88489414 100644 --- a/lib/routes/usenix/loginonline.ts +++ b/lib/routes/usenix/loginonline.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/usenix/usenix.ts b/lib/routes/usenix/usenix.ts index dec57b60fe..8eff3387f7 100644 --- a/lib/routes/usenix/usenix.ts +++ b/lib/routes/usenix/usenix.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; -const url = 'https://www.usenix.org'; import { parseDate } from '@/utils/parse-date'; +const url = 'https://www.usenix.org'; + const seasons = ['spring', 'summer', 'fall', 'winter']; export const route: Route = { diff --git a/lib/routes/usepanda/index.ts b/lib/routes/usepanda/index.ts index 3ef3a4a132..fc36878de3 100644 --- a/lib/routes/usepanda/index.ts +++ b/lib/routes/usepanda/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/ustb/tj/news.ts b/lib/routes/ustb/tj/news.ts index 96cb774539..bc0a86e77c 100644 --- a/lib/routes/ustb/tj/news.ts +++ b/lib/routes/ustb/tj/news.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ustb/yjsy/news.ts b/lib/routes/ustb/yjsy/news.ts index 44c9b2414d..93496d5f9f 100644 --- a/lib/routes/ustb/yjsy/news.ts +++ b/lib/routes/ustb/yjsy/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; // import logger from '@/utils/logger'; diff --git a/lib/routes/ustb/yzxc/tzgg.ts b/lib/routes/ustb/yzxc/tzgg.ts index 7af45c210c..0b824fa5de 100644 --- a/lib/routes/ustb/yzxc/tzgg.ts +++ b/lib/routes/ustb/yzxc/tzgg.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const host = 'https://yzxc.ustb.edu.cn'; diff --git a/lib/routes/ustc/eeis.ts b/lib/routes/ustc/eeis.ts index e155d0a6f8..f0f29b98d3 100644 --- a/lib/routes/ustc/eeis.ts +++ b/lib/routes/ustc/eeis.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const map = new Map([ ['tzgg', { title: '中国科学技术大学电子工程与信息科学系 - 通知公告', id: '2702' }], diff --git a/lib/routes/ustc/gs.ts b/lib/routes/ustc/gs.ts index 8dbd4e08c5..4db48abd31 100644 --- a/lib/routes/ustc/gs.ts +++ b/lib/routes/ustc/gs.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const map = new Map([ ['tzgg', { title: '中国科学技术大学研究生院 - 通知公告', id: '9' }], diff --git a/lib/routes/ustc/index.ts b/lib/routes/ustc/index.ts index dda89d45a4..f17cff09ab 100644 --- a/lib/routes/ustc/index.ts +++ b/lib/routes/ustc/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/ustc/job.ts b/lib/routes/ustc/job.ts index 0e0b0d546a..8c5a7fc42f 100644 --- a/lib/routes/ustc/job.ts +++ b/lib/routes/ustc/job.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/ustc/jwc.ts b/lib/routes/ustc/jwc.ts index 135cdeced4..168c6adb91 100644 --- a/lib/routes/ustc/jwc.ts +++ b/lib/routes/ustc/jwc.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + const noticeUrl = 'https://www.teach.ustc.edu.cn/category/notice'; const noticeType = { teaching: '教学', info: '信息', exam: '考试', exchange: '交流' }; diff --git a/lib/routes/ustc/math.ts b/lib/routes/ustc/math.ts index 212b6e6e4c..4b216dd9f1 100644 --- a/lib/routes/ustc/math.ts +++ b/lib/routes/ustc/math.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const map = new Map([ ['xyxw', { title: '中国科学技术大学数学科学学院 - 学院新闻', id: 'xyxw' }], diff --git a/lib/routes/ustc/scms.ts b/lib/routes/ustc/scms.ts index 5ae9e447d7..0195aad6c2 100644 --- a/lib/routes/ustc/scms.ts +++ b/lib/routes/ustc/scms.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; // import InvalidParameterError from '@/errors/types/invalid-parameter'; diff --git a/lib/routes/ustc/sist.ts b/lib/routes/ustc/sist.ts index 44d0ba3dc9..bd9a0e4a50 100644 --- a/lib/routes/ustc/sist.ts +++ b/lib/routes/ustc/sist.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const map = new Map([ ['tzgg', { title: '中国科学技术大学信息科学技术学院 - 通知公告', id: '5142' }], diff --git a/lib/routes/usts/jwch.ts b/lib/routes/usts/jwch.ts index 6146bf3099..efa3c7985b 100644 --- a/lib/routes/usts/jwch.ts +++ b/lib/routes/usts/jwch.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/utgd/category.ts b/lib/routes/utgd/category.ts index cefd429257..d12a0f3258 100644 --- a/lib/routes/utgd/category.ts +++ b/lib/routes/utgd/category.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; - +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; -import { rootUrl, apiRootUrl, parseResult, parseArticle } from './utils'; + +import { apiRootUrl, parseArticle, parseResult, rootUrl } from './utils'; export const route: Route = { path: '/category/:category?', diff --git a/lib/routes/utgd/timeline.ts b/lib/routes/utgd/timeline.ts index 1b23fcec6e..422de43371 100644 --- a/lib/routes/utgd/timeline.ts +++ b/lib/routes/utgd/timeline.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; - +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; -import { rootUrl, apiRootUrl, parseResult, parseArticle } from './utils'; + +import { apiRootUrl, parseArticle, parseResult, rootUrl } from './utils'; export const route: Route = { path: '/timeline', diff --git a/lib/routes/utgd/topic.ts b/lib/routes/utgd/topic.ts index 03819e9579..50e43b3429 100644 --- a/lib/routes/utgd/topic.ts +++ b/lib/routes/utgd/topic.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { rootUrl, apiRootUrl, parseResult, parseArticle } from './utils'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + +import { apiRootUrl, parseArticle, parseResult, rootUrl } from './utils'; export const route: Route = { path: '/topic/:topic?', diff --git a/lib/routes/utgd/utils.ts b/lib/routes/utgd/utils.ts index 36a10ea8c9..85223d93a5 100644 --- a/lib/routes/utgd/utils.ts +++ b/lib/routes/utgd/utils.ts @@ -1,10 +1,13 @@ +import path from 'node:path'; + +import MarkdownIt from 'markdown-it'; + import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import MarkdownIt from 'markdown-it'; +import timezone from '@/utils/timezone'; + const md = MarkdownIt({ html: true, }); diff --git a/lib/routes/uw/gix/news.ts b/lib/routes/uw/gix/news.ts index c8125125ab..bc2476403f 100644 --- a/lib/routes/uw/gix/news.ts +++ b/lib/routes/uw/gix/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; const gixBaseURL = 'https://gixnetwork.org'; diff --git a/lib/routes/v1tx/index.ts b/lib/routes/v1tx/index.ts index a82e16b67a..4da2bb2f67 100644 --- a/lib/routes/v1tx/index.ts +++ b/lib/routes/v1tx/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/v2ex/post.ts b/lib/routes/v2ex/post.ts index f346c94cb0..756536940d 100644 --- a/lib/routes/v2ex/post.ts +++ b/lib/routes/v2ex/post.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/v2ex/tab.ts b/lib/routes/v2ex/tab.ts index e5186a227c..95d395ad41 100644 --- a/lib/routes/v2ex/tab.ts +++ b/lib/routes/v2ex/tab.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/tab/:tabid', diff --git a/lib/routes/v2ex/topics.ts b/lib/routes/v2ex/topics.ts index 8589a85802..03e6502f4f 100644 --- a/lib/routes/v2ex/topics.ts +++ b/lib/routes/v2ex/topics.ts @@ -1,4 +1,5 @@ -import { Route, ViewType } from '@/types'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/v2ex/xna.ts b/lib/routes/v2ex/xna.ts index 6dcf2eff8f..b05ac12273 100644 --- a/lib/routes/v2ex/xna.ts +++ b/lib/routes/v2ex/xna.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/xna', categories: ['bbs', 'blog'], diff --git a/lib/routes/v2rayshare/index.ts b/lib/routes/v2rayshare/index.ts index 86d8f3dd0f..5a8f753ff8 100644 --- a/lib/routes/v2rayshare/index.ts +++ b/lib/routes/v2rayshare/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; // 自订的 got import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/vcb-s/category.ts b/lib/routes/vcb-s/category.ts index e2cb4a9555..83d90138f8 100644 --- a/lib/routes/vcb-s/category.ts +++ b/lib/routes/vcb-s/category.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const rootUrl = 'https://vcb-s.com'; const cateAPIUrl = `${rootUrl}/wp-json/wp/v2/categories`; diff --git a/lib/routes/vcb-s/index.ts b/lib/routes/vcb-s/index.ts index 3d638bee80..363da51509 100644 --- a/lib/routes/vcb-s/index.ts +++ b/lib/routes/vcb-s/index.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const rootUrl = 'https://vcb-s.com'; const postsAPIUrl = `${rootUrl}/wp-json/wp/v2/posts`; diff --git a/lib/routes/verfghbw/press.ts b/lib/routes/verfghbw/press.ts index 68a003ec08..3e68e5f021 100644 --- a/lib/routes/verfghbw/press.ts +++ b/lib/routes/verfghbw/press.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/vertikal/latest.ts b/lib/routes/vertikal/latest.ts index d7e765147a..3374723f67 100644 --- a/lib/routes/vertikal/latest.ts +++ b/lib/routes/vertikal/latest.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import * as cheerio from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/latest', diff --git a/lib/routes/vice/topic.ts b/lib/routes/vice/topic.ts index 9658fdfbd6..43110228f4 100644 --- a/lib/routes/vice/topic.ts +++ b/lib/routes/vice/topic.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import cache from '@/utils/cache'; import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; const render = (data) => art(path.join(__dirname, 'templates/article.art'), data); diff --git a/lib/routes/vimeo/category.ts b/lib/routes/vimeo/category.ts index 9470a1465d..87af674a34 100644 --- a/lib/routes/vimeo/category.ts +++ b/lib/routes/vimeo/category.ts @@ -1,11 +1,13 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/category/:category/:staffpicks?', diff --git a/lib/routes/vimeo/channel.ts b/lib/routes/vimeo/channel.ts index 26a987b363..606632a278 100644 --- a/lib/routes/vimeo/channel.ts +++ b/lib/routes/vimeo/channel.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/channel/:channel', diff --git a/lib/routes/vimeo/usr-videos.ts b/lib/routes/vimeo/usr-videos.ts index 0dd57a5121..bb8ff211d9 100644 --- a/lib/routes/vimeo/usr-videos.ts +++ b/lib/routes/vimeo/usr-videos.ts @@ -1,9 +1,10 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/user/:username/:cat?', diff --git a/lib/routes/visionias/daily-news-summary.ts b/lib/routes/visionias/daily-news-summary.ts index 7944dc348d..c4b1eed8af 100644 --- a/lib/routes/visionias/daily-news-summary.ts +++ b/lib/routes/visionias/daily-news-summary.ts @@ -1,9 +1,10 @@ -import { Data, Route, DataItem } from '@/types'; -import { baseUrl } from './utils'; - -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import type { Data, DataItem, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + +import { baseUrl } from './utils'; + export const route: Route = { path: '/dailySummary', example: '/visionias/dailySummary', diff --git a/lib/routes/visionias/monthly-magazine.ts b/lib/routes/visionias/monthly-magazine.ts index 46af151915..e8bbef7ae6 100644 --- a/lib/routes/visionias/monthly-magazine.ts +++ b/lib/routes/visionias/monthly-magazine.ts @@ -1,9 +1,10 @@ -import { Data, Route } from '@/types'; -import { baseUrl, extractNews } from './utils'; - -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import type { Data, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + +import { baseUrl, extractNews } from './utils'; + export const route: Route = { path: '/monthlyMagazine', example: '/visionias/monthlyMagazine', diff --git a/lib/routes/visionias/news-today.ts b/lib/routes/visionias/news-today.ts index 88892879c2..5c8d67bee8 100644 --- a/lib/routes/visionias/news-today.ts +++ b/lib/routes/visionias/news-today.ts @@ -1,10 +1,11 @@ -import { Data, Route } from '@/types'; -import { baseUrl, extractNews } from './utils'; -import dayjs from 'dayjs'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import dayjs from 'dayjs'; +import type { Data, Route } from '@/types'; import logger from '@/utils/logger'; +import ofetch from '@/utils/ofetch'; + +import { baseUrl, extractNews } from './utils'; export const route: Route = { path: '/newsToday/:filter?', diff --git a/lib/routes/visionias/utils.ts b/lib/routes/visionias/utils.ts index 2ce3cfa9c6..411e489c2a 100644 --- a/lib/routes/visionias/utils.ts +++ b/lib/routes/visionias/utils.ts @@ -1,10 +1,12 @@ -import { DataItem } from '@/types'; +import path from 'node:path'; + +import { load } from 'cheerio'; + +import type { DataItem } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; -import cache from '@/utils/cache'; export const baseUrl = 'https://visionias.in'; diff --git a/lib/routes/visionias/weekly-focus.ts b/lib/routes/visionias/weekly-focus.ts index fd1c0c2a84..bcf73b69f0 100644 --- a/lib/routes/visionias/weekly-focus.ts +++ b/lib/routes/visionias/weekly-focus.ts @@ -1,8 +1,10 @@ -import { Data, Route } from '@/types'; -import { baseUrl, extractNews } from './utils'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import type { Data, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + +import { baseUrl, extractNews } from './utils'; + export const route: Route = { path: '/weeklyFocus', example: '/visionias/weeklyFocus', diff --git a/lib/routes/visualstudio/code-blog.ts b/lib/routes/visualstudio/code-blog.ts index 75954badb3..e5c5b02a9a 100644 --- a/lib/routes/visualstudio/code-blog.ts +++ b/lib/routes/visualstudio/code-blog.ts @@ -1,8 +1,10 @@ -import { Route, DataItem, Data, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Data, DataItem, Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import parser from '@/utils/rss-parser'; -import { load } from 'cheerio'; export const route: Route = { path: '/code/blog', diff --git a/lib/routes/visualstudio/namespace.ts b/lib/routes/visualstudio/namespace.ts index 240c31c5d1..5a76697624 100644 --- a/lib/routes/visualstudio/namespace.ts +++ b/lib/routes/visualstudio/namespace.ts @@ -1,4 +1,4 @@ -import { Namespace } from '@/types'; +import type { Namespace } from '@/types'; export const namespace: Namespace = { name: 'Visual Studio', diff --git a/lib/routes/vocus/publication.ts b/lib/routes/vocus/publication.ts index e144d1003e..4723f1e9d4 100644 --- a/lib/routes/vocus/publication.ts +++ b/lib/routes/vocus/publication.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { processList, ProcessFeed, baseUrl, apiUrl } from './utils'; + +import { apiUrl, baseUrl, ProcessFeed, processList } from './utils'; export const route: Route = { path: '/publication/:id', diff --git a/lib/routes/vocus/user.ts b/lib/routes/vocus/user.ts index 95263d1d26..5176524839 100644 --- a/lib/routes/vocus/user.ts +++ b/lib/routes/vocus/user.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { processList, ProcessFeed, baseUrl, apiUrl } from './utils'; + +import { apiUrl, baseUrl, ProcessFeed, processList } from './utils'; export const route: Route = { path: '/user/:id', diff --git a/lib/routes/vocus/utils.ts b/lib/routes/vocus/utils.ts index 85060d8348..4792655b65 100644 --- a/lib/routes/vocus/utils.ts +++ b/lib/routes/vocus/utils.ts @@ -1,5 +1,6 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://vocus.cc'; @@ -43,4 +44,4 @@ const ProcessFeed = (list, tryGet) => ) ); -export { processList, ProcessFeed, baseUrl, apiUrl }; +export { apiUrl, baseUrl, ProcessFeed, processList }; diff --git a/lib/routes/vom/featured.ts b/lib/routes/vom/featured.ts index eab557c807..d561778f32 100644 --- a/lib/routes/vom/featured.ts +++ b/lib/routes/vom/featured.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const baseUrl = 'http://www.vom.mn'; export const route: Route = { diff --git a/lib/routes/voronoiapp/author.ts b/lib/routes/voronoiapp/author.ts index 9731aa6386..e1214e5cb9 100644 --- a/lib/routes/voronoiapp/author.ts +++ b/lib/routes/voronoiapp/author.ts @@ -1,7 +1,8 @@ import type { Data, Route } from '@/types'; -import { CommonDataProperties, CommonRouteProperties, getPostItems } from './common'; -import ofetch from '@/utils/ofetch'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + +import { CommonDataProperties, CommonRouteProperties, getPostItems } from './common'; export const route: Route = { ...CommonRouteProperties, diff --git a/lib/routes/voronoiapp/common.ts b/lib/routes/voronoiapp/common.ts index 9b14bc9b03..8182ec026c 100644 --- a/lib/routes/voronoiapp/common.ts +++ b/lib/routes/voronoiapp/common.ts @@ -1,6 +1,7 @@ -import { ViewType, type Data, type DataItem, type Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + import type { Post } from './types'; export async function getPostItems(params: { diff --git a/lib/routes/voronoiapp/editors-pick.ts b/lib/routes/voronoiapp/editors-pick.ts index 1907f290f7..ac523a6431 100644 --- a/lib/routes/voronoiapp/editors-pick.ts +++ b/lib/routes/voronoiapp/editors-pick.ts @@ -1,5 +1,6 @@ import type { Data, Route } from '@/types'; -import { getPostItems, CategoryParam, CommonRouteProperties, CommonDataProperties } from './common'; + +import { CategoryParam, CommonDataProperties, CommonRouteProperties, getPostItems } from './common'; export const route: Route = { ...CommonRouteProperties, diff --git a/lib/routes/voronoiapp/home.ts b/lib/routes/voronoiapp/home.ts index 3558e1e229..c4fbffca0f 100644 --- a/lib/routes/voronoiapp/home.ts +++ b/lib/routes/voronoiapp/home.ts @@ -1,5 +1,6 @@ import type { Data, Route } from '@/types'; -import { getPostItems, CategoryParam, CommonRouteProperties, CommonDataProperties } from './common'; + +import { CategoryParam, CommonDataProperties, CommonRouteProperties, getPostItems } from './common'; export const route: Route = { ...CommonRouteProperties, diff --git a/lib/routes/voronoiapp/latest.ts b/lib/routes/voronoiapp/latest.ts index 2ef90fc0d9..eecb2ee279 100644 --- a/lib/routes/voronoiapp/latest.ts +++ b/lib/routes/voronoiapp/latest.ts @@ -1,5 +1,6 @@ import type { Data, Route } from '@/types'; -import { getPostItems, CategoryParam, CommonRouteProperties, CommonDataProperties } from './common'; + +import { CategoryParam, CommonDataProperties, CommonRouteProperties, getPostItems } from './common'; export const route: Route = { ...CommonRouteProperties, diff --git a/lib/routes/voronoiapp/popular.ts b/lib/routes/voronoiapp/popular.ts index ab99de9f28..1433a3c0f3 100644 --- a/lib/routes/voronoiapp/popular.ts +++ b/lib/routes/voronoiapp/popular.ts @@ -1,4 +1,5 @@ import type { Data, Route } from '@/types'; + import { CategoryParam, CommonDataProperties, CommonRouteProperties, getPostItems, TabMap, TabParam, TimeRangeParam } from './common'; export const route: Route = { diff --git a/lib/routes/voronoiapp/search.ts b/lib/routes/voronoiapp/search.ts index d04a995157..74ce0ec8f9 100644 --- a/lib/routes/voronoiapp/search.ts +++ b/lib/routes/voronoiapp/search.ts @@ -1,4 +1,5 @@ import type { Data, Route } from '@/types'; + import { CommonDataProperties, CommonRouteProperties, getPostItems } from './common'; export const route: Route = { diff --git a/lib/routes/wabei/index.ts b/lib/routes/wabei/index.ts index e4bc1869fe..e24f500598 100644 --- a/lib/routes/wabei/index.ts +++ b/lib/routes/wabei/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/wainao/topics.ts b/lib/routes/wainao/topics.ts index ec49b80566..d1447aa312 100644 --- a/lib/routes/wainao/topics.ts +++ b/lib/routes/wainao/topics.ts @@ -1,12 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import { art } from '@/utils/render'; -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; +import path from 'node:path'; import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; -import path from 'node:path'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { id = 'hotspot' } = ctx.req.param(); diff --git a/lib/routes/wainao/wainao-reads.ts b/lib/routes/wainao/wainao-reads.ts index ef918c81ca..f2592117d5 100644 --- a/lib/routes/wainao/wainao-reads.ts +++ b/lib/routes/wainao/wainao-reads.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/wallhaven/index.ts b/lib/routes/wallhaven/index.ts index 1d65388447..f2601fbd36 100644 --- a/lib/routes/wallhaven/index.ts +++ b/lib/routes/wallhaven/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const rootUrl = 'https://wallhaven.cc'; diff --git a/lib/routes/wallpaperhub/index.ts b/lib/routes/wallpaperhub/index.ts index 67b7c733ce..a7cc669b20 100644 --- a/lib/routes/wallpaperhub/index.ts +++ b/lib/routes/wallpaperhub/index.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/', diff --git a/lib/routes/wallstreetcn/calendar.ts b/lib/routes/wallstreetcn/calendar.ts index 5eae0a3cbf..f61dfe3835 100644 --- a/lib/routes/wallstreetcn/calendar.ts +++ b/lib/routes/wallstreetcn/calendar.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/wallstreetcn/hot.ts b/lib/routes/wallstreetcn/hot.ts index 5bdaeb9e27..2f92248c95 100644 --- a/lib/routes/wallstreetcn/hot.ts +++ b/lib/routes/wallstreetcn/hot.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/wallstreetcn/live.ts b/lib/routes/wallstreetcn/live.ts index dcf90ec969..3ccdc4a47b 100644 --- a/lib/routes/wallstreetcn/live.ts +++ b/lib/routes/wallstreetcn/live.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const titles = { global: '要闻', diff --git a/lib/routes/wallstreetcn/news.ts b/lib/routes/wallstreetcn/news.ts index 7f7893e313..7a98df8241 100644 --- a/lib/routes/wallstreetcn/news.ts +++ b/lib/routes/wallstreetcn/news.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/wanqu/news.ts b/lib/routes/wanqu/news.ts index 59053cb919..39e3d1832f 100644 --- a/lib/routes/wanqu/news.ts +++ b/lib/routes/wanqu/news.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/warhammer-community/namespace.ts b/lib/routes/warhammer-community/namespace.ts index 10af664708..812319109c 100644 --- a/lib/routes/warhammer-community/namespace.ts +++ b/lib/routes/warhammer-community/namespace.ts @@ -1,4 +1,4 @@ -import { Namespace } from '@/types'; +import type { Namespace } from '@/types'; export const namespace: Namespace = { name: 'Warhammer Community', diff --git a/lib/routes/warhammer-community/news.ts b/lib/routes/warhammer-community/news.ts index 362dc4fe16..50ba1df206 100644 --- a/lib/routes/warhammer-community/news.ts +++ b/lib/routes/warhammer-community/news.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; export const route: Route = { path: '/news', diff --git a/lib/routes/warp/blog.ts b/lib/routes/warp/blog.ts index 528c422e67..116b69efac 100644 --- a/lib/routes/warp/blog.ts +++ b/lib/routes/warp/blog.ts @@ -1,8 +1,10 @@ -import { Route, DataItem, Data, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Data, DataItem, Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import parser from '@/utils/rss-parser'; -import { load } from 'cheerio'; export const route: Route = { path: '/blog', diff --git a/lib/routes/warp/namespace.ts b/lib/routes/warp/namespace.ts index 4fcdf64da8..ed1e6bed26 100644 --- a/lib/routes/warp/namespace.ts +++ b/lib/routes/warp/namespace.ts @@ -1,4 +1,4 @@ -import { Namespace } from '@/types'; +import type { Namespace } from '@/types'; export const namespace: Namespace = { name: 'Warp', diff --git a/lib/routes/warthunder/news.ts b/lib/routes/warthunder/news.ts index 25f266a36a..e92685166d 100644 --- a/lib/routes/warthunder/news.ts +++ b/lib/routes/warthunder/news.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import path from 'node:path'; -import { art } from '@/utils/render'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; import timezone from '@/utils/timezone'; + const renderDescription = (desc) => art(path.join(__dirname, 'templates/description.art'), desc); export const route: Route = { diff --git a/lib/routes/washingtonpost/app.ts b/lib/routes/washingtonpost/app.ts index 80fef6ec39..dc443a9aa3 100644 --- a/lib/routes/washingtonpost/app.ts +++ b/lib/routes/washingtonpost/app.ts @@ -1,13 +1,15 @@ -import { Route } from '@/types'; +import path from 'node:path'; + +import dayjs from 'dayjs'; +import advancedFormat from 'dayjs/plugin/advancedFormat.js'; +import timezone from 'dayjs/plugin/timezone.js'; +import utc from 'dayjs/plugin/utc.js'; +import { FetchError } from 'ofetch'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { FetchError } from 'ofetch'; -import dayjs from 'dayjs'; -import utc from 'dayjs/plugin/utc.js'; -import timezone from 'dayjs/plugin/timezone.js'; -import advancedFormat from 'dayjs/plugin/advancedFormat.js'; export const route: Route = { path: '/app/:category{.+}?', diff --git a/lib/routes/wbv-gpa/index.ts b/lib/routes/wbv-gpa/index.ts index 49cf9d509a..d2164c0f21 100644 --- a/lib/routes/wbv-gpa/index.ts +++ b/lib/routes/wbv-gpa/index.ts @@ -1,6 +1,7 @@ import { load } from 'cheerio'; -import ofetch from '@/utils/ofetch'; + import type { Data, DataItem, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; const FEED_LANGUAGE = 'de' as const; const FEED_LOGO = 'https://www.wbv-gpa.at/app/uploads/2024/01/cropped-WBV-Favicon-192x192.png'; diff --git a/lib/routes/wchscu/recruit.ts b/lib/routes/wchscu/recruit.ts index da7dc6b657..b01dcc2742 100644 --- a/lib/routes/wchscu/recruit.ts +++ b/lib/routes/wchscu/recruit.ts @@ -1,9 +1,9 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; const handler = async () => { const rootUrl = 'https:///www.wchscu.cn'; diff --git a/lib/routes/wdc/download.ts b/lib/routes/wdc/download.ts index fd03de6f43..f2c66f82ec 100644 --- a/lib/routes/wdc/download.ts +++ b/lib/routes/wdc/download.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/wdfxw/bookfree.ts b/lib/routes/wdfxw/bookfree.ts index 5700dde5c1..e9a689e1d9 100644 --- a/lib/routes/wdfxw/bookfree.ts +++ b/lib/routes/wdfxw/bookfree.ts @@ -1,14 +1,14 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import path from 'node:path'; -import { art } from '@/utils/render'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; -import path from 'node:path'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const { id } = ctx.req.param(); diff --git a/lib/routes/web/articles.ts b/lib/routes/web/articles.ts index 9a1dde2f27..0814fd519d 100644 --- a/lib/routes/web/articles.ts +++ b/lib/routes/web/articles.ts @@ -1,4 +1,5 @@ import type { Data, Route } from '@/types'; + import { fetchItems } from './utils'; export const route: Route = { diff --git a/lib/routes/web/blog.ts b/lib/routes/web/blog.ts index d76f417d46..8effd64f4e 100644 --- a/lib/routes/web/blog.ts +++ b/lib/routes/web/blog.ts @@ -1,4 +1,5 @@ import type { Data, Route } from '@/types'; + import { fetchItems } from './utils'; export const route: Route = { diff --git a/lib/routes/web/series.ts b/lib/routes/web/series.ts index 3536b41a16..f6fa1f3efa 100644 --- a/lib/routes/web/series.ts +++ b/lib/routes/web/series.ts @@ -1,4 +1,5 @@ import type { Data, Route } from '@/types'; + import { fetchItems, hyphen2Pascal } from './utils'; export const route: Route = { diff --git a/lib/routes/web/utils.ts b/lib/routes/web/utils.ts index b7eb24dfa6..3bbdd911e7 100644 --- a/lib/routes/web/utils.ts +++ b/lib/routes/web/utils.ts @@ -1,7 +1,8 @@ +import { load } from 'cheerio'; + import type { DataItem } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; type ArticleData = [ string, diff --git a/lib/routes/web3caff/index.ts b/lib/routes/web3caff/index.ts index bbac60380c..90f8e9422c 100644 --- a/lib/routes/web3caff/index.ts +++ b/lib/routes/web3caff/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import { getSubPath } from '@/utils/common-utils'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/webcatalog/changelog.ts b/lib/routes/webcatalog/changelog.ts index c5b9788115..599ba756aa 100644 --- a/lib/routes/webcatalog/changelog.ts +++ b/lib/routes/webcatalog/changelog.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/changelog', diff --git a/lib/routes/wechat/announce.ts b/lib/routes/wechat/announce.ts index 1880079aab..37b124dae7 100644 --- a/lib/routes/wechat/announce.ts +++ b/lib/routes/wechat/announce.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/wechat/ce.ts b/lib/routes/wechat/ce.ts index 21f94788ae..3c5418b5a2 100644 --- a/lib/routes/wechat/ce.ts +++ b/lib/routes/wechat/ce.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import parser from '@/utils/rss-parser'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { fixArticleContent } from '@/utils/wechat-mp'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import parser from '@/utils/rss-parser'; +import { fixArticleContent } from '@/utils/wechat-mp'; // any UA containing "RSS" can pass the check // mark the UA as a desktop UA with "(X11; Linux x86_64)" diff --git a/lib/routes/wechat/data258.ts b/lib/routes/wechat/data258.ts index fa13cc0a9a..f8a1918c24 100644 --- a/lib/routes/wechat/data258.ts +++ b/lib/routes/wechat/data258.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import RequestInProgressError from '@/errors/types/request-in-progress'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { finishArticleItem } from '@/utils/wechat-mp'; import wait from '@/utils/wait'; -import RequestInProgressError from '@/errors/types/request-in-progress'; +import { finishArticleItem } from '@/utils/wechat-mp'; const parsePage = ($item, hyperlinkSelector, timeSelector) => { const hyperlink = $item.find(hyperlinkSelector); diff --git a/lib/routes/wechat/ershcimi.ts b/lib/routes/wechat/ershcimi.ts index cbf89218c1..d9d0809612 100644 --- a/lib/routes/wechat/ershcimi.ts +++ b/lib/routes/wechat/ershcimi.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { finishArticleItem } from '@/utils/wechat-mp'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; +import { finishArticleItem } from '@/utils/wechat-mp'; export const route: Route = { path: '/ershicimi/:id', diff --git a/lib/routes/wechat/mp.ts b/lib/routes/wechat/mp.ts index 373200309f..34e190fadd 100755 --- a/lib/routes/wechat/mp.ts +++ b/lib/routes/wechat/mp.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; import dayjs from 'dayjs'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { finishArticleItem } from '@/utils/wechat-mp'; export const route: Route = { diff --git a/lib/routes/wechat/msgalbum.ts b/lib/routes/wechat/msgalbum.ts index 7ef3248241..3270573569 100644 --- a/lib/routes/wechat/msgalbum.ts +++ b/lib/routes/wechat/msgalbum.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; import dayjs from 'dayjs'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { finishArticleItem } from '@/utils/wechat-mp'; export const route: Route = { diff --git a/lib/routes/wechat/sogou.ts b/lib/routes/wechat/sogou.ts index 3940f6acab..af15123b9c 100644 --- a/lib/routes/wechat/sogou.ts +++ b/lib/routes/wechat/sogou.ts @@ -1,9 +1,10 @@ -import { Route, DataItem } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; +import logger from '@/utils/logger'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { finishArticleItem } from '@/utils/wechat-mp'; -import logger from '@/utils/logger'; const host = 'https://weixin.sogou.com'; const hardcodedCookie = 'SNUID=78725B470A0EF2C3F97AA5EB0BBF95C1; ABTEST=0|1680917938|v1; SUID=8F7B1C682B83A20A000000006430C5B2; PHPSESSID=le2lak0vghad5c98ijd3t51ls4; IPLOC=USUS5'; diff --git a/lib/routes/wechat/tgchannel.ts b/lib/routes/wechat/tgchannel.ts index aad149517f..b7aa7399d5 100644 --- a/lib/routes/wechat/tgchannel.ts +++ b/lib/routes/wechat/tgchannel.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { finishArticleItem } from '@/utils/wechat-mp'; export const route: Route = { diff --git a/lib/routes/wechat/uread.ts b/lib/routes/wechat/uread.ts index 5e61f62fb0..492b79212d 100644 --- a/lib/routes/wechat/uread.ts +++ b/lib/routes/wechat/uread.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/uread/:userid', diff --git a/lib/routes/wechat/wechat2rss.ts b/lib/routes/wechat/wechat2rss.ts index af74a81b3d..f518268c93 100644 --- a/lib/routes/wechat/wechat2rss.ts +++ b/lib/routes/wechat/wechat2rss.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import parser from '@/utils/rss-parser'; +import type { Route } from '@/types'; import { parseDate } from '@/utils/parse-date'; +import parser from '@/utils/rss-parser'; import { finishArticleItem } from '@/utils/wechat-mp'; export const route: Route = { diff --git a/lib/routes/weekendhk/posts.ts b/lib/routes/weekendhk/posts.ts index d642a4c6c0..86ae64b7d8 100644 --- a/lib/routes/weekendhk/posts.ts +++ b/lib/routes/weekendhk/posts.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/weibo/friends.ts b/lib/routes/weibo/friends.ts index c14ec94b8a..dbc04bf378 100644 --- a/lib/routes/weibo/friends.ts +++ b/lib/routes/weibo/friends.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import querystring from 'node:querystring'; -import got from '@/utils/got'; + import { config } from '@/config'; -import weiboUtils from './utils'; -import { fallback, queryToBoolean } from '@/utils/readable-social'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { fallback, queryToBoolean } from '@/utils/readable-social'; + +import weiboUtils from './utils'; export const route: Route = { path: '/friends/:routeParams?', diff --git a/lib/routes/weibo/group.ts b/lib/routes/weibo/group.ts index 74e79e6363..80f6573735 100644 --- a/lib/routes/weibo/group.ts +++ b/lib/routes/weibo/group.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import querystring from 'node:querystring'; -import got from '@/utils/got'; + import { config } from '@/config'; -import weiboUtils from './utils'; -import { fallback, queryToBoolean } from '@/utils/readable-social'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { fallback, queryToBoolean } from '@/utils/readable-social'; + +import weiboUtils from './utils'; export const route: Route = { path: '/group/:gid/:gname?/:routeParams?', diff --git a/lib/routes/weibo/keyword.ts b/lib/routes/weibo/keyword.ts index 0084b515b1..97358cb4dd 100644 --- a/lib/routes/weibo/keyword.ts +++ b/lib/routes/weibo/keyword.ts @@ -1,11 +1,14 @@ -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; import querystring from 'node:querystring'; -import got from '@/utils/got'; -import weiboUtils from './utils'; -import timezone from '@/utils/timezone'; -import { fallback, queryToBoolean } from '@/utils/readable-social'; + import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { fallback, queryToBoolean } from '@/utils/readable-social'; +import timezone from '@/utils/timezone'; + +import weiboUtils from './utils'; export const route: Route = { path: '/keyword/:keyword/:routeParams?', diff --git a/lib/routes/weibo/oasis/user.ts b/lib/routes/weibo/oasis/user.ts index e277be3864..44f7b110df 100644 --- a/lib/routes/weibo/oasis/user.ts +++ b/lib/routes/weibo/oasis/user.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import buildData from '@/utils/common-config'; + import weiboUtils from '../utils'; export const route: Route = { diff --git a/lib/routes/weibo/search/hot.ts b/lib/routes/weibo/search/hot.ts index f43192db06..dc5912ba8e 100644 --- a/lib/routes/weibo/search/hot.ts +++ b/lib/routes/weibo/search/hot.ts @@ -1,11 +1,14 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { config } from '@/config'; import { art } from '@/utils/render'; -import { load } from 'cheerio'; -import path from 'node:path'; + import weiboUtils from '../utils'; // Default hide all picture diff --git a/lib/routes/weibo/super-index.ts b/lib/routes/weibo/super-index.ts index a8f3730655..6aaed19b03 100644 --- a/lib/routes/weibo/super-index.ts +++ b/lib/routes/weibo/super-index.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import queryString from 'query-string'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; + import weiboUtils from './utils'; -import queryString from 'query-string'; -import { config } from '@/config'; export const route: Route = { path: '/super_index/:id/:type?/:routeParams?', diff --git a/lib/routes/weibo/timeline.ts b/lib/routes/weibo/timeline.ts index 2bdb2c474a..6ab9321410 100644 --- a/lib/routes/weibo/timeline.ts +++ b/lib/routes/weibo/timeline.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import querystring from 'node:querystring'; + +import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; -import weiboUtils from './utils'; import { fallback, queryToBoolean } from '@/utils/readable-social'; +import weiboUtils from './utils'; + export const route: Route = { path: '/timeline/:uid/:feature?/:routeParams?', categories: ['social-media'], diff --git a/lib/routes/weibo/user-bookmarks.ts b/lib/routes/weibo/user-bookmarks.ts index 099e3a7101..4369072805 100644 --- a/lib/routes/weibo/user-bookmarks.ts +++ b/lib/routes/weibo/user-bookmarks.ts @@ -1,13 +1,15 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import querystring from 'node:querystring'; -import got from '@/utils/got'; + import { config } from '@/config'; -import weiboUtils from './utils'; -import timezone from '@/utils/timezone'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { fallback, queryToBoolean } from '@/utils/readable-social'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; +import timezone from '@/utils/timezone'; + +import weiboUtils from './utils'; export const route: Route = { path: '/user_bookmarks/:uid/:routeParams?', diff --git a/lib/routes/weibo/user.ts b/lib/routes/weibo/user.ts index 945c318f0e..9daf7a2a0c 100644 --- a/lib/routes/weibo/user.ts +++ b/lib/routes/weibo/user.ts @@ -1,12 +1,15 @@ -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; import querystring from 'node:querystring'; -import got from '@/utils/got'; -import weiboUtils from './utils'; + import { config } from '@/config'; -import timezone from '@/utils/timezone'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { fallback, queryToBoolean } from '@/utils/readable-social'; +import timezone from '@/utils/timezone'; + +import weiboUtils from './utils'; export const route: Route = { path: '/user/:uid/:routeParams?', diff --git a/lib/routes/weibo/utils.ts b/lib/routes/weibo/utils.ts index fd3c881ef0..3c553ff8c2 100644 --- a/lib/routes/weibo/utils.ts +++ b/lib/routes/weibo/utils.ts @@ -1,11 +1,13 @@ -import cache from '@/utils/cache'; +import querystring from 'node:querystring'; + +import { load } from 'cheerio'; + import { config } from '@/config'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import logger from '@/utils/logger'; import { getPuppeteerPage } from '@/utils/puppeteer'; import { getCookies } from '@/utils/puppeteer-utils'; -import logger from '@/utils/logger'; -import querystring from 'node:querystring'; -import got from '@/utils/got'; -import { load } from 'cheerio'; import { fallback, queryToBoolean, queryToInteger } from '@/utils/readable-social'; class RenewWeiboCookiesError extends Error { diff --git a/lib/routes/wellcee/rent.ts b/lib/routes/wellcee/rent.ts index ef84849b52..612f40a499 100644 --- a/lib/routes/wellcee/rent.ts +++ b/lib/routes/wellcee/rent.ts @@ -1,13 +1,15 @@ -import { Route } from '@/types'; -import type { Context } from 'hono'; -import { District, House } from './types'; +import path from 'node:path'; +import type { Context } from 'hono'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { baseUrl, getCitys, getDistricts } from './utils'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; import { art } from '@/utils/render'; -import path from 'node:path'; + +import type { District, House } from './types'; +import { baseUrl, getCitys, getDistricts } from './utils'; const render = (data) => art(path.join(__dirname, 'templates/house.art'), data); diff --git a/lib/routes/wellcee/support-city.ts b/lib/routes/wellcee/support-city.ts index 2b0b88d9b7..f9eb6e1ea5 100644 --- a/lib/routes/wellcee/support-city.ts +++ b/lib/routes/wellcee/support-city.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; import type { Context } from 'hono'; +import type { Route } from '@/types'; + import { baseUrl, getCitys, getDistricts } from './utils'; export const route: Route = { diff --git a/lib/routes/wellcee/utils.ts b/lib/routes/wellcee/utils.ts index f10baf402c..a3aad5d15a 100644 --- a/lib/routes/wellcee/utils.ts +++ b/lib/routes/wellcee/utils.ts @@ -1,8 +1,8 @@ -import { City, District } from './types'; - -import ofetch from '@/utils/ofetch'; -import cache from '@/utils/cache'; import { config } from '@/config'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + +import type { City, District } from './types'; export const baseUrl = 'https://www.wellcee.com'; export const getCitys = () => diff --git a/lib/routes/wenku8/chapter.ts b/lib/routes/wenku8/chapter.ts index a07ea3f1c7..7e1046de22 100644 --- a/lib/routes/wenku8/chapter.ts +++ b/lib/routes/wenku8/chapter.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/chapter/:id', categories: ['reading'], diff --git a/lib/routes/wenku8/index.ts b/lib/routes/wenku8/index.ts index 40267d0adc..73109a6f1c 100644 --- a/lib/routes/wenku8/index.ts +++ b/lib/routes/wenku8/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; + import { config } from '@/config'; +import type { Route } from '@/types'; +import got from '@/utils/got'; const cateUrlMap = { lastupdate: 'https://www.wenku8.net/modules/article/toplist.php?sort=lastupdate', diff --git a/lib/routes/wenku8/volume.ts b/lib/routes/wenku8/volume.ts index ddb1b9920c..723abaa996 100644 --- a/lib/routes/wenku8/volume.ts +++ b/lib/routes/wenku8/volume.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import { decode } from 'iconv-lite'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + export const route: Route = { path: '/volume/:id', categories: ['reading'], diff --git a/lib/routes/wfdf/news.ts b/lib/routes/wfdf/news.ts index 4d3e901e4d..c9ea5616f0 100644 --- a/lib/routes/wfdf/news.ts +++ b/lib/routes/wfdf/news.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/wfu/jwc.ts b/lib/routes/wfu/jwc.ts index 38100a5a2f..3b56481f9a 100644 --- a/lib/routes/wfu/jwc.ts +++ b/lib/routes/wfu/jwc.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + // 参考 whu/news 武汉大学页面写成 const baseUrl = 'https://jwc.wfu.edu.cn/3742/list.htm'; diff --git a/lib/routes/wfu/news.ts b/lib/routes/wfu/news.ts index c049730df3..c1945c2a70 100644 --- a/lib/routes/wfu/news.ts +++ b/lib/routes/wfu/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/whitehouse/news.ts b/lib/routes/whitehouse/news.ts index 9e347a2960..8e6413bd34 100644 --- a/lib/routes/whitehouse/news.ts +++ b/lib/routes/whitehouse/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/who/news-room.ts b/lib/routes/who/news-room.ts index 6763c3c47c..24ad2c4537 100644 --- a/lib/routes/who/news-room.ts +++ b/lib/routes/who/news-room.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/who/news.ts b/lib/routes/who/news.ts index 05bfc2451d..6395ad5e67 100644 --- a/lib/routes/who/news.ts +++ b/lib/routes/who/news.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/who/speeches.ts b/lib/routes/who/speeches.ts index 6855b2795c..60d65e8c70 100644 --- a/lib/routes/who/speeches.ts +++ b/lib/routes/who/speeches.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/whu/cs.ts b/lib/routes/whu/cs.ts index 6cc6092730..61e4f2efda 100644 --- a/lib/routes/whu/cs.ts +++ b/lib/routes/whu/cs.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { load } from 'cheerio'; const baseUrl = 'https://cs.whu.edu.cn'; diff --git a/lib/routes/whu/gs/index.ts b/lib/routes/whu/gs/index.ts index 22eb4575f0..2716297e19 100644 --- a/lib/routes/whu/gs/index.ts +++ b/lib/routes/whu/gs/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const gsIndexMap = new Map([ diff --git a/lib/routes/whu/hyxt.ts b/lib/routes/whu/hyxt.ts index f89fc8f0d5..f8162d541b 100644 --- a/lib/routes/whu/hyxt.ts +++ b/lib/routes/whu/hyxt.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { domain, processMeta, getMeta, processItems } from './util'; +import { domain, getMeta, processItems, processMeta } from './util'; export const route: Route = { path: '/hyxt/:category{.+}?', diff --git a/lib/routes/whu/news.ts b/lib/routes/whu/news.ts index b6fa154c04..dd2c9461c7 100644 --- a/lib/routes/whu/news.ts +++ b/lib/routes/whu/news.ts @@ -1,13 +1,14 @@ -import { Route } from '@/types'; - -import cache from '@/utils/cache'; -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import { art } from '@/utils/render'; import path from 'node:path'; -import { domain, processMeta, getMeta, processItems } from './util'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; + +import { domain, getMeta, processItems, processMeta } from './util'; export const route: Route = { path: '/news/:category{.+}?', diff --git a/lib/routes/whu/rsgis.ts b/lib/routes/whu/rsgis.ts index 3eaaff9664..0893164d87 100644 --- a/lib/routes/whu/rsgis.ts +++ b/lib/routes/whu/rsgis.ts @@ -1,10 +1,12 @@ -import { Route, DataItem } from '@/types'; +import type { AnyNode, Cheerio} from 'cheerio'; +import { load } from 'cheerio'; +import type { Context } from 'hono'; + +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load, Cheerio, AnyNode } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { Context } from 'hono'; -import cache from '@/utils/cache'; interface Post extends DataItem { external: boolean; diff --git a/lib/routes/whu/swrh.ts b/lib/routes/whu/swrh.ts index 7af1dc1db6..ab73c20b97 100644 --- a/lib/routes/whu/swrh.ts +++ b/lib/routes/whu/swrh.ts @@ -1,10 +1,11 @@ // 修改自计算机学院route -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; // import { parseDate } from '@/utils/parse-date'; // import timezone from '@/utils/timezone'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { fetchArticle } from '@/utils/wechat-mp'; const baseUrl = 'https://swrh.whu.edu.cn'; diff --git a/lib/routes/whu/util.ts b/lib/routes/whu/util.ts index 4e7a3c9100..b7557c8400 100644 --- a/lib/routes/whu/util.ts +++ b/lib/routes/whu/util.ts @@ -1,9 +1,11 @@ -import got from '@/utils/got'; +import path from 'node:path'; + import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; const domain = 'whu.edu.cn'; @@ -137,4 +139,4 @@ const processItems = async (items, tryGet, rootUrl) => }) ); -export { domain, processMeta, getMeta, processItems }; +export { domain, getMeta, processItems, processMeta }; diff --git a/lib/routes/wiensued/index.ts b/lib/routes/wiensued/index.ts index eb48e84dce..cd70d318bb 100644 --- a/lib/routes/wiensued/index.ts +++ b/lib/routes/wiensued/index.ts @@ -1,7 +1,8 @@ import { load } from 'cheerio'; + +import type { Data, DataItem, Route } from '@/types'; import { getSubPath } from '@/utils/common-utils'; import ofetch from '@/utils/ofetch'; -import type { Data, DataItem, Route } from '@/types'; const FEED_LANGUAGE = 'de' as const; const FEED_LOGO = 'https://www.wiensued.at/wp-content/uploads/logo_wiensued_ohneclaim.svg'; diff --git a/lib/routes/wikinews/index.ts b/lib/routes/wikinews/index.ts index 454cbce7bc..1ccb16ab88 100644 --- a/lib/routes/wikinews/index.ts +++ b/lib/routes/wikinews/index.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -const currentURL = 'https://zh.wikinews.org/wiki/Special:%E6%96%B0%E9%97%BB%E8%AE%A2%E9%98%85'; import { parseDate } from '@/utils/parse-date'; +const currentURL = 'https://zh.wikinews.org/wiki/Special:%E6%96%B0%E9%97%BB%E8%AE%A2%E9%98%85'; + export const route: Route = { path: '/latest', categories: ['new-media'], diff --git a/lib/routes/wikipedia/current-events.ts b/lib/routes/wikipedia/current-events.ts index 7edd739413..427e1e9316 100644 --- a/lib/routes/wikipedia/current-events.ts +++ b/lib/routes/wikipedia/current-events.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { config } from '@/config'; /* The different ways to query Wikipedia's Current Events diff --git a/lib/routes/windsurf/blog.ts b/lib/routes/windsurf/blog.ts index c3b2ec77e6..b63a15b3f4 100644 --- a/lib/routes/windsurf/blog.ts +++ b/lib/routes/windsurf/blog.ts @@ -1,12 +1,12 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import { art } from '@/utils/render'; -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; +import path from 'node:path'; import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; -import path from 'node:path'; + +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '10', 10); diff --git a/lib/routes/windsurf/changelog.ts b/lib/routes/windsurf/changelog.ts index fce45ddb93..249705fa2a 100644 --- a/lib/routes/windsurf/changelog.ts +++ b/lib/routes/windsurf/changelog.ts @@ -1,12 +1,11 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; - -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + export const handler = async (ctx: Context): Promise => { const limit: number = Number.parseInt(ctx.req.query('limit') ?? '100', 10); diff --git a/lib/routes/winstall/update.ts b/lib/routes/winstall/update.ts index 2269edea56..49320057ba 100644 --- a/lib/routes/winstall/update.ts +++ b/lib/routes/winstall/update.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { config } from '@/config'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:appId', diff --git a/lib/routes/wired/tag.ts b/lib/routes/wired/tag.ts index 8347d7d199..60b4c5c443 100644 --- a/lib/routes/wired/tag.ts +++ b/lib/routes/wired/tag.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import * as cheerio from 'cheerio'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import * as cheerio from 'cheerio'; -import { Item } from './types'; import { parseDate } from '@/utils/parse-date'; +import type { Item } from './types'; + export const route: Route = { path: '/tag/:tag', example: '/wired/tag/facebook', diff --git a/lib/routes/wise/pair.ts b/lib/routes/wise/pair.ts index 628a19f63c..352b4adc8f 100644 --- a/lib/routes/wise/pair.ts +++ b/lib/routes/wise/pair.ts @@ -1,13 +1,15 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import dayjs from 'dayjs'; +import customParseFormat from 'dayjs/plugin/customParseFormat.js'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import dayjs from 'dayjs'; -import customParseFormat from 'dayjs/plugin/customParseFormat.js'; -dayjs.extend(customParseFormat); import { art } from '@/utils/render'; -import path from 'node:path'; + +dayjs.extend(customParseFormat); const renderDesc = (content) => art(path.join(__dirname, 'templates/description.art'), content); export const route: Route = { diff --git a/lib/routes/withgoogle/explorables.ts b/lib/routes/withgoogle/explorables.ts index 4dd5489156..cbbf96af87 100644 --- a/lib/routes/withgoogle/explorables.ts +++ b/lib/routes/withgoogle/explorables.ts @@ -1,7 +1,8 @@ -import type { Route, DataItem } from '@/types'; +import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; export const route: Route = { name: 'PAIR - AI Exploreables', diff --git a/lib/routes/wizfile/index.ts b/lib/routes/wizfile/index.ts index 4ee9cfe142..81e82eef44 100644 --- a/lib/routes/wizfile/index.ts +++ b/lib/routes/wizfile/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const rootUrl = 'https://antibody-software.com'; diff --git a/lib/routes/wmc-bj/publish.ts b/lib/routes/wmc-bj/publish.ts index 9bf21090c7..ec56268ddf 100644 --- a/lib/routes/wmc-bj/publish.ts +++ b/lib/routes/wmc-bj/publish.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/publish/:category{.+}?', diff --git a/lib/routes/wmpvp/index.ts b/lib/routes/wmpvp/index.ts index 52adb09734..ea8b3e9594 100644 --- a/lib/routes/wmpvp/index.ts +++ b/lib/routes/wmpvp/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/wnacg/category.ts b/lib/routes/wnacg/category.ts index c1bc7c3867..f520ed2051 100644 --- a/lib/routes/wnacg/category.ts +++ b/lib/routes/wnacg/category.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { handler } from './common'; export const route: Route = { diff --git a/lib/routes/wnacg/common.ts b/lib/routes/wnacg/common.ts index 4923d1f789..600a615ea7 100644 --- a/lib/routes/wnacg/common.ts +++ b/lib/routes/wnacg/common.ts @@ -1,10 +1,12 @@ +import path from 'node:path'; + +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; const categories = { 1: '同人誌 漢化', diff --git a/lib/routes/wnacg/index.ts b/lib/routes/wnacg/index.ts index 215cfd1fc7..03ef279808 100644 --- a/lib/routes/wnacg/index.ts +++ b/lib/routes/wnacg/index.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { handler } from './common'; export const route: Route = { diff --git a/lib/routes/wnacg/tag.ts b/lib/routes/wnacg/tag.ts index 27f3e0b62d..8db6f41d00 100644 --- a/lib/routes/wnacg/tag.ts +++ b/lib/routes/wnacg/tag.ts @@ -1,4 +1,5 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { handler } from './common'; export const route: Route = { diff --git a/lib/routes/wohnnet/index.ts b/lib/routes/wohnnet/index.ts index 35ecf13942..9cbed18778 100644 --- a/lib/routes/wohnnet/index.ts +++ b/lib/routes/wohnnet/index.ts @@ -1,6 +1,7 @@ import { load } from 'cheerio'; -import ofetch from '@/utils/ofetch'; + import type { Data, DataItem, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; const FEED_TITLE = 'wohnnet.at' as const; const FEED_LOGO = 'https://www.wohnnet.at/media/images/wohnnet/icon_192_192.png' as const; diff --git a/lib/routes/wordpress/index.ts b/lib/routes/wordpress/index.ts index fe5db34701..812ead699b 100644 --- a/lib/routes/wordpress/index.ts +++ b/lib/routes/wordpress/index.ts @@ -1,11 +1,11 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import parser from '@/utils/rss-parser'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import parser from '@/utils/rss-parser'; import { apiSlug, bakeFilterSearchParams, bakeFiltersWithPair, bakeUrl, fetchData, getFilterParamsForUrl, parseFilterStr } from './util'; diff --git a/lib/routes/wordpress/util.ts b/lib/routes/wordpress/util.ts index c57cfffa20..3b0f021944 100644 --- a/lib/routes/wordpress/util.ts +++ b/lib/routes/wordpress/util.ts @@ -1,6 +1,7 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; +import got from '@/utils/got'; + const apiSlug = 'wp-json/wp/v2'; interface Filter { diff --git a/lib/routes/worldjournal/index.ts b/lib/routes/worldjournal/index.ts index f83aa98a61..7051150a90 100644 --- a/lib/routes/worldjournal/index.ts +++ b/lib/routes/worldjournal/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/worldofwarships/devblog.ts b/lib/routes/worldofwarships/devblog.ts index a8e7fd4793..523776f985 100644 --- a/lib/routes/worldofwarships/devblog.ts +++ b/lib/routes/worldofwarships/devblog.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import cache from '@/utils/cache'; export const route: Route = { path: '/devblog', diff --git a/lib/routes/woshipm/popular.ts b/lib/routes/woshipm/popular.ts index ff1045ffc7..d4d279bbab 100644 --- a/lib/routes/woshipm/popular.ts +++ b/lib/routes/woshipm/popular.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { baseUrl, parseArticle } from './utils'; const rangeMap = { diff --git a/lib/routes/woshipm/user-article.ts b/lib/routes/woshipm/user-article.ts index d85c757e31..ad894aa9ba 100644 --- a/lib/routes/woshipm/user-article.ts +++ b/lib/routes/woshipm/user-article.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + import { baseUrl, parseArticle } from './utils'; export const route: Route = { diff --git a/lib/routes/woshipm/utils.ts b/lib/routes/woshipm/utils.ts index c1f1a16b34..c81cd549f0 100644 --- a/lib/routes/woshipm/utils.ts +++ b/lib/routes/woshipm/utils.ts @@ -1,6 +1,7 @@ -import got from '@/utils/got'; import { load } from 'cheerio'; +import got from '@/utils/got'; + const baseUrl = 'https://www.woshipm.com'; const parseArticle = (item, tryGet) => diff --git a/lib/routes/woshipm/wen.ts b/lib/routes/woshipm/wen.ts index a0c3e91cc6..7bcc111828 100644 --- a/lib/routes/woshipm/wen.ts +++ b/lib/routes/woshipm/wen.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -const baseUrl = 'https://wen.woshipm.com'; import { parseRelativeDate } from '@/utils/parse-date'; +const baseUrl = 'https://wen.woshipm.com'; + export const route: Route = { path: '/wen', categories: ['new-media'], diff --git a/lib/routes/wsj/news.ts b/lib/routes/wsj/news.ts index e64dc2001e..c48d9ee5cf 100644 --- a/lib/routes/wsj/news.ts +++ b/lib/routes/wsj/news.ts @@ -1,8 +1,11 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseArticle } from './utils'; import pMap from 'p-map'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; + +import { parseArticle } from './utils'; + const hostMap = { 'en-us': 'https://www.wsj.com', 'zh-cn': 'https://cn.wsj.com/zh-hans', diff --git a/lib/routes/wsj/utils.ts b/lib/routes/wsj/utils.ts index 11391f259e..37fdee0116 100644 --- a/lib/routes/wsj/utils.ts +++ b/lib/routes/wsj/utils.ts @@ -1,10 +1,12 @@ -import cache from '@/utils/cache'; +import path from 'node:path'; + import { load } from 'cheerio'; + +import cache from '@/utils/cache'; import got from '@/utils/got'; +import { PRESETS } from '@/utils/header-generator'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { PRESETS } from '@/utils/header-generator'; const parseArticle = (item) => cache.tryGet(item.link, async () => { diff --git a/lib/routes/wsyu/news.ts b/lib/routes/wsyu/news.ts index 81f8def2ee..ba881bceae 100644 --- a/lib/routes/wsyu/news.ts +++ b/lib/routes/wsyu/news.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import * as url from 'node:url'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import * as url from 'node:url'; const baseUrl = 'http://www.wsyu.edu.cn'; diff --git a/lib/routes/wtu/index.ts b/lib/routes/wtu/index.ts index 216fbcb12c..ca8da1547c 100644 --- a/lib/routes/wtu/index.ts +++ b/lib/routes/wtu/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/wtu/job.ts b/lib/routes/wtu/job.ts index d732edb012..87e2b1ae91 100644 --- a/lib/routes/wtu/job.ts +++ b/lib/routes/wtu/job.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import zlib from 'node:zlib'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import zlib from 'node:zlib'; -import { load } from 'cheerio'; const baseUrl = 'https://wtu.91wllm.com/'; diff --git a/lib/routes/wufazhuce/one.ts b/lib/routes/wufazhuce/one.ts index 72e4407ad2..3b78b83dbc 100644 --- a/lib/routes/wufazhuce/one.ts +++ b/lib/routes/wufazhuce/one.ts @@ -1,5 +1,6 @@ -import { Route, Data, DataItem } from '@/types'; import { load } from 'cheerio'; + +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; diff --git a/lib/routes/wyzxwk/article.ts b/lib/routes/wyzxwk/article.ts index 33f0a8de4c..c5193c9565 100644 --- a/lib/routes/wyzxwk/article.ts +++ b/lib/routes/wyzxwk/article.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/wzu/news.ts b/lib/routes/wzu/news.ts index 2080b1fe16..3df1849693 100644 --- a/lib/routes/wzu/news.ts +++ b/lib/routes/wzu/news.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { URL } from 'node:url'; + +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { URL } from 'node:url'; import { parseDate } from '@/utils/parse-date'; /* 新闻列表 diff --git a/lib/routes/x-mol/news.ts b/lib/routes/x-mol/news.ts index 22ec371da1..a05e06d328 100644 --- a/lib/routes/x-mol/news.ts +++ b/lib/routes/x-mol/news.ts @@ -1,13 +1,15 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import utils from './utils'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; + +import utils from './utils'; export const route: Route = { path: '/news/:tag?', diff --git a/lib/routes/x-mol/paper.ts b/lib/routes/x-mol/paper.ts index 079283874b..e1116179e5 100644 --- a/lib/routes/x-mol/paper.ts +++ b/lib/routes/x-mol/paper.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import pMap from 'p-map'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import utils from './utils'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import pMap from 'p-map'; + +import utils from './utils'; export const route: Route = { path: '/paper/:type/:magazine', diff --git a/lib/routes/x6d/index.ts b/lib/routes/x6d/index.ts index b845333dc8..7dafb6f3d1 100644 --- a/lib/routes/x6d/index.ts +++ b/lib/routes/x6d/index.ts @@ -1,10 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/:id?', diff --git a/lib/routes/xaufe/jiaowu.ts b/lib/routes/xaufe/jiaowu.ts index d478b7d889..6922c7a963 100644 --- a/lib/routes/xaufe/jiaowu.ts +++ b/lib/routes/xaufe/jiaowu.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; // Yep http is bad, but I had no choice :( const rootMeta = { diff --git a/lib/routes/xaut/index.ts b/lib/routes/xaut/index.ts index ff6d9d66ee..395cd3be32 100644 --- a/lib/routes/xaut/index.ts +++ b/lib/routes/xaut/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/index/:category?', diff --git a/lib/routes/xaut/jwc.ts b/lib/routes/xaut/jwc.ts index 108edf0148..0bfc7b8381 100644 --- a/lib/routes/xaut/jwc.ts +++ b/lib/routes/xaut/jwc.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; export const route: Route = { path: '/jwc/:category?', diff --git a/lib/routes/xaut/rsc.ts b/lib/routes/xaut/rsc.ts index a6be2a12d2..3c1af4ed9a 100644 --- a/lib/routes/xaut/rsc.ts +++ b/lib/routes/xaut/rsc.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; export const route: Route = { path: '/rsc/:category?', diff --git a/lib/routes/xbmu/academic.ts b/lib/routes/xbmu/academic.ts index adc99f71b0..797852af12 100644 --- a/lib/routes/xbmu/academic.ts +++ b/lib/routes/xbmu/academic.ts @@ -1,8 +1,9 @@ -import { DataItem, Route } from '@/types'; +import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; const BASE_URL = 'https://www.xbmu.edu.cn/xwzx/xsxx.htm'; diff --git a/lib/routes/xbmu/announcement.ts b/lib/routes/xbmu/announcement.ts index 56d4486c0a..5c5ff50e3d 100644 --- a/lib/routes/xbmu/announcement.ts +++ b/lib/routes/xbmu/announcement.ts @@ -1,8 +1,9 @@ -import { DataItem, Route } from '@/types'; +import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; const BASE_URL = 'https://www.xbmu.edu.cn/xwzx/tzgg.htm'; diff --git a/lib/routes/xbookcn/blog.ts b/lib/routes/xbookcn/blog.ts index 125bba5f88..9b6f98c70f 100644 --- a/lib/routes/xbookcn/blog.ts +++ b/lib/routes/xbookcn/blog.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; export const route: Route = { path: '/:label?', // 路由路径 diff --git a/lib/routes/xboxfan/news.ts b/lib/routes/xboxfan/news.ts index 65206e7a4a..fb4c4d1264 100644 --- a/lib/routes/xboxfan/news.ts +++ b/lib/routes/xboxfan/news.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseRelativeDate } from '@/utils/parse-date'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import md5 from '@/utils/md5'; +import { parseRelativeDate } from '@/utils/parse-date'; export const route: Route = { path: '/news', diff --git a/lib/routes/xianbao/index.ts b/lib/routes/xianbao/index.ts index 8bba25832d..20864188f7 100644 --- a/lib/routes/xianbao/index.ts +++ b/lib/routes/xianbao/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/xiaoheihe/add2cart.ts b/lib/routes/xiaoheihe/add2cart.ts index 2bdbfea033..d6c5b5c36b 100644 --- a/lib/routes/xiaoheihe/add2cart.ts +++ b/lib/routes/xiaoheihe/add2cart.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/xiaoheihe/discount.ts b/lib/routes/xiaoheihe/discount.ts index 82ff45b028..5e8d054140 100644 --- a/lib/routes/xiaoheihe/discount.ts +++ b/lib/routes/xiaoheihe/discount.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; + import { calculate } from './util'; export const route: Route = { diff --git a/lib/routes/xiaoheihe/news.ts b/lib/routes/xiaoheihe/news.ts index 9c2e503168..cddb0f3bb6 100644 --- a/lib/routes/xiaoheihe/news.ts +++ b/lib/routes/xiaoheihe/news.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { calculate } from './util'; export const route: Route = { diff --git a/lib/routes/xiaoheihe/user.ts b/lib/routes/xiaoheihe/user.ts index 3de2305771..d708a51bc3 100644 --- a/lib/routes/xiaoheihe/user.ts +++ b/lib/routes/xiaoheihe/user.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { calculate } from './util'; export const route: Route = { diff --git a/lib/routes/xiaohongshu/board.ts b/lib/routes/xiaohongshu/board.ts index 17d7c9c3e5..ac7b51e4d4 100644 --- a/lib/routes/xiaohongshu/board.ts +++ b/lib/routes/xiaohongshu/board.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; + import { getBoard } from './util'; export const route: Route = { diff --git a/lib/routes/xiaohongshu/check-cookie.ts b/lib/routes/xiaohongshu/check-cookie.ts index 86eecffedb..61a5f1aa68 100644 --- a/lib/routes/xiaohongshu/check-cookie.ts +++ b/lib/routes/xiaohongshu/check-cookie.ts @@ -1,4 +1,5 @@ -import { APIRoute } from '@/types'; +import type { APIRoute } from '@/types'; + import { checkCookie } from './util'; export const apiRoute: APIRoute = { diff --git a/lib/routes/xiaohongshu/user.ts b/lib/routes/xiaohongshu/user.ts index 3a71e5910a..ff772e3ed0 100644 --- a/lib/routes/xiaohongshu/user.ts +++ b/lib/routes/xiaohongshu/user.ts @@ -1,10 +1,14 @@ -import { Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; import querystring from 'node:querystring'; -import { getUser, renderNotesFulltext, getUserWithCookie } from './util'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; + import { config } from '@/config'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; import { fallback, queryToBoolean } from '@/utils/readable-social'; + +import { getUser, getUserWithCookie, renderNotesFulltext } from './util'; + export const route: Route = { path: '/user/:user_id/:category/:routeParams?', name: '用户笔记/收藏', diff --git a/lib/routes/xiaohongshu/util.ts b/lib/routes/xiaohongshu/util.ts index 70a5144330..91a1f6210b 100644 --- a/lib/routes/xiaohongshu/util.ts +++ b/lib/routes/xiaohongshu/util.ts @@ -1,11 +1,12 @@ +import { load } from 'cheerio'; + import { config } from '@/config'; +import CaptchaError from '@/errors/types/captcha'; +import cache from '@/utils/cache'; import logger from '@/utils/logger'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import puppeteer, { getPuppeteerPage } from '@/utils/puppeteer'; -import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; -import cache from '@/utils/cache'; -import CaptchaError from '@/errors/types/captcha'; // Common headers for requests const getHeaders = (cookie?: string) => ({ @@ -282,4 +283,4 @@ async function checkCookie() { return res.code === 0 && !!res.data.user_id; } -export { getUser, getBoard, formatText, formatNote, renderNotesFulltext, getFullNote, getUserWithCookie, checkCookie }; +export { checkCookie, formatNote, formatText, getBoard, getFullNote, getUser, getUserWithCookie, renderNotesFulltext }; diff --git a/lib/routes/xiaomiyoupin/crowdfunding.ts b/lib/routes/xiaomiyoupin/crowdfunding.ts index 5070b9cd95..54178e4fb7 100644 --- a/lib/routes/xiaomiyoupin/crowdfunding.ts +++ b/lib/routes/xiaomiyoupin/crowdfunding.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; const base_url = 'https://m.xiaomiyoupin.com'; export const route: Route = { diff --git a/lib/routes/xiaomiyoupin/latest.ts b/lib/routes/xiaomiyoupin/latest.ts index 7a65134251..fdfbd45f7d 100644 --- a/lib/routes/xiaomiyoupin/latest.ts +++ b/lib/routes/xiaomiyoupin/latest.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import { parseModule, parseFloorItem } from './utils'; + +import { parseFloorItem, parseModule } from './utils'; export const route: Route = { path: '/latest', diff --git a/lib/routes/xiaomiyoupin/utils.ts b/lib/routes/xiaomiyoupin/utils.ts index c2bf17fcdb..903f45abf6 100644 --- a/lib/routes/xiaomiyoupin/utils.ts +++ b/lib/routes/xiaomiyoupin/utils.ts @@ -1,6 +1,7 @@ -import { art } from '@/utils/render'; import path from 'node:path'; +import { art } from '@/utils/render'; + const parseModule = (floors, module_key) => floors.find((floor) => floor.module_key === module_key); const parseFloorItem = (floor) => @@ -15,4 +16,4 @@ const parseFloorItem = (floor) => }; }); -export { parseModule, parseFloorItem }; +export { parseFloorItem, parseModule }; diff --git a/lib/routes/xiaote/index.ts b/lib/routes/xiaote/index.ts index 34819d1b24..d961b8c18f 100644 --- a/lib/routes/xiaote/index.ts +++ b/lib/routes/xiaote/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; // 自订的 got import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/xiaoyuzhou/pickup.ts b/lib/routes/xiaoyuzhou/pickup.ts index 2c0aef6df5..44843a0630 100644 --- a/lib/routes/xiaoyuzhou/pickup.ts +++ b/lib/routes/xiaoyuzhou/pickup.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { config } from '@/config'; const XIAOYUZHOU_ITEMS = 'xiaoyuzhou_items'; diff --git a/lib/routes/xiaoyuzhou/podcast.ts b/lib/routes/xiaoyuzhou/podcast.ts index a028cd7664..04033f10b0 100644 --- a/lib/routes/xiaoyuzhou/podcast.ts +++ b/lib/routes/xiaoyuzhou/podcast.ts @@ -1,8 +1,10 @@ -import { DataItem, Route, ViewType } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { DataItem, Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/podcast/:id', diff --git a/lib/routes/xiaozhuanlan/column.ts b/lib/routes/xiaozhuanlan/column.ts index 3d1daa65ba..7a6266c5d8 100644 --- a/lib/routes/xiaozhuanlan/column.ts +++ b/lib/routes/xiaozhuanlan/column.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import MarkdownIt from 'markdown-it'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import MarkdownIt from 'markdown-it'; + const md = MarkdownIt({ linkify: true, }); diff --git a/lib/routes/xidian/cs.ts b/lib/routes/xidian/cs.ts index 2760f26378..87d71ef123 100644 --- a/lib/routes/xidian/cs.ts +++ b/lib/routes/xidian/cs.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://cs.xidian.edu.cn'; diff --git a/lib/routes/xidian/gr.ts b/lib/routes/xidian/gr.ts index 3ece8bee03..09c20a6902 100644 --- a/lib/routes/xidian/gr.ts +++ b/lib/routes/xidian/gr.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'https://gr.xidian.edu.cn'; diff --git a/lib/routes/xidian/jwc.ts b/lib/routes/xidian/jwc.ts index 60b4106849..2efaad3e5d 100644 --- a/lib/routes/xidian/jwc.ts +++ b/lib/routes/xidian/jwc.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const baseUrl = 'https://jwc.xidian.edu.cn'; export const route: Route = { diff --git a/lib/routes/ximalaya/album.ts b/lib/routes/ximalaya/album.ts index 248567fa1a..6d9b1902ef 100644 --- a/lib/routes/ximalaya/album.ts +++ b/lib/routes/ximalaya/album.ts @@ -1,12 +1,15 @@ -import { Route } from '@/types'; +import sanitizeHtml from 'sanitize-html'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { getRandom16, decryptUrl } from './utils'; -const baseUrl = 'https://www.ximalaya.com'; -import { config } from '@/config'; import { parseDate } from '@/utils/parse-date'; -import { Album, RichIntro, TrackInfoResponse } from './types'; -import sanitizeHtml from 'sanitize-html'; + +import type { Album, RichIntro, TrackInfoResponse } from './types'; +import { decryptUrl, getRandom16 } from './utils'; + +const baseUrl = 'https://www.ximalaya.com'; // Find category from: https://help.apple.com/itc/podcasts_connect/?lang=en#/itc9267a2f12 const categoryDict = { diff --git a/lib/routes/ximalaya/utils.ts b/lib/routes/ximalaya/utils.ts index ba03271e67..3abc57de12 100644 --- a/lib/routes/ximalaya/utils.ts +++ b/lib/routes/ximalaya/utils.ts @@ -165,4 +165,4 @@ const decryptUrl = (encryptedUrl) => { } return Buffer.from(decryptedData).toString('utf8'); }; -export { /* getUrl, */ getRandom16, decryptUrl }; +export { /* getUrl, */ decryptUrl, getRandom16 }; diff --git a/lib/routes/xinpianchang/index.ts b/lib/routes/xinpianchang/index.ts index 261d1bdcf1..60b7d355f7 100644 --- a/lib/routes/xinpianchang/index.ts +++ b/lib/routes/xinpianchang/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { rootUrl, getData, processItems } from './util'; + +import { getData, processItems, rootUrl } from './util'; export const route: Route = { path: ['/discover/:params?', '/:params?'], diff --git a/lib/routes/xinpianchang/rank.ts b/lib/routes/xinpianchang/rank.ts index 58ab8ad7d9..622132b4b1 100644 --- a/lib/routes/xinpianchang/rank.ts +++ b/lib/routes/xinpianchang/rank.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { rootUrl, getData, processItems } from './util'; +import { getData, processItems, rootUrl } from './util'; export const route: Route = { path: '/rank/:category?', diff --git a/lib/routes/xinpianchang/util.ts b/lib/routes/xinpianchang/util.ts index 79f38814d6..894b9d68e3 100644 --- a/lib/routes/xinpianchang/util.ts +++ b/lib/routes/xinpianchang/util.ts @@ -1,8 +1,10 @@ -import got from '@/utils/got'; +import path from 'node:path'; + import { load } from 'cheerio'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const appKey = '61a2f329348b3bf77'; @@ -102,4 +104,4 @@ const processItems = async (items, tryGet) => { ); }; -export { rootUrl, getData, processItems }; +export { getData, processItems, rootUrl }; diff --git a/lib/routes/xjtu/2yuan/news.ts b/lib/routes/xjtu/2yuan/news.ts index f97e56dd8b..9565c0b002 100644 --- a/lib/routes/xjtu/2yuan/news.ts +++ b/lib/routes/xjtu/2yuan/news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/2yuan/news/:id?', diff --git a/lib/routes/xjtu/dean.ts b/lib/routes/xjtu/dean.ts index 1a33098f1e..9222592526 100644 --- a/lib/routes/xjtu/dean.ts +++ b/lib/routes/xjtu/dean.ts @@ -1,7 +1,8 @@ -import { Route, Data, DataItem } from '@/types'; +import { load } from 'cheerio'; + +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/xjtu/dyyy/index.ts b/lib/routes/xjtu/dyyy/index.ts index ea21e62155..bcd7451b4a 100644 --- a/lib/routes/xjtu/dyyy/index.ts +++ b/lib/routes/xjtu/dyyy/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const baseUrl = 'http://www.dyyy.xjtu.edu.cn'; diff --git a/lib/routes/xjtu/ee-jzxx.ts b/lib/routes/xjtu/ee-jzxx.ts index b195e4f15e..d8c36523cd 100644 --- a/lib/routes/xjtu/ee-jzxx.ts +++ b/lib/routes/xjtu/ee-jzxx.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/xjtu/ee.ts b/lib/routes/xjtu/ee.ts index 1f245ef54f..92479f9045 100644 --- a/lib/routes/xjtu/ee.ts +++ b/lib/routes/xjtu/ee.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/xjtu/gs/tzgg.ts b/lib/routes/xjtu/gs/tzgg.ts index ac898ca70d..e076f6593e 100644 --- a/lib/routes/xjtu/gs/tzgg.ts +++ b/lib/routes/xjtu/gs/tzgg.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/xjtu/international.ts b/lib/routes/xjtu/international.ts index 449cc4b98f..b318ac75a0 100644 --- a/lib/routes/xjtu/international.ts +++ b/lib/routes/xjtu/international.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/xjtu/job.ts b/lib/routes/xjtu/job.ts index b03b00229c..0e64986f87 100644 --- a/lib/routes/xjtu/job.ts +++ b/lib/routes/xjtu/job.ts @@ -1,11 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import timezone from '@/utils/timezone'; -import path from 'node:path'; import { art } from '@/utils/render'; +import timezone from '@/utils/timezone'; const baseUrl = 'https://job.xjtu.edu.cn'; const arr = { diff --git a/lib/routes/xjtu/std.ts b/lib/routes/xjtu/std.ts index 21a35fef33..74f3bb3a3e 100644 --- a/lib/routes/xjtu/std.ts +++ b/lib/routes/xjtu/std.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/std/:category?', diff --git a/lib/routes/xjtu/yz.ts b/lib/routes/xjtu/yz.ts index 2082d2628c..8fde0a2752 100644 --- a/lib/routes/xjtu/yz.ts +++ b/lib/routes/xjtu/yz.ts @@ -1,9 +1,10 @@ -import type { Data, DataItem, Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import logger from '@/utils/logger'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/xjtu/zs.ts b/lib/routes/xjtu/zs.ts index c271d19bcc..bf951d166a 100644 --- a/lib/routes/xjtu/zs.ts +++ b/lib/routes/xjtu/zs.ts @@ -1,14 +1,13 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - export const handler = async (ctx: Context): Promise => { const { category = 'zsxx1/zskx' } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/xkb/index.ts b/lib/routes/xkb/index.ts index c5581e9e8a..653aebffd7 100644 --- a/lib/routes/xkb/index.ts +++ b/lib/routes/xkb/index.ts @@ -1,11 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:channel', diff --git a/lib/routes/xmanhua/index.ts b/lib/routes/xmanhua/index.ts index cd0b063833..f44522108d 100644 --- a/lib/routes/xmanhua/index.ts +++ b/lib/routes/xmanhua/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/xmnn/epaper.ts b/lib/routes/xmnn/epaper.ts index 47125f0db7..3ce7c1dbef 100644 --- a/lib/routes/xmnn/epaper.ts +++ b/lib/routes/xmnn/epaper.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/epaper/:id?', diff --git a/lib/routes/xmnn/news.ts b/lib/routes/xmnn/news.ts index 018a788124..afafd3f95e 100644 --- a/lib/routes/xmnn/news.ts +++ b/lib/routes/xmnn/news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/news/:category{.+}?', diff --git a/lib/routes/xmu/kydt.ts b/lib/routes/xmu/kydt.ts index ac6c0be51c..c7ee2d8fcf 100644 --- a/lib/routes/xmu/kydt.ts +++ b/lib/routes/xmu/kydt.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; export const route: Route = { path: '/kydt', diff --git a/lib/routes/xmut/jwc/bkjw.ts b/lib/routes/xmut/jwc/bkjw.ts index 4d395e72ea..5843d58f0b 100644 --- a/lib/routes/xmut/jwc/bkjw.ts +++ b/lib/routes/xmut/jwc/bkjw.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const xmut = 'https://jwc.xmut.edu.cn'; export const route: Route = { diff --git a/lib/routes/xmut/jwc/yjs.ts b/lib/routes/xmut/jwc/yjs.ts index 2dc81d2575..d9e2108338 100644 --- a/lib/routes/xmut/jwc/yjs.ts +++ b/lib/routes/xmut/jwc/yjs.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const xmut = 'https://yjs.xmut.edu.cn'; export const route: Route = { diff --git a/lib/routes/xsijishe/forum.ts b/lib/routes/xsijishe/forum.ts index 7e328c3c0e..afbb089840 100644 --- a/lib/routes/xsijishe/forum.ts +++ b/lib/routes/xsijishe/forum.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; + const baseUrl = 'https://xsijishe.com'; export const route: Route = { diff --git a/lib/routes/xsijishe/rank.ts b/lib/routes/xsijishe/rank.ts index b744df9346..f9ee988141 100644 --- a/lib/routes/xsijishe/rank.ts +++ b/lib/routes/xsijishe/rank.ts @@ -1,12 +1,14 @@ +import { load } from 'cheerio'; + +import { config } from '@/config'; import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { config } from '@/config'; -import { puppeteerGet } from './utils'; import puppeteer from '@/utils/puppeteer'; +import { puppeteerGet } from './utils'; + const baseUrl = 'https://xsijishe.com'; export const route: Route = { diff --git a/lib/routes/xueqiu/column.ts b/lib/routes/xueqiu/column.ts index b7bd7c00fc..0a40492e28 100644 --- a/lib/routes/xueqiu/column.ts +++ b/lib/routes/xueqiu/column.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { JSDOM } from 'jsdom'; import { CookieJar } from 'tough-cookie'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + const cookieJar = new CookieJar(); const baseUrl = 'https://xueqiu.com'; diff --git a/lib/routes/xueqiu/cookies.ts b/lib/routes/xueqiu/cookies.ts index 4ab5748565..5111e63eb9 100644 --- a/lib/routes/xueqiu/cookies.ts +++ b/lib/routes/xueqiu/cookies.ts @@ -1,5 +1,5 @@ -import cache from '@/utils/cache'; import { config } from '@/config'; +import cache from '@/utils/cache'; import puppeteer from '@/utils/puppeteer'; import { getCookies } from '@/utils/puppeteer-utils'; diff --git a/lib/routes/xueqiu/favorite.ts b/lib/routes/xueqiu/favorite.ts index cb1e619713..8832d46560 100644 --- a/lib/routes/xueqiu/favorite.ts +++ b/lib/routes/xueqiu/favorite.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import queryString from 'query-string'; -import { parseDate } from '@/utils/parse-date'; + import { parseToken } from '@/routes/xueqiu/cookies'; +import type { Route } from '@/types'; +import got from '@/utils/got'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/favorite/:id', diff --git a/lib/routes/xueqiu/fund.ts b/lib/routes/xueqiu/fund.ts index b38053948e..78bf9e2470 100644 --- a/lib/routes/xueqiu/fund.ts +++ b/lib/routes/xueqiu/fund.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/xueqiu/hots.ts b/lib/routes/xueqiu/hots.ts index ffaf9d5205..77c8fd3bcb 100644 --- a/lib/routes/xueqiu/hots.ts +++ b/lib/routes/xueqiu/hots.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import queryString from 'query-string'; -import { parseDate } from '@/utils/parse-date'; import sanitizeHtml from 'sanitize-html'; + import { parseToken } from '@/routes/xueqiu/cookies'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/hots', diff --git a/lib/routes/xueqiu/snb.ts b/lib/routes/xueqiu/snb.ts index 5e3f60f98d..141f971b26 100644 --- a/lib/routes/xueqiu/snb.ts +++ b/lib/routes/xueqiu/snb.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import { parseDate } from '@/utils/parse-date'; import { PRESETS } from '@/utils/header-generator'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/snb/:id', diff --git a/lib/routes/xueqiu/stock-comments.ts b/lib/routes/xueqiu/stock-comments.ts index b05155f0fd..9bcdf1fed9 100644 --- a/lib/routes/xueqiu/stock-comments.ts +++ b/lib/routes/xueqiu/stock-comments.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; +import sanitizeHtml from 'sanitize-html'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; -import path from 'node:path'; import { parseDate } from '@/utils/parse-date'; -import sanitizeHtml from 'sanitize-html'; +import { art } from '@/utils/render'; export const route: Route = { path: '/stock_comments/:id', diff --git a/lib/routes/xueqiu/stock-info.ts b/lib/routes/xueqiu/stock-info.ts index cc3ec8032c..d87929a469 100644 --- a/lib/routes/xueqiu/stock-info.ts +++ b/lib/routes/xueqiu/stock-info.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; import queryString from 'query-string'; -import { parseDate } from '@/utils/parse-date'; import sanitizeHtml from 'sanitize-html'; + import { parseToken } from '@/routes/xueqiu/cookies'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/stock_info/:id/:type?', diff --git a/lib/routes/xueqiu/timeline.ts b/lib/routes/xueqiu/timeline.ts index 37c97b08d3..9f3ecae05d 100644 --- a/lib/routes/xueqiu/timeline.ts +++ b/lib/routes/xueqiu/timeline.ts @@ -1,9 +1,10 @@ -import { DataItem, Route } from '@/types'; -import got from '@/utils/got'; import { config } from '@/config'; -import { parseDate } from '@/utils/parse-date'; -import cache from '@/utils/cache'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { DataItem, Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + const rootUrl = 'https://xueqiu.com'; export const route: Route = { path: '/timeline/:usergroup_id?', diff --git a/lib/routes/xueqiu/today.ts b/lib/routes/xueqiu/today.ts index 2235d017ee..4a6b88ecbc 100644 --- a/lib/routes/xueqiu/today.ts +++ b/lib/routes/xueqiu/today.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import { parseToken } from '@/routes/xueqiu/cookies'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { parseToken } from '@/routes/xueqiu/cookies'; export const route: Route = { path: '/today', diff --git a/lib/routes/xueqiu/user-stock.ts b/lib/routes/xueqiu/user-stock.ts index 97c9c0ca83..44959474ad 100644 --- a/lib/routes/xueqiu/user-stock.ts +++ b/lib/routes/xueqiu/user-stock.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/xueqiu/user.ts b/lib/routes/xueqiu/user.ts index 4fa8a58fc0..89de8c06ab 100644 --- a/lib/routes/xueqiu/user.ts +++ b/lib/routes/xueqiu/user.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import sanitizeHtml from 'sanitize-html'; + +import { parseToken } from '@/routes/xueqiu/cookies'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import { parseDate } from '@/utils/parse-date'; -import sanitizeHtml from 'sanitize-html'; -import { parseToken } from '@/routes/xueqiu/cookies'; import puppeteer from '@/utils/puppeteer'; const rootUrl = 'https://xueqiu.com'; diff --git a/lib/routes/xunhupay/index.ts b/lib/routes/xunhupay/index.ts index aa1bfbe283..59b965b642 100644 --- a/lib/routes/xunhupay/index.ts +++ b/lib/routes/xunhupay/index.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import buildData from '@/utils/common-config'; + const baseUrl = 'https://www.xunhupay.com'; export const route: Route = { diff --git a/lib/routes/xwenming/index.ts b/lib/routes/xwenming/index.ts index 06194960f9..ac68fbb4b5 100644 --- a/lib/routes/xwenming/index.ts +++ b/lib/routes/xwenming/index.ts @@ -1,11 +1,10 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; - import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + export const handler = async (ctx: Context): Promise => { const { category } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '50', 10); diff --git a/lib/routes/xys/new.ts b/lib/routes/xys/new.ts index 3927f17727..51816aee3b 100644 --- a/lib/routes/xys/new.ts +++ b/lib/routes/xys/new.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; -import path from 'node:path'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; diff --git a/lib/routes/xyu/library.ts b/lib/routes/xyu/library.ts index 822787dfb0..33dd88d5c2 100644 --- a/lib/routes/xyu/library.ts +++ b/lib/routes/xyu/library.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/xyu/notices.ts b/lib/routes/xyu/notices.ts index ac198dfeed..02b3f03527 100644 --- a/lib/routes/xyu/notices.ts +++ b/lib/routes/xyu/notices.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/xyzrank/index.ts b/lib/routes/xyzrank/index.ts index 2fd81bc4c6..117823fbd4 100644 --- a/lib/routes/xyzrank/index.ts +++ b/lib/routes/xyzrank/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/yahoo/news/index.ts b/lib/routes/yahoo/news/index.ts index c93b5cd265..58b6a44f67 100644 --- a/lib/routes/yahoo/news/index.ts +++ b/lib/routes/yahoo/news/index.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import parser from '@/utils/rss-parser'; -import { getArchive, getCategories, parseList, parseItem } from './utils'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; + +import { getArchive, getCategories, parseItem, parseList } from './utils'; export const route: Route = { path: '/news/:region/:category?', diff --git a/lib/routes/yahoo/news/listid.ts b/lib/routes/yahoo/news/listid.ts index 1eae53424d..074d68b441 100644 --- a/lib/routes/yahoo/news/listid.ts +++ b/lib/routes/yahoo/news/listid.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import { getList, parseList, parseItem } from './utils'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; + +import { getList, parseItem, parseList } from './utils'; export const route: Route = { path: '/news/list/:region/:listId', diff --git a/lib/routes/yahoo/news/provider-helper.ts b/lib/routes/yahoo/news/provider-helper.ts index 505968c4e5..13d4fd3de8 100644 --- a/lib/routes/yahoo/news/provider-helper.ts +++ b/lib/routes/yahoo/news/provider-helper.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import { getProviderList } from './utils'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; + +import { getProviderList } from './utils'; export const route: Route = { path: '/news/providers/:region/list', diff --git a/lib/routes/yahoo/news/provider.ts b/lib/routes/yahoo/news/provider.ts index 8b737387b5..8e4010ddda 100644 --- a/lib/routes/yahoo/news/provider.ts +++ b/lib/routes/yahoo/news/provider.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import { getArchive, getProviderList, parseList, parseItem } from './utils'; import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; + +import { getArchive, getProviderList, parseItem, parseList } from './utils'; export const route: Route = { path: '/news/provider/:region/:providerId', diff --git a/lib/routes/yahoo/news/utils.ts b/lib/routes/yahoo/news/utils.ts index ead8743b66..160c377532 100644 --- a/lib/routes/yahoo/news/utils.ts +++ b/lib/routes/yahoo/news/utils.ts @@ -1,9 +1,11 @@ -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; import path from 'node:path'; -import { art } from '@/utils/render'; + +import { load } from 'cheerio'; + import { config } from '@/config'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; +import { art } from '@/utils/render'; const getArchive = async (region, limit, tag, providerId?) => { const { data: response } = await got( @@ -137,4 +139,4 @@ const parseItem = (item, tryGet) => return item; }); -export { getArchive, getList, getCategories, getProviderList, getStores, parseList, parseItem }; +export { getArchive, getCategories, getList, getProviderList, getStores, parseItem, parseList }; diff --git a/lib/routes/yamap/articles.ts b/lib/routes/yamap/articles.ts index ec36a4457c..95eaf47dc4 100644 --- a/lib/routes/yamap/articles.ts +++ b/lib/routes/yamap/articles.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/yamibo/bbs/forum.ts b/lib/routes/yamibo/bbs/forum.ts index 802685b77f..dd167ed803 100644 --- a/lib/routes/yamibo/bbs/forum.ts +++ b/lib/routes/yamibo/bbs/forum.ts @@ -1,11 +1,13 @@ -import type { Data, DataItem, Route } from '@/types'; -import type { Context } from 'hono'; -import { config } from '@/config'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { fetchThread, generateDescription, getDate, bbsOrigin } from '../utils'; +import type { Context } from 'hono'; import pMap from 'p-map'; + +import { config } from '@/config'; +import type { Data, DataItem, Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + +import { bbsOrigin, fetchThread, generateDescription, getDate } from '../utils'; export const route: Route = { name: 'BBS - 板块', diff --git a/lib/routes/yamibo/bbs/thread.ts b/lib/routes/yamibo/bbs/thread.ts index 0b2060ec5f..8ec70b2ea6 100644 --- a/lib/routes/yamibo/bbs/thread.ts +++ b/lib/routes/yamibo/bbs/thread.ts @@ -1,7 +1,9 @@ -import type { Data, DataItem, Route } from '@/types'; -import type { Context } from 'hono'; import { load } from 'cheerio'; -import { fetchThread, generateDescription, getDate, bbsOrigin } from '../utils'; +import type { Context } from 'hono'; + +import type { Data, DataItem, Route } from '@/types'; + +import { bbsOrigin, fetchThread, generateDescription, getDate } from '../utils'; export const route: Route = { name: 'BBS - 讨论串', diff --git a/lib/routes/yamibo/utils.ts b/lib/routes/yamibo/utils.ts index 1478877866..354cda6512 100644 --- a/lib/routes/yamibo/utils.ts +++ b/lib/routes/yamibo/utils.ts @@ -1,9 +1,10 @@ +import type { Cheerio, Element } from 'cheerio'; +import { JSDOM } from 'jsdom'; + +import { config } from '@/config'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import ofetch from '@/utils/ofetch'; -import { config } from '@/config'; -import { JSDOM } from 'jsdom'; -import type { Cheerio, Element } from 'cheerio'; export const bbsOrigin = 'https://bbs.yamibo.com'; diff --git a/lib/routes/yande/post.ts b/lib/routes/yande/post.ts index 8cd089d9dd..03da6d9097 100644 --- a/lib/routes/yande/post.ts +++ b/lib/routes/yande/post.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import queryString from 'query-string'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/post/popular_recent/:period?', categories: ['picture'], diff --git a/lib/routes/yangtzeu/dongke.ts b/lib/routes/yangtzeu/dongke.ts index ee287cf1e9..e5e477ec0d 100644 --- a/lib/routes/yangtzeu/dongke.ts +++ b/lib/routes/yangtzeu/dongke.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -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 type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { getSubPath } from '@/utils/common-utils'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/dongke/*', diff --git a/lib/routes/ycwb/index.ts b/lib/routes/ycwb/index.ts index 09614c3605..35ce539467 100644 --- a/lib/routes/ycwb/index.ts +++ b/lib/routes/ycwb/index.ts @@ -1,12 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 path from 'node:path'; +import timezone from '@/utils/timezone'; export const route: Route = { path: '/:node', diff --git a/lib/routes/yenpress/series.ts b/lib/routes/yenpress/series.ts index c8c26ed6b6..91265610c7 100644 --- a/lib/routes/yenpress/series.ts +++ b/lib/routes/yenpress/series.ts @@ -1,13 +1,14 @@ -import { DataItem, Route } from '@/types'; +import path from 'node:path'; + +import * as cheerio from 'cheerio'; import type { Context } from 'hono'; -import ofetch from '@/utils/ofetch'; +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; -import * as cheerio from 'cheerio'; -import timezone from '@/utils/timezone'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; const render = (data) => art(path.join(__dirname, 'templates/series.art'), data); diff --git a/lib/routes/ygkkk/rss.ts b/lib/routes/ygkkk/rss.ts index dcade796dd..51c21fc02a 100644 --- a/lib/routes/ygkkk/rss.ts +++ b/lib/routes/ygkkk/rss.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/', categories: ['blog'], diff --git a/lib/routes/yicai/author.ts b/lib/routes/yicai/author.ts index eeaa1f38b3..f343bde5b1 100644 --- a/lib/routes/yicai/author.ts +++ b/lib/routes/yicai/author.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { rootUrl, ProcessItems } from './utils'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + +import { ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/author/:id?', diff --git a/lib/routes/yicai/brief.ts b/lib/routes/yicai/brief.ts index 4f0dbe6731..0c6304dd63 100644 --- a/lib/routes/yicai/brief.ts +++ b/lib/routes/yicai/brief.ts @@ -1,7 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; import { rootUrl } from './utils'; diff --git a/lib/routes/yicai/carousel.ts b/lib/routes/yicai/carousel.ts index ef8f9b99a6..7fda115490 100644 --- a/lib/routes/yicai/carousel.ts +++ b/lib/routes/yicai/carousel.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import { rootUrl, fetchFullArticles } from './utils'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; + +import { fetchFullArticles, rootUrl } from './utils'; + export const route: Route = { path: '/carousel', categories: ['traditional-media'], diff --git a/lib/routes/yicai/dt.ts b/lib/routes/yicai/dt.ts index de4b4dda5f..3f6dc9a49f 100644 --- a/lib/routes/yicai/dt.ts +++ b/lib/routes/yicai/dt.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const columns = { article: 2, diff --git a/lib/routes/yicai/feed.ts b/lib/routes/yicai/feed.ts index e2912fc2ce..c81f1c8c4c 100644 --- a/lib/routes/yicai/feed.ts +++ b/lib/routes/yicai/feed.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { rootUrl, ProcessItems } from './utils'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + +import { ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/feed/:id?', diff --git a/lib/routes/yicai/headline.ts b/lib/routes/yicai/headline.ts index 36a0877359..69b83ab141 100644 --- a/lib/routes/yicai/headline.ts +++ b/lib/routes/yicai/headline.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { rootUrl, ProcessItems } from './utils'; + +import { ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/headline', diff --git a/lib/routes/yicai/latest.ts b/lib/routes/yicai/latest.ts index 9b63084694..5f81654b46 100644 --- a/lib/routes/yicai/latest.ts +++ b/lib/routes/yicai/latest.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { rootUrl, ProcessItems } from './utils'; + +import { ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/latest', diff --git a/lib/routes/yicai/news.ts b/lib/routes/yicai/news.ts index 037a507f12..ca7e05faf6 100644 --- a/lib/routes/yicai/news.ts +++ b/lib/routes/yicai/news.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { rootUrl, ProcessItems } from './utils'; +import { ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/news/:id?', diff --git a/lib/routes/yicai/utils.ts b/lib/routes/yicai/utils.ts index b74e85e221..8872a3a164 100644 --- a/lib/routes/yicai/utils.ts +++ b/lib/routes/yicai/utils.ts @@ -1,9 +1,11 @@ -import got from '@/utils/got'; +import path from 'node:path'; + import { load } from 'cheerio'; -import timezone from '@/utils/timezone'; + +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; +import timezone from '@/utils/timezone'; const rootUrl = 'https://www.yicai.com'; @@ -59,4 +61,4 @@ function fetchFullArticles(items, tryGet) { }) ); } -export { rootUrl, ProcessItems, fetchFullArticles }; +export { fetchFullArticles, ProcessItems, rootUrl }; diff --git a/lib/routes/yicai/video.ts b/lib/routes/yicai/video.ts index 1fb9749f1e..5169a146eb 100644 --- a/lib/routes/yicai/video.ts +++ b/lib/routes/yicai/video.ts @@ -1,8 +1,8 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { rootUrl, ProcessItems } from './utils'; +import { ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/video/:id?', diff --git a/lib/routes/yicai/vip.ts b/lib/routes/yicai/vip.ts index ddd954affa..94eecd79cb 100644 --- a/lib/routes/yicai/vip.ts +++ b/lib/routes/yicai/vip.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { rootUrl, ProcessItems } from './utils'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + +import { ProcessItems, rootUrl } from './utils'; export const route: Route = { path: '/vip/:id?', diff --git a/lib/routes/yilinzazhi/index.ts b/lib/routes/yilinzazhi/index.ts index f69cdd00b0..2f2cd37d75 100644 --- a/lib/routes/yilinzazhi/index.ts +++ b/lib/routes/yilinzazhi/index.ts @@ -1,7 +1,9 @@ -import { Data, DataItem, Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Data, DataItem, Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/', diff --git a/lib/routes/yilinzazhi/latest.ts b/lib/routes/yilinzazhi/latest.ts index 0c7cb89ba6..7af9b7c67b 100644 --- a/lib/routes/yilinzazhi/latest.ts +++ b/lib/routes/yilinzazhi/latest.ts @@ -1,9 +1,11 @@ -import { Data, DataItem, Route, ViewType } from '@/types'; -import cache from '@/utils/cache'; -import got from '@/utils/got'; import { load } from 'cheerio'; import dayjs from 'dayjs'; +import type { Data, DataItem, Route} from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; + export const route: Route = { path: '/latest', categories: ['reading'], diff --git a/lib/routes/ymgal/article.ts b/lib/routes/ymgal/article.ts index bdfb207a78..8ed4a24e8c 100644 --- a/lib/routes/ymgal/article.ts +++ b/lib/routes/ymgal/article.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; const host = 'https://www.ymgal.games'; diff --git a/lib/routes/ymgal/game.ts b/lib/routes/ymgal/game.ts index 1b2c84665d..a89b7bb707 100644 --- a/lib/routes/ymgal/game.ts +++ b/lib/routes/ymgal/game.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { load } from 'cheerio'; const host = 'https://www.ymgal.games'; diff --git a/lib/routes/yna/index.ts b/lib/routes/yna/index.ts index 62d53c59db..48abb34732 100644 --- a/lib/routes/yna/index.ts +++ b/lib/routes/yna/index.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import parser from '@/utils/rss-parser'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; +import parser from '@/utils/rss-parser'; import timezone from '@/utils/timezone'; export const route: Route = { diff --git a/lib/routes/ynet/list.ts b/lib/routes/ynet/list.ts index 4ee7b162ab..6622a47f01 100644 --- a/lib/routes/ynet/list.ts +++ b/lib/routes/ynet/list.ts @@ -1,14 +1,13 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import { type Cheerio, type CheerioAPI, load } from 'cheerio'; +import type { Element } from 'domhandler'; +import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { type CheerioAPI, type Cheerio, load } from 'cheerio'; -import type { Element } from 'domhandler'; -import { type Context } from 'hono'; - const defaultCategory = 'news'; const defaultId = '2121t76'; diff --git a/lib/routes/yoasobi-music/info.ts b/lib/routes/yoasobi-music/info.ts index 8e9d6e499b..fbc204cdb3 100644 --- a/lib/routes/yoasobi-music/info.ts +++ b/lib/routes/yoasobi-music/info.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { parseJSONP } from './jsonp-helper'; import { art } from '@/utils/render'; -import path from 'node:path'; + +import { parseJSONP } from './jsonp-helper'; export const route: Route = { path: '/info/:category?', diff --git a/lib/routes/yoasobi-music/live.ts b/lib/routes/yoasobi-music/live.ts index 184f3a2ac7..23f5ba1782 100644 --- a/lib/routes/yoasobi-music/live.ts +++ b/lib/routes/yoasobi-music/live.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { parseJSONP } from './jsonp-helper'; -import { art } from '@/utils/render'; import path from 'node:path'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + +import { parseJSONP } from './jsonp-helper'; + export const route: Route = { path: '/live', categories: ['live'], diff --git a/lib/routes/yoasobi-music/media.ts b/lib/routes/yoasobi-music/media.ts index e01eda19a2..212012671b 100644 --- a/lib/routes/yoasobi-music/media.ts +++ b/lib/routes/yoasobi-music/media.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { parseJSONP } from './jsonp-helper'; -import { art } from '@/utils/render'; import path from 'node:path'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { art } from '@/utils/render'; + +import { parseJSONP } from './jsonp-helper'; + export const route: Route = { path: '/media', categories: ['live'], diff --git a/lib/routes/yomiuri/news.ts b/lib/routes/yomiuri/news.ts index 57d3253b5a..22b104083e 100644 --- a/lib/routes/yomiuri/news.ts +++ b/lib/routes/yomiuri/news.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/yomujp/level.ts b/lib/routes/yomujp/level.ts index a64088d5a0..32f5b87cc8 100644 --- a/lib/routes/yomujp/level.ts +++ b/lib/routes/yomujp/level.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import md5 from '@/utils/md5'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/:level?', diff --git a/lib/routes/youku/channel.ts b/lib/routes/youku/channel.ts index f28032dda7..6795b1a68d 100644 --- a/lib/routes/youku/channel.ts +++ b/lib/routes/youku/channel.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '/channel/:channelId/:embed?', diff --git a/lib/routes/youmemark/index.ts b/lib/routes/youmemark/index.ts index feacaed4b2..90236327da 100644 --- a/lib/routes/youmemark/index.ts +++ b/lib/routes/youmemark/index.ts @@ -1,7 +1,8 @@ -import { Route, Data } from '@/types'; +import { load } from 'cheerio'; + +import type { Data, Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { load } from 'cheerio'; export const route: Route = { path: '/:userid', diff --git a/lib/routes/youtube/api/google.ts b/lib/routes/youtube/api/google.ts index 82f718fae0..0dc29a299b 100644 --- a/lib/routes/youtube/api/google.ts +++ b/lib/routes/youtube/api/google.ts @@ -1,17 +1,20 @@ -import { google } from 'googleapis'; -const { OAuth2 } = google.auth; -import { config } from '@/config'; -import utils, { getVideoUrl } from '../utils'; -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; -import ofetch from '@/utils/ofetch'; import * as cheerio from 'cheerio'; -import NotFoundError from '@/errors/types/not-found'; -import { Data } from '@/types'; import dayjs from 'dayjs'; import duration from 'dayjs/plugin/duration.js'; +import { google } from 'googleapis'; + +import { config } from '@/config'; +import NotFoundError from '@/errors/types/not-found'; +import type { Data } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + +import utils, { getVideoUrl } from '../utils'; import { getSrtAttachmentBatch } from './subtitles'; +const { OAuth2 } = google.auth; + dayjs.extend(duration); let count = 0; @@ -52,7 +55,7 @@ if (config.youtube && config.youtube.clientId && config.youtube.clientSecret && youtubeOAuth2Client.setCredentials({ refresh_token: config.youtube.refreshToken }); } -export { youtubeOAuth2Client, exec }; +export { exec, youtubeOAuth2Client }; export const getDataByUsername = async ({ username, embed, filterShorts, isJsonFeed }: { username: string; embed: boolean; filterShorts: boolean; isJsonFeed: boolean }): Promise => { let userHandleData; diff --git a/lib/routes/youtube/api/subtitles.ts b/lib/routes/youtube/api/subtitles.ts index 276ef5620f..4548f5d042 100644 --- a/lib/routes/youtube/api/subtitles.ts +++ b/lib/routes/youtube/api/subtitles.ts @@ -1,5 +1,6 @@ -import { getSubtitles } from 'youtube-caption-extractor'; import pMap from 'p-map'; +import { getSubtitles } from 'youtube-caption-extractor'; + import cache from '@/utils/cache'; function pad(n: number, width: number = 2) { diff --git a/lib/routes/youtube/api/youtubei.ts b/lib/routes/youtube/api/youtubei.ts index ed2b0d4e92..c5bceb1588 100644 --- a/lib/routes/youtube/api/youtubei.ts +++ b/lib/routes/youtube/api/youtubei.ts @@ -1,7 +1,9 @@ -import { Data } from '@/types'; +import { Innertube } from 'youtubei.js'; + +import type { Data } from '@/types'; import cache from '@/utils/cache'; import { parseRelativeDate } from '@/utils/parse-date'; -import { Innertube } from 'youtubei.js'; + import utils, { getVideoUrl } from '../utils'; import { getSrtAttachmentBatch } from './subtitles'; diff --git a/lib/routes/youtube/channel.ts b/lib/routes/youtube/channel.ts index aebc951daf..399c49c2b4 100644 --- a/lib/routes/youtube/channel.ts +++ b/lib/routes/youtube/channel.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import utils, { callApi } from './utils'; import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { getDataByChannelId as getDataByChannelIdYoutubei } from './api/youtubei'; +import type { Route } from '@/types'; + import { getDataByChannelId as getDataByChannelIdGoogle } from './api/google'; +import { getDataByChannelId as getDataByChannelIdYoutubei } from './api/youtubei'; +import utils, { callApi } from './utils'; export const route: Route = { path: '/channel/:id/:routeParams?', diff --git a/lib/routes/youtube/charts.ts b/lib/routes/youtube/charts.ts index aac74d1c1f..2070413751 100644 --- a/lib/routes/youtube/charts.ts +++ b/lib/routes/youtube/charts.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; + import { renderDescription } from './utils'; -import { config } from '@/config'; export const route: Route = { path: '/charts/:category?/:country?/:embed?', diff --git a/lib/routes/youtube/community.ts b/lib/routes/youtube/community.ts index 817408e586..320a4ac3fb 100644 --- a/lib/routes/youtube/community.ts +++ b/lib/routes/youtube/community.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseRelativeDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; + import { isYouTubeChannelId } from './utils'; export const route: Route = { diff --git a/lib/routes/youtube/custom.ts b/lib/routes/youtube/custom.ts index bdcb33e45a..0ec7d10a29 100644 --- a/lib/routes/youtube/custom.ts +++ b/lib/routes/youtube/custom.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import utils from './utils'; -import { config } from '@/config'; -import got from '@/utils/got'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; + +import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + +import utils from './utils'; export const route: Route = { path: '/c/:username/:embed?', diff --git a/lib/routes/youtube/live.ts b/lib/routes/youtube/live.ts index 639a7bb851..7314cd0f89 100644 --- a/lib/routes/youtube/live.ts +++ b/lib/routes/youtube/live.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import utils from './utils'; -import { config } from '@/config'; -import { parseDate } from '@/utils/parse-date'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + +import utils from './utils'; export const route: Route = { path: '/live/:username/:embed?', diff --git a/lib/routes/youtube/playlist.ts b/lib/routes/youtube/playlist.ts index 057351ddc5..3affa67334 100644 --- a/lib/routes/youtube/playlist.ts +++ b/lib/routes/youtube/playlist.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; -import { callApi } from './utils'; -import { getDataByPlaylistId as getDataByPlaylistIdYoutubei } from './api/youtubei'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; + import { getDataByPlaylistId as getDataByPlaylistIdGoogle } from './api/google'; +import { getDataByPlaylistId as getDataByPlaylistIdYoutubei } from './api/youtubei'; +import { callApi } from './utils'; export const route: Route = { path: '/playlist/:id/:embed?', diff --git a/lib/routes/youtube/subscriptions.ts b/lib/routes/youtube/subscriptions.ts index c6497268e7..2a3d852800 100644 --- a/lib/routes/youtube/subscriptions.ts +++ b/lib/routes/youtube/subscriptions.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; -import { config } from '@/config'; -import utils from './utils'; -import { parseDate } from '@/utils/parse-date'; import pMap from 'p-map'; + +import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import { parseDate } from '@/utils/parse-date'; + +import utils from './utils'; export const route: Route = { path: '/subscriptions/:embed?', diff --git a/lib/routes/youtube/user.ts b/lib/routes/youtube/user.ts index b48934bce8..843f337b1c 100644 --- a/lib/routes/youtube/user.ts +++ b/lib/routes/youtube/user.ts @@ -1,6 +1,8 @@ -import { Route, ViewType } from '@/types'; -import { getDataByUsername as getDataByUsernameYoutubei } from './api/youtubei'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; + import { getDataByUsername as getDataByUsernameGoogle } from './api/google'; +import { getDataByUsername as getDataByUsernameYoutubei } from './api/youtubei'; import { callApi } from './utils'; export const route: Route = { diff --git a/lib/routes/youtube/utils.ts b/lib/routes/youtube/utils.ts index 114d3574f1..8444347048 100644 --- a/lib/routes/youtube/utils.ts +++ b/lib/routes/youtube/utils.ts @@ -1,8 +1,11 @@ -import { google } from 'googleapis'; -import { art } from '@/utils/render'; import path from 'node:path'; + +import { google } from 'googleapis'; + import { config } from '@/config'; -import { youtubeOAuth2Client, exec } from './api/google'; +import { art } from '@/utils/render'; + +import { exec, youtubeOAuth2Client } from './api/google'; export const getPlaylistItems = (id, part, cache) => cache.tryGet( diff --git a/lib/routes/youzhiyouxing/materials.ts b/lib/routes/youzhiyouxing/materials.ts index 99d179e38f..55f141d1c5 100644 --- a/lib/routes/youzhiyouxing/materials.ts +++ b/lib/routes/youzhiyouxing/materials.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/yuanliao/index.ts b/lib/routes/yuanliao/index.ts index 6b4a857946..8d8c1858e2 100644 --- a/lib/routes/yuanliao/index.ts +++ b/lib/routes/yuanliao/index.ts @@ -1,11 +1,10 @@ -import { type Data, type DataItem, type Route, ViewType } from '@/types'; - -import ofetch from '@/utils/ofetch'; -import { parseDate } from '@/utils/parse-date'; - import { type CheerioAPI, load } from 'cheerio'; import { type Context } from 'hono'; +import { type Data, type DataItem, type Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + export const handler = async (ctx: Context): Promise => { const { tag } = ctx.req.param(); const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); diff --git a/lib/routes/yuque/book.ts b/lib/routes/yuque/book.ts index 408b8e1283..44e36a2069 100644 --- a/lib/routes/yuque/book.ts +++ b/lib/routes/yuque/book.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; +import { CookieJar } from 'tough-cookie'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + import { card2Html } from './utils'; -import { CookieJar } from 'tough-cookie'; const APP_DATA_REGEX = /window\.appData = JSON\.parse\(decodeURIComponent\("(.+?)"\)\);/; const baseUrl = 'https://www.yuque.com'; diff --git a/lib/routes/yxdown/news.ts b/lib/routes/yxdown/news.ts index 6b76f75c48..5c1ee855ca 100644 --- a/lib/routes/yxdown/news.ts +++ b/lib/routes/yxdown/news.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 { rootUrl, getCookie } from './utils'; +import timezone from '@/utils/timezone'; + +import { getCookie, rootUrl } from './utils'; export const route: Route = { path: '/news/:category?', diff --git a/lib/routes/yxdown/recommend.ts b/lib/routes/yxdown/recommend.ts index b0e49fd38c..492eb167c8 100644 --- a/lib/routes/yxdown/recommend.ts +++ b/lib/routes/yxdown/recommend.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 { rootUrl, getCookie } from './utils'; +import timezone from '@/utils/timezone'; + +import { getCookie, rootUrl } from './utils'; export const route: Route = { path: '/recommend', diff --git a/lib/routes/yxdown/utils.ts b/lib/routes/yxdown/utils.ts index 989803f1a2..d66f354a69 100644 --- a/lib/routes/yxdown/utils.ts +++ b/lib/routes/yxdown/utils.ts @@ -11,4 +11,4 @@ const getCookie = async () => { return cookieStr; }; -export { rootUrl, getCookie }; +export { getCookie, rootUrl }; diff --git a/lib/routes/yxdzqb/index.ts b/lib/routes/yxdzqb/index.ts index c1589c4fbf..7b1b4dcd5f 100644 --- a/lib/routes/yxdzqb/index.ts +++ b/lib/routes/yxdzqb/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; - -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { art } from '@/utils/render'; import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { art } from '@/utils/render'; + const host = 'https://www.yxdzqb.com'; const map = { diff --git a/lib/routes/yxrb/home.ts b/lib/routes/yxrb/home.ts index c66c05fd27..d947a2530c 100644 --- a/lib/routes/yxrb/home.ts +++ b/lib/routes/yxrb/home.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/yyets/article.ts b/lib/routes/yyets/article.ts index e3e7797ee0..7e4eba4152 100644 --- a/lib/routes/yyets/article.ts +++ b/lib/routes/yyets/article.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/yyets/today.ts b/lib/routes/yyets/today.ts index e756ada7d7..711f6e26b2 100644 --- a/lib/routes/yyets/today.ts +++ b/lib/routes/yyets/today.ts @@ -1,7 +1,9 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/today', categories: ['multimedia'], diff --git a/lib/routes/yystv/category.ts b/lib/routes/yystv/category.ts index 6f4207b29e..7c76349d53 100644 --- a/lib/routes/yystv/category.ts +++ b/lib/routes/yystv/category.ts @@ -1,9 +1,11 @@ -import { DataItem, Route } from '@/types'; -import ofetch from '@/utils/ofetch'; -import { fetchDataItemCached } from './fetcher'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; +import { fetchDataItemCached } from './fetcher'; + export const route: Route = { path: '/category/:category', categories: ['game'], diff --git a/lib/routes/yystv/docs.ts b/lib/routes/yystv/docs.ts index eefb2d9fde..836dfe958a 100644 --- a/lib/routes/yystv/docs.ts +++ b/lib/routes/yystv/docs.ts @@ -1,7 +1,9 @@ -import type { Route, DataItem } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseRelativeDate } from '@/utils/parse-date'; + import { fetchDataItemCached } from './fetcher'; export const route: Route = { diff --git a/lib/routes/yystv/fetcher.ts b/lib/routes/yystv/fetcher.ts index 18bb15c011..751089ceb2 100644 --- a/lib/routes/yystv/fetcher.ts +++ b/lib/routes/yystv/fetcher.ts @@ -1,4 +1,4 @@ -import { DataItem } from '@/types'; +import type { DataItem } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; diff --git a/lib/routes/zagg/new-arrivals.ts b/lib/routes/zagg/new-arrivals.ts index 44016de397..9a8f9faa37 100644 --- a/lib/routes/zagg/new-arrivals.ts +++ b/lib/routes/zagg/new-arrivals.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import got from '@/utils/got'; import { art } from '@/utils/render'; -import path from 'node:path'; -import { load } from 'cheerio'; + const host = 'https://www.zagg.com/en_us'; export const route: Route = { path: '/new-arrivals/:query?', diff --git a/lib/routes/zaimanhua/comic.ts b/lib/routes/zaimanhua/comic.ts index 3a737cee3f..ba110d8f79 100644 --- a/lib/routes/zaimanhua/comic.ts +++ b/lib/routes/zaimanhua/comic.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; +import path from 'node:path'; + +import pMap from 'p-map'; + import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import cache from '@/utils/cache'; -import pMap from 'p-map'; export const route: Route = { path: '/comic/:id', diff --git a/lib/routes/zaimanhua/namespace.ts b/lib/routes/zaimanhua/namespace.ts index b932ffe4a1..1103025a99 100644 --- a/lib/routes/zaimanhua/namespace.ts +++ b/lib/routes/zaimanhua/namespace.ts @@ -1,4 +1,4 @@ -import { Namespace } from '@/types'; +import type { Namespace } from '@/types'; export const namespace: Namespace = { name: '再漫画', diff --git a/lib/routes/zaimanhua/update.ts b/lib/routes/zaimanhua/update.ts index 4afb98e822..8d344a7c11 100644 --- a/lib/routes/zaimanhua/update.ts +++ b/lib/routes/zaimanhua/update.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; +import path from 'node:path'; + +import pMap from 'p-map'; + import { config } from '@/config'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import cache from '@/utils/cache'; -import pMap from 'p-map'; export const route: Route = { path: '/update', diff --git a/lib/routes/zaker/channel.ts b/lib/routes/zaker/channel.ts index c3e68682ae..7416c493e9 100644 --- a/lib/routes/zaker/channel.ts +++ b/lib/routes/zaker/channel.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import * as cheerio from 'cheerio'; -import { baseUrl, fetchItem, getSafeLineCookieWithData, parseList } from './utils'; import pMap from 'p-map'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; + +import { baseUrl, fetchItem, getSafeLineCookieWithData, parseList } from './utils'; + export const route: Route = { path: '/channel/:id?', parameters: { diff --git a/lib/routes/zaker/focus.ts b/lib/routes/zaker/focus.ts index 539b838f26..3442eae46f 100644 --- a/lib/routes/zaker/focus.ts +++ b/lib/routes/zaker/focus.ts @@ -1,7 +1,9 @@ -import { Route } from '@/types'; -import cache from '@/utils/cache'; import * as cheerio from 'cheerio'; import pMap from 'p-map'; + +import type { Route } from '@/types'; +import cache from '@/utils/cache'; + import { baseUrl, fetchItem, getSafeLineCookieWithData, parseList } from './utils'; export const route: Route = { diff --git a/lib/routes/zaker/utils.ts b/lib/routes/zaker/utils.ts index ff3f6612b7..b0528c3f5c 100644 --- a/lib/routes/zaker/utils.ts +++ b/lib/routes/zaker/utils.ts @@ -1,11 +1,11 @@ -import { DataItem } from '@/types'; - -import CryptoJS from 'crypto-js'; -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; -import { config } from '@/config'; -import logger from '@/utils/logger'; import * as cheerio from 'cheerio'; +import CryptoJS from 'crypto-js'; + +import { config } from '@/config'; +import type { DataItem } from '@/types'; +import cache from '@/utils/cache'; +import logger from '@/utils/logger'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/zaobao/interactive.ts b/lib/routes/zaobao/interactive.ts index 84ef1710f8..491c46e497 100644 --- a/lib/routes/zaobao/interactive.ts +++ b/lib/routes/zaobao/interactive.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import { logo } from './util'; +import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { logo } from './util'; + export const route: Route = { path: '/interactive-graphics', categories: ['traditional-media'], diff --git a/lib/routes/zaobao/other.ts b/lib/routes/zaobao/other.ts index 44bbe867a0..02b0aa05d8 100644 --- a/lib/routes/zaobao/other.ts +++ b/lib/routes/zaobao/other.ts @@ -1,5 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { logo, parseList } from './util'; + const baseUrl = 'https://www.zaobao.com'; export const route: Route = { diff --git a/lib/routes/zaobao/realtime.ts b/lib/routes/zaobao/realtime.ts index 3c3799dc55..1ce55e27f9 100644 --- a/lib/routes/zaobao/realtime.ts +++ b/lib/routes/zaobao/realtime.ts @@ -1,5 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { logo, parseList } from './util'; + const baseUrl = 'https://www.zaobao.com'; export const route: Route = { diff --git a/lib/routes/zaobao/util.tsx b/lib/routes/zaobao/util.tsx index a7ecb1e082..fb2d7c5543 100644 --- a/lib/routes/zaobao/util.tsx +++ b/lib/routes/zaobao/util.tsx @@ -1,12 +1,14 @@ -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; import { renderToString } from 'hono/jsx/dom/server'; import { base32 } from 'rfc4648'; -import Zaobao from './zaobao'; + +import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; +import Zaobao from './zaobao'; + const baseUrl = 'https://www.zaobao.com'; export const logo = 'https://www.zaobao.com.sg/favicon.ico'; diff --git a/lib/routes/zaobao/zaobao.tsx b/lib/routes/zaobao/zaobao.tsx index 35575a8db9..4189fb1f13 100644 --- a/lib/routes/zaobao/zaobao.tsx +++ b/lib/routes/zaobao/zaobao.tsx @@ -1,4 +1,4 @@ -import { ImageData } from './util'; +import type { ImageData } from './util'; function zaobao({ imageDataArray, articleBody }) { return ( diff --git a/lib/routes/zaobao/znews.ts b/lib/routes/zaobao/znews.ts index c1c51a71fc..1c134b4d70 100644 --- a/lib/routes/zaobao/znews.ts +++ b/lib/routes/zaobao/znews.ts @@ -1,5 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; + import { logo, parseList } from './util'; + const baseUrl = 'https://www.zaobao.com'; export const route: Route = { diff --git a/lib/routes/zaozao/article.ts b/lib/routes/zaozao/article.ts index 2d7458354b..861b10a0ef 100644 --- a/lib/routes/zaozao/article.ts +++ b/lib/routes/zaozao/article.ts @@ -1,6 +1,6 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; +import type { Route } from '@/types'; import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; export const route: Route = { path: '/article/:type?', diff --git a/lib/routes/zcmu/jwc/index.ts b/lib/routes/zcmu/jwc/index.ts index 77c55a706d..8d51235fdc 100644 --- a/lib/routes/zcmu/jwc/index.ts +++ b/lib/routes/zcmu/jwc/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const host = 'https://jwc.zcmu.edu.cn/'; diff --git a/lib/routes/zcmu/yxy/index.ts b/lib/routes/zcmu/yxy/index.ts index 037a33f9f2..f65c612795 100644 --- a/lib/routes/zcmu/yxy/index.ts +++ b/lib/routes/zcmu/yxy/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const host = 'https://yxy.zcmu.edu.cn/'; diff --git a/lib/routes/zcool/discover.ts b/lib/routes/zcool/discover.ts index 7e176989fa..00483572af 100644 --- a/lib/routes/zcool/discover.ts +++ b/lib/routes/zcool/discover.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; + import locations from './locations'; export const route: Route = { diff --git a/lib/routes/zcool/top.ts b/lib/routes/zcool/top.ts index 5eb6f62fba..2e4443952a 100644 --- a/lib/routes/zcool/top.ts +++ b/lib/routes/zcool/top.ts @@ -1,9 +1,13 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + import { extractArticle, extractWork } from './utils'; + const baseUrl = 'https://www.zcool.com.cn'; export const route: Route = { diff --git a/lib/routes/zcool/user.ts b/lib/routes/zcool/user.ts index e77e2a95f2..13c7323937 100644 --- a/lib/routes/zcool/user.ts +++ b/lib/routes/zcool/user.ts @@ -1,11 +1,14 @@ -import { Route, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import { extractArticle, extractWork } from './utils'; import { isValidHost } from '@/utils/valid-host'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; + +import { extractArticle, extractWork } from './utils'; export const route: Route = { path: '/user/:uid', diff --git a/lib/routes/zcool/utils.ts b/lib/routes/zcool/utils.ts index a4ed7ec1a1..24b290b2b4 100644 --- a/lib/routes/zcool/utils.ts +++ b/lib/routes/zcool/utils.ts @@ -1,6 +1,7 @@ -import { art } from '@/utils/render'; import path from 'node:path'; +import { art } from '@/utils/render'; + const extractArticle = (data) => data.props.pageProps.data.summary + data.props.pageProps.data.memo; const extractWork = (data) => diff --git a/lib/routes/zed/blog.ts b/lib/routes/zed/blog.ts index 8f1d3f84bc..07db43160a 100644 --- a/lib/routes/zed/blog.ts +++ b/lib/routes/zed/blog.ts @@ -1,8 +1,10 @@ -import { Route, DataItem, Data, ViewType } from '@/types'; +import { load } from 'cheerio'; + +import type { Data, DataItem, Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import parser from '@/utils/rss-parser'; -import { load } from 'cheerio'; export const route: Route = { path: '/blog', diff --git a/lib/routes/zed/namespace.ts b/lib/routes/zed/namespace.ts index 64cb0f399d..1f665e4c40 100644 --- a/lib/routes/zed/namespace.ts +++ b/lib/routes/zed/namespace.ts @@ -1,4 +1,4 @@ -import { Namespace } from '@/types'; +import type { Namespace } from '@/types'; export const namespace: Namespace = { name: 'Zed', diff --git a/lib/routes/zhibo8/forum.ts b/lib/routes/zhibo8/forum.ts index 35517ea286..ece977fadb 100644 --- a/lib/routes/zhibo8/forum.ts +++ b/lib/routes/zhibo8/forum.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/zhibo8/luxiang.ts b/lib/routes/zhibo8/luxiang.ts index 14fd607d37..b1b9eaf94a 100644 --- a/lib/routes/zhibo8/luxiang.ts +++ b/lib/routes/zhibo8/luxiang.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/zhibo8/more.ts b/lib/routes/zhibo8/more.ts index b16982f0a9..3a8f678185 100644 --- a/lib/routes/zhibo8/more.ts +++ b/lib/routes/zhibo8/more.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; 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 timezone from '@/utils/timezone'; const categories = { nba: 'NBA', diff --git a/lib/routes/zhibo8/post.ts b/lib/routes/zhibo8/post.ts index 936d8f1ce2..ebd3102336 100644 --- a/lib/routes/zhibo8/post.ts +++ b/lib/routes/zhibo8/post.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/zhihu/activities.ts b/lib/routes/zhihu/activities.ts index a801031da4..709fa4983b 100644 --- a/lib/routes/zhihu/activities.ts +++ b/lib/routes/zhihu/activities.ts @@ -1,9 +1,12 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; -import { header, processImage, getSignedHeader } from './utils'; -import { parseDate } from '@/utils/parse-date'; import sanitizeHtml from 'sanitize-html'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + +import { getSignedHeader, header, processImage } from './utils'; + export const route: Route = { path: '/people/activities/:id', categories: ['social-media'], diff --git a/lib/routes/zhihu/all-collections.ts b/lib/routes/zhihu/all-collections.ts index 4020de3edc..adf55d3379 100644 --- a/lib/routes/zhihu/all-collections.ts +++ b/lib/routes/zhihu/all-collections.ts @@ -1,9 +1,11 @@ -import { Route, ViewType, Collection, CollectionItem } from '@/types'; -import got from '@/utils/got'; -import { header } from './utils'; -import { parseDate } from '@/utils/parse-date'; -import cache from '@/utils/cache'; import { config } from '@/config'; +import type { Collection, CollectionItem, Route } from '@/types'; +import { ViewType } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + +import { header } from './utils'; export const route: Route = { path: '/people/allCollections/:id', diff --git a/lib/routes/zhihu/answers.ts b/lib/routes/zhihu/answers.ts index b3113e74b3..dbf7d68a88 100644 --- a/lib/routes/zhihu/answers.ts +++ b/lib/routes/zhihu/answers.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import { header, getSignedHeader } from './utils'; import { parseDate } from '@/utils/parse-date'; +import { getSignedHeader, header } from './utils'; + export const route: Route = { path: '/people/answers/:id', categories: ['social-media'], diff --git a/lib/routes/zhihu/bookstore/newest.ts b/lib/routes/zhihu/bookstore/newest.ts index 0a50d41119..99ec0faa18 100644 --- a/lib/routes/zhihu/bookstore/newest.ts +++ b/lib/routes/zhihu/bookstore/newest.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/zhihu/check-cookie.ts b/lib/routes/zhihu/check-cookie.ts index 20d9f9badb..6d0938d92e 100644 --- a/lib/routes/zhihu/check-cookie.ts +++ b/lib/routes/zhihu/check-cookie.ts @@ -1,5 +1,5 @@ import { config } from '@/config'; -import { APIRoute } from '@/types'; +import type { APIRoute } from '@/types'; import ofetch from '@/utils/ofetch'; export const apiRoute: APIRoute = { diff --git a/lib/routes/zhihu/collection.ts b/lib/routes/zhihu/collection.ts index 34ec643210..2b6a45b746 100644 --- a/lib/routes/zhihu/collection.ts +++ b/lib/routes/zhihu/collection.ts @@ -1,11 +1,13 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import { config } from '@/config'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; -import { header } from './utils'; -import { generateData } from './pin/utils'; import { parseDate } from '@/utils/parse-date'; -import { config } from '@/config'; + +import { generateData } from './pin/utils'; +import { header } from './utils'; export const route: Route = { path: '/collection/:id/:getAll?', diff --git a/lib/routes/zhihu/daily-section.ts b/lib/routes/zhihu/daily-section.ts index b148d71633..20b63acabe 100644 --- a/lib/routes/zhihu/daily-section.ts +++ b/lib/routes/zhihu/daily-section.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; -import { header } from './utils'; import { parseDate } from '@/utils/parse-date'; +import { header } from './utils'; + // 参考:https://github.com/izzyleung/ZhihuDailyPurify/wiki/%E7%9F%A5%E4%B9%8E%E6%97%A5%E6%8A%A5-API-%E5%88%86%E6%9E%90 // 文章给出了v7版 api的信息,包含全文api diff --git a/lib/routes/zhihu/daily.ts b/lib/routes/zhihu/daily.ts index c5638ce6dc..2152c4357a 100644 --- a/lib/routes/zhihu/daily.ts +++ b/lib/routes/zhihu/daily.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/zhihu/hot.ts b/lib/routes/zhihu/hot.ts index e2ac65c33d..56237e0640 100644 --- a/lib/routes/zhihu/hot.ts +++ b/lib/routes/zhihu/hot.ts @@ -1,6 +1,7 @@ -import { Route, ViewType } from '@/types'; -import got from '@/utils/got'; import { config } from '@/config'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/zhihu/pin/daily.ts b/lib/routes/zhihu/pin/daily.ts index 5a08d021cd..12a872159f 100644 --- a/lib/routes/zhihu/pin/daily.ts +++ b/lib/routes/zhihu/pin/daily.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import { generateData } from './utils'; export const route: Route = { diff --git a/lib/routes/zhihu/pin/hotlist.ts b/lib/routes/zhihu/pin/hotlist.ts index 1955a2e88d..24957f8b8b 100644 --- a/lib/routes/zhihu/pin/hotlist.ts +++ b/lib/routes/zhihu/pin/hotlist.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import { generateData } from './utils'; export const route: Route = { diff --git a/lib/routes/zhihu/pin/people.ts b/lib/routes/zhihu/pin/people.ts index b396c22713..70fb6fe89a 100644 --- a/lib/routes/zhihu/pin/people.ts +++ b/lib/routes/zhihu/pin/people.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; + import { generateData } from './utils'; export const route: Route = { diff --git a/lib/routes/zhihu/posts.ts b/lib/routes/zhihu/posts.ts index 46639bb530..9dd0221077 100644 --- a/lib/routes/zhihu/posts.ts +++ b/lib/routes/zhihu/posts.ts @@ -1,10 +1,12 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; -import ofetch from '@/utils/ofetch'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; -import { header, getSignedHeader, processImage } from './utils'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import { Articles, Profile } from './types'; + +import type { Articles, Profile } from './types'; +import { getSignedHeader, header, processImage } from './utils'; export const route: Route = { path: '/posts/:usertype/:id', diff --git a/lib/routes/zhihu/question.ts b/lib/routes/zhihu/question.ts index 0dc56dfca2..843ff87b9b 100644 --- a/lib/routes/zhihu/question.ts +++ b/lib/routes/zhihu/question.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import { header, processImage, getSignedHeader } from './utils'; import { parseDate } from '@/utils/parse-date'; +import { getSignedHeader, header, processImage } from './utils'; + export const route: Route = { path: '/question/:questionId/:sortBy?', categories: ['social-media'], diff --git a/lib/routes/zhihu/timeline.ts b/lib/routes/zhihu/timeline.ts index 1c4c6b1cd0..0dd5454411 100644 --- a/lib/routes/zhihu/timeline.ts +++ b/lib/routes/zhihu/timeline.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { config } from '@/config'; -import { processImage } from './utils'; -import { parseDate } from '@/utils/parse-date'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + +import { processImage } from './utils'; export const route: Route = { path: '/timeline', diff --git a/lib/routes/zhihu/topic.ts b/lib/routes/zhihu/topic.ts index 29bd7e19d4..da7fb17326 100644 --- a/lib/routes/zhihu/topic.ts +++ b/lib/routes/zhihu/topic.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { header, processImage, getSignedHeader } from './utils'; import { parseDate } from '@/utils/parse-date'; +import { getSignedHeader, header, processImage } from './utils'; + export const route: Route = { path: '/topic/:topicId/:isTop?', categories: ['social-media'], diff --git a/lib/routes/zhihu/utils.ts b/lib/routes/zhihu/utils.ts index fcdecf21ad..23119ba79b 100644 --- a/lib/routes/zhihu/utils.ts +++ b/lib/routes/zhihu/utils.ts @@ -1,9 +1,11 @@ import { load } from 'cheerio'; -import cache from '@/utils/cache'; -import ofetch from '@/utils/ofetch'; -import g_encrypt from './execlib/x-zse-96-v3'; -import md5 from '@/utils/md5'; + import { config } from '@/config'; +import cache from '@/utils/cache'; +import md5 from '@/utils/md5'; +import ofetch from '@/utils/ofetch'; + +import g_encrypt from './execlib/x-zse-96-v3'; export const header = { 'x-api-version': '3.0.91', diff --git a/lib/routes/zhihu/weekly.ts b/lib/routes/zhihu/weekly.ts index 371304507c..66c0c99b19 100644 --- a/lib/routes/zhihu/weekly.ts +++ b/lib/routes/zhihu/weekly.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + const host = 'https://www.zhihu.com'; export const route: Route = { diff --git a/lib/routes/zhihu/xhu/activities.ts b/lib/routes/zhihu/xhu/activities.ts index d5c892a366..f50d03a606 100644 --- a/lib/routes/zhihu/xhu/activities.ts +++ b/lib/routes/zhihu/xhu/activities.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import auth from './auth'; -import { processImage } from '../utils'; import { parseDate } from '@/utils/parse-date'; +import { processImage } from '../utils'; +import auth from './auth'; + export const route: Route = { path: '/xhu/people/activities/:hexId', categories: ['social-media'], diff --git a/lib/routes/zhihu/xhu/answers.ts b/lib/routes/zhihu/xhu/answers.ts index 39dc67f992..1b103b1dd9 100644 --- a/lib/routes/zhihu/xhu/answers.ts +++ b/lib/routes/zhihu/xhu/answers.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import auth from './auth'; import { parseDate } from '@/utils/parse-date'; +import auth from './auth'; + export const route: Route = { path: '/xhu/people/answers/:hexId', categories: ['social-media'], diff --git a/lib/routes/zhihu/xhu/collection.ts b/lib/routes/zhihu/xhu/collection.ts index b0ac9a7051..66495d08eb 100644 --- a/lib/routes/zhihu/xhu/collection.ts +++ b/lib/routes/zhihu/xhu/collection.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import auth from './auth'; -import { generateData } from '../pin/utils'; import { parseDate } from '@/utils/parse-date'; +import { generateData } from '../pin/utils'; +import auth from './auth'; + export const route: Route = { path: '/xhu/collection/:id', categories: ['social-media'], diff --git a/lib/routes/zhihu/xhu/posts.ts b/lib/routes/zhihu/xhu/posts.ts index c71ea46ded..d62e06163b 100644 --- a/lib/routes/zhihu/xhu/posts.ts +++ b/lib/routes/zhihu/xhu/posts.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import auth from './auth'; import { parseDate } from '@/utils/parse-date'; +import auth from './auth'; + export const route: Route = { path: '/xhu/people/posts/:hexId', categories: ['social-media'], diff --git a/lib/routes/zhihu/xhu/question.ts b/lib/routes/zhihu/xhu/question.ts index 7eeaee78e2..f4d9a2ce32 100644 --- a/lib/routes/zhihu/xhu/question.ts +++ b/lib/routes/zhihu/xhu/question.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import auth from './auth'; -import { processImage } from '../utils'; import { parseDate } from '@/utils/parse-date'; +import { processImage } from '../utils'; +import auth from './auth'; + export const route: Route = { path: '/xhu/question/:questionId/:sortBy?', categories: ['social-media'], diff --git a/lib/routes/zhihu/xhu/topic.ts b/lib/routes/zhihu/xhu/topic.ts index da6556f141..3fa7a44ee3 100644 --- a/lib/routes/zhihu/xhu/topic.ts +++ b/lib/routes/zhihu/xhu/topic.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; -import auth from './auth'; -import { processImage } from '../utils'; import { parseDate } from '@/utils/parse-date'; +import { processImage } from '../utils'; +import auth from './auth'; + export const route: Route = { path: '/xhu/topic/:topicId', categories: ['social-media'], diff --git a/lib/routes/zhihu/xhu/zhuanlan.ts b/lib/routes/zhihu/xhu/zhuanlan.ts index 91d0bd7bb0..b31f35d913 100644 --- a/lib/routes/zhihu/xhu/zhuanlan.ts +++ b/lib/routes/zhihu/xhu/zhuanlan.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import auth from './auth'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import auth from './auth'; + export const route: Route = { path: '/xhu/zhuanlan/:id', categories: ['social-media'], diff --git a/lib/routes/zhihu/zhuanlan.ts b/lib/routes/zhihu/zhuanlan.ts index a7cfbf107a..8ae250a839 100644 --- a/lib/routes/zhihu/zhuanlan.ts +++ b/lib/routes/zhihu/zhuanlan.ts @@ -1,9 +1,11 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import { getSignedHeader, header } from './utils'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; +import { getSignedHeader, header } from './utils'; + export const route: Route = { path: '/zhuanlan/:id', categories: ['social-media'], diff --git a/lib/routes/zhitongcaijing/index.ts b/lib/routes/zhitongcaijing/index.ts index 0347366890..0868ef6250 100644 --- a/lib/routes/zhitongcaijing/index.ts +++ b/lib/routes/zhitongcaijing/index.ts @@ -1,11 +1,13 @@ -import { Route, ViewType } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route} from '@/types'; +import { ViewType } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const ids = { recommend: { diff --git a/lib/routes/zhiy/letter.ts b/lib/routes/zhiy/letter.ts index 04d3d31dfd..69cf92cfc6 100644 --- a/lib/routes/zhiy/letter.ts +++ b/lib/routes/zhiy/letter.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; + import { baseUrl, fetchUserDate } from './utils'; export const route: Route = { diff --git a/lib/routes/zhiy/post.ts b/lib/routes/zhiy/post.ts index 25888e59e2..284534c37e 100644 --- a/lib/routes/zhiy/post.ts +++ b/lib/routes/zhiy/post.ts @@ -1,12 +1,14 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import dayjs from 'dayjs'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; -import { baseUrl, fetchUserDate } from './utils'; import { art } from '@/utils/render'; -import path from 'node:path'; -import dayjs from 'dayjs'; + +import { baseUrl, fetchUserDate } from './utils'; export const route: Route = { path: '/posts/:author', diff --git a/lib/routes/zhizhuan100/report.ts b/lib/routes/zhizhuan100/report.ts index b719e831d8..291a727158 100644 --- a/lib/routes/zhizhuan100/report.ts +++ b/lib/routes/zhizhuan100/report.ts @@ -1,8 +1,10 @@ -import { Route, ViewType } from '@/types'; -import { parseRelativeDate } from '@/utils/parse-date'; -import ofetch from '@/utils/ofetch'; import * as cheerio from 'cheerio'; +import type { Route} from '@/types'; +import { ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseRelativeDate } from '@/utils/parse-date'; + export const route: Route = { path: '/analytic', categories: ['finance'], diff --git a/lib/routes/zhonglun/index.ts b/lib/routes/zhonglun/index.ts index 960c6184ba..525b579948 100644 --- a/lib/routes/zhonglun/index.ts +++ b/lib/routes/zhonglun/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const handler = async (ctx) => { const { language = 'zh' } = ctx.req.param(); diff --git a/lib/routes/zhubai/index.ts b/lib/routes/zhubai/index.ts index bc8e9b5ee0..8ca6ad9188 100644 --- a/lib/routes/zhubai/index.ts +++ b/lib/routes/zhubai/index.ts @@ -1,5 +1,5 @@ import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import { isValidHost } from '@/utils/valid-host'; diff --git a/lib/routes/zhubai/top20.ts b/lib/routes/zhubai/top20.ts index 8aff6dc2a3..ddf03da42d 100644 --- a/lib/routes/zhubai/top20.ts +++ b/lib/routes/zhubai/top20.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; const parseContent = (content) => art(path.join(__dirname, 'templates/description.art'), { diff --git a/lib/routes/zhujiceping/rss.ts b/lib/routes/zhujiceping/rss.ts index a85f9cd304..405a580b45 100644 --- a/lib/routes/zhujiceping/rss.ts +++ b/lib/routes/zhujiceping/rss.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + export const route: Route = { path: '/', categories: ['blog'], diff --git a/lib/routes/zhuwang/index.ts b/lib/routes/zhuwang/index.ts index 40201cd8de..f530a238e9 100644 --- a/lib/routes/zhuwang/index.ts +++ b/lib/routes/zhuwang/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/routes/zimuxia/index.ts b/lib/routes/zimuxia/index.ts index 7939ba9f66..e1e3051cbb 100644 --- a/lib/routes/zimuxia/index.ts +++ b/lib/routes/zimuxia/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; export const route: Route = { path: '/:category?', diff --git a/lib/routes/zimuxia/portfolio.ts b/lib/routes/zimuxia/portfolio.ts index 1040f5ebe3..b2c127d8d3 100644 --- a/lib/routes/zimuxia/portfolio.ts +++ b/lib/routes/zimuxia/portfolio.ts @@ -1,6 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; + const allowlinktypes = new Set(['all', 'magnet', 'ed2k', 'baidu', 'subhd', 'quark', '115']); export const route: Route = { diff --git a/lib/routes/zjgtjy/index.ts b/lib/routes/zjgtjy/index.ts index 47826ad0de..6e39c92abe 100644 --- a/lib/routes/zjgtjy/index.ts +++ b/lib/routes/zjgtjy/index.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; diff --git a/lib/routes/zjol/paper.ts b/lib/routes/zjol/paper.ts index 3462674a26..258c08116e 100644 --- a/lib/routes/zjol/paper.ts +++ b/lib/routes/zjol/paper.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import InvalidParameterError from '@/errors/types/invalid-parameter'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; -import InvalidParameterError from '@/errors/types/invalid-parameter'; export const route: Route = { path: '/paper/:id?', diff --git a/lib/routes/zju/career/index.ts b/lib/routes/zju/career/index.ts index 85cdab3479..305147721e 100644 --- a/lib/routes/zju/career/index.ts +++ b/lib/routes/zju/career/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; const rootUrl = 'http://www.career.zju.edu.cn'; diff --git a/lib/routes/zju/cse/index.ts b/lib/routes/zju/cse/index.ts index e5daab4edb..4473eb2eca 100644 --- a/lib/routes/zju/cse/index.ts +++ b/lib/routes/zju/cse/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/zju/cst/custom.ts b/lib/routes/zju/cst/custom.ts index 8654adb47c..bb5bdcf188 100644 --- a/lib/routes/zju/cst/custom.ts +++ b/lib/routes/zju/cst/custom.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; async function getPage(id) { diff --git a/lib/routes/zju/cst/index.ts b/lib/routes/zju/cst/index.ts index 18a24947d7..8845bce077 100644 --- a/lib/routes/zju/cst/index.ts +++ b/lib/routes/zju/cst/index.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const host = 'http://www.cst.zju.edu.cn/'; diff --git a/lib/routes/zju/grs/index.ts b/lib/routes/zju/grs/index.ts index a8e53dc214..a9a94b14ea 100644 --- a/lib/routes/zju/grs/index.ts +++ b/lib/routes/zju/grs/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/zju/list.ts b/lib/routes/zju/list.ts index 27b304a6af..4e86f28a0d 100644 --- a/lib/routes/zju/list.ts +++ b/lib/routes/zju/list.ts @@ -1,8 +1,10 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; + const host = 'https://www.zju.edu.cn/'; export const route: Route = { path: '/list/:type', diff --git a/lib/routes/zju/physics/index.ts b/lib/routes/zju/physics/index.ts index ff37b594dd..f6c3c35ac4 100644 --- a/lib/routes/zju/physics/index.ts +++ b/lib/routes/zju/physics/index.ts @@ -1,6 +1,7 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; +import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; // const host = 'http://physics.zju.edu.cn/redir.php?catalog_id='; diff --git a/lib/routes/zju/sis/index.ts b/lib/routes/zju/sis/index.ts index 9d08ec9449..c68955fa2e 100644 --- a/lib/routes/zju/sis/index.ts +++ b/lib/routes/zju/sis/index.ts @@ -1,7 +1,8 @@ -import { DataItem, Route } from '@/types'; +import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; const base = 'http://www.sis.zju.edu.cn/sischinese/'; diff --git a/lib/routes/zjut/cs/index.ts b/lib/routes/zjut/cs/index.ts index bc55eb701e..06c4ec751d 100644 --- a/lib/routes/zjut/cs/index.ts +++ b/lib/routes/zjut/cs/index.ts @@ -1,8 +1,9 @@ -import { Data, Route } from '@/types'; -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; import { load } from 'cheerio'; + +import type { Data, Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; const rootUrl = 'https://cs.zjut.edu.cn/jsp/newsclass.jsp?wcId='; diff --git a/lib/routes/zjut/da/index.ts b/lib/routes/zjut/da/index.ts index 4869dadcbc..77e230503b 100644 --- a/lib/routes/zjut/da/index.ts +++ b/lib/routes/zjut/da/index.ts @@ -1,10 +1,11 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; import { load } from 'cheerio'; import iconv from 'iconv-lite'; +import type { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + const rootUrl = 'http://www.design.zjut.edu.cn/'; const host = 'http://www.design.zjut.edu.cn/BigClass.jsp?'; diff --git a/lib/routes/zjut/jwc/index.ts b/lib/routes/zjut/jwc/index.ts index 1708484809..e214d0f2b4 100644 --- a/lib/routes/zjut/jwc/index.ts +++ b/lib/routes/zjut/jwc/index.ts @@ -1,8 +1,9 @@ -import { Data, Route } from '@/types'; -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; import { load } from 'cheerio'; + +import type { Data, Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; const rootUrl = 'http://www.jwc.zjut.edu.cn/'; diff --git a/lib/routes/zjut/news.ts b/lib/routes/zjut/news.ts index 8529172e8d..5571f18e09 100644 --- a/lib/routes/zjut/news.ts +++ b/lib/routes/zjut/news.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; diff --git a/lib/routes/zjut/www/index.ts b/lib/routes/zjut/www/index.ts index 4f4fb3ad1f..cd489f22cc 100644 --- a/lib/routes/zjut/www/index.ts +++ b/lib/routes/zjut/www/index.ts @@ -1,8 +1,9 @@ -import { Data, Route } from '@/types'; -import cache from '@/utils/cache'; -import { parseDate } from '@/utils/parse-date'; import { load } from 'cheerio'; + +import type { Data, Route } from '@/types'; +import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; const rootUrl = 'https://www.zjut.edu.cn/'; diff --git a/lib/routes/zjuvag/blog.ts b/lib/routes/zjuvag/blog.ts index b583bbe4cf..3b78844372 100644 --- a/lib/routes/zjuvag/blog.ts +++ b/lib/routes/zjuvag/blog.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 + +import type { Route } from '@/types'; // 导入必要的模组 import got from '@/utils/got'; // 自订的 got -import { load } from 'cheerio'; // 可以使用类似 jQuery 的 API HTML 解析器 import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/zodgame/forum.ts b/lib/routes/zodgame/forum.ts index 79a1118cc1..cb7d1d3b5f 100644 --- a/lib/routes/zodgame/forum.ts +++ b/lib/routes/zodgame/forum.ts @@ -1,12 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { config } from '@/config'; +import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { config } from '@/config'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; -import ConfigNotFoundError from '@/errors/types/config-not-found'; const rootUrl = 'https://zodgame.xyz'; diff --git a/lib/routes/zongheng/detail.ts b/lib/routes/zongheng/detail.ts index aa05b7c332..91bba2bddb 100644 --- a/lib/routes/zongheng/detail.ts +++ b/lib/routes/zongheng/detail.ts @@ -1,6 +1,7 @@ -import { DataItem, Route } from '@/types'; -import ofetch from '@/utils/ofetch'; import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; diff --git a/lib/routes/zotero/versions.ts b/lib/routes/zotero/versions.ts index a291545bc5..cba8375168 100644 --- a/lib/routes/zotero/versions.ts +++ b/lib/routes/zotero/versions.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; + export const route: Route = { path: '/versions', categories: ['program-update'], diff --git a/lib/routes/zrblog/rss.ts b/lib/routes/zrblog/rss.ts index 4a16d77cd5..33a6219705 100644 --- a/lib/routes/zrblog/rss.ts +++ b/lib/routes/zrblog/rss.ts @@ -1,8 +1,9 @@ -import { Route } from '@/types'; -import { parseDate } from '@/utils/parse-date'; -import got from '@/utils/got'; import { load } from 'cheerio'; +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + export const route: Route = { path: '/', categories: ['blog'], diff --git a/lib/routes/zsxq/group.ts b/lib/routes/zsxq/group.ts index 6b743266b7..358ecedd92 100644 --- a/lib/routes/zsxq/group.ts +++ b/lib/routes/zsxq/group.ts @@ -1,7 +1,9 @@ -import type { Data, Route } from '@/types'; import type { Context } from 'hono'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Data, Route } from '@/types'; + import type { GroupInfoResponse, TopicsResponse } from './types'; import { customFetch, generateTopicDataItem } from './utils'; diff --git a/lib/routes/zsxq/user.ts b/lib/routes/zsxq/user.ts index c728f19c90..aa4eb0bd1a 100644 --- a/lib/routes/zsxq/user.ts +++ b/lib/routes/zsxq/user.ts @@ -1,7 +1,9 @@ -import type { Data, Route } from '@/types'; import type { Context } from 'hono'; + import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; +import type { Data, Route } from '@/types'; + import type { TopicsResponse, UserInfoResponse } from './types'; import { customFetch, generateTopicDataItem } from './utils'; diff --git a/lib/routes/zsxq/utils.ts b/lib/routes/zsxq/utils.ts index 31258346e1..570e27854d 100644 --- a/lib/routes/zsxq/utils.ts +++ b/lib/routes/zsxq/utils.ts @@ -1,8 +1,9 @@ -import got from '@/utils/got'; -import type { TopicImage, Topic, BasicResponse, ResponseData } from './types'; -import { parseDate } from '@/utils/parse-date'; import { config } from '@/config'; import type { DataItem } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + +import type { BasicResponse, ResponseData, Topic, TopicImage } from './types'; export async function customFetch>(path: string, retryCount = 0): Promise { const apiUrl = 'https://api.zsxq.com/v2'; diff --git a/lib/routes/zuel/notice.ts b/lib/routes/zuel/notice.ts index 4bd5854b53..5722183d68 100644 --- a/lib/routes/zuel/notice.ts +++ b/lib/routes/zuel/notice.ts @@ -1,7 +1,8 @@ -import { Route } from '@/types'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; export const route: Route = { diff --git a/lib/routes/zuvio/boards.ts b/lib/routes/zuvio/boards.ts index f346118412..3e429593b6 100644 --- a/lib/routes/zuvio/boards.ts +++ b/lib/routes/zuvio/boards.ts @@ -1,5 +1,6 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; + import { getBoards, rootUrl } from './utils'; export const route: Route = { diff --git a/lib/routes/zuvio/student5.ts b/lib/routes/zuvio/student5.ts index 03801d45de..d99219879a 100644 --- a/lib/routes/zuvio/student5.ts +++ b/lib/routes/zuvio/student5.ts @@ -1,9 +1,10 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; -import { token, apiUrl, rootUrl, renderDesc, getBoards } from './utils'; + +import { apiUrl, getBoards, renderDesc, rootUrl, token } from './utils'; export const route: Route = { path: '/student5/:board?', diff --git a/lib/routes/zuvio/utils.ts b/lib/routes/zuvio/utils.ts index 2644ae8c53..d5f1159aee 100644 --- a/lib/routes/zuvio/utils.ts +++ b/lib/routes/zuvio/utils.ts @@ -1,6 +1,7 @@ -import { art } from '@/utils/render'; import path from 'node:path'; + import got from '@/utils/got'; +import { art } from '@/utils/render'; const token = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE0OTcyMzI1MjMsInN5c3RlbV9uYW1lIjoiZm9ydW0iLCJ6dXZpb19pZCI6LTk5OSwiZW1haWwiOm51bGwsIm5hbWUiOm51bGwsInVuaXZlcnNpdHlfaWQiOm51bGwsInVuaXZlcnNpdHlfbmFtZSI6bnVsbH0.0KoJiSnyazsJxLCNEnqnuNUdKsJFhBdCn3R2BJpoUtk'; @@ -66,4 +67,4 @@ const getBoards = (tryGet) => })); }); -export { token, apiUrl, rootUrl, renderDesc, renderSections, getBoards }; +export { apiUrl, getBoards, renderDesc, renderSections, rootUrl, token }; diff --git a/lib/routes/zxcs/novel.ts b/lib/routes/zxcs/novel.ts index 481aeb7496..6c5d19c65d 100644 --- a/lib/routes/zxcs/novel.ts +++ b/lib/routes/zxcs/novel.ts @@ -1,8 +1,9 @@ import { load } from 'cheerio'; + +import type { DataItem, Route } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; -import type { Route, DataItem } from '@/types'; const types = { jinqigengxin: '近期更新', diff --git a/lib/routes/zyshow/index.ts b/lib/routes/zyshow/index.ts index 01748bc5c4..f52698381c 100644 --- a/lib/routes/zyshow/index.ts +++ b/lib/routes/zyshow/index.ts @@ -1,11 +1,12 @@ -import { Route } from '@/types'; +import path from 'node:path'; +import { load } from 'cheerio'; + +import type { Route } from '@/types'; import { getSubPath } from '@/utils/common-utils'; import got from '@/utils/got'; -import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; -import path from 'node:path'; export const route: Route = { path: '*', diff --git a/lib/routes/zyw/hot.ts b/lib/routes/zyw/hot.ts index e7a0da314f..b0f78c5515 100644 --- a/lib/routes/zyw/hot.ts +++ b/lib/routes/zyw/hot.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import type { Route } from '@/types'; import got from '@/utils/got'; export const route: Route = { diff --git a/lib/setup.test.ts b/lib/setup.test.ts index b479f4f9a9..e8a6a8dc36 100644 --- a/lib/setup.test.ts +++ b/lib/setup.test.ts @@ -1,6 +1,6 @@ -import { afterAll, afterEach } from 'vitest'; -import { setupServer } from 'msw/node'; import { http, HttpResponse } from 'msw'; +import { setupServer } from 'msw/node'; +import { afterAll, afterEach } from 'vitest'; const genWeChatMpPage = (rich_media_content: string, scripts: string[] | string) => { if (!Array.isArray(scripts)) { diff --git a/lib/utils/cache.test.ts b/lib/utils/cache.test.ts index 05b1acd38f..204457d252 100644 --- a/lib/utils/cache.test.ts +++ b/lib/utils/cache.test.ts @@ -1,4 +1,5 @@ -import { describe, expect, it, vi, afterEach, afterAll, beforeAll } from 'vitest'; +import { afterAll, afterEach, beforeAll, describe, expect, it, vi } from 'vitest'; + import wait from '@/utils/wait'; beforeAll(() => { diff --git a/lib/utils/cache/index.ts b/lib/utils/cache/index.ts index a9a70f0fc7..4871a20a4c 100644 --- a/lib/utils/cache/index.ts +++ b/lib/utils/cache/index.ts @@ -1,9 +1,10 @@ import { config } from '@/config'; -import redis from './redis'; -import memory from './memory'; -import type CacheModule from './base'; import logger from '@/utils/logger'; +import type CacheModule from './base'; +import memory from './memory'; +import redis from './redis'; + const globalCache: { get: (key: string) => Promise | string | null | undefined; set: (key: string, value?: string | Record, maxAge?: number) => any; diff --git a/lib/utils/cache/memory.ts b/lib/utils/cache/memory.ts index 395f35602c..93b315eb27 100644 --- a/lib/utils/cache/memory.ts +++ b/lib/utils/cache/memory.ts @@ -1,5 +1,7 @@ import { LRUCache } from 'lru-cache'; + import { config } from '@/config'; + import type CacheModule from './base'; const status = { available: false }; diff --git a/lib/utils/cache/redis.ts b/lib/utils/cache/redis.ts index a3ba5850c3..86b2561930 100644 --- a/lib/utils/cache/redis.ts +++ b/lib/utils/cache/redis.ts @@ -1,6 +1,8 @@ -import { config } from '@/config'; import Redis from 'ioredis'; + +import { config } from '@/config'; import logger from '@/utils/logger'; + import type CacheModule from './base'; const status = { available: false }; diff --git a/lib/utils/common-config.test.ts b/lib/utils/common-config.test.ts index d739ffeb3f..7cac7f5a67 100644 --- a/lib/utils/common-config.test.ts +++ b/lib/utils/common-config.test.ts @@ -1,5 +1,6 @@ import { describe, expect, it } from 'vitest'; -import configUtils, { transElemText, replaceParams, getProp } from '@/utils/common-config'; + +import configUtils, { getProp, replaceParams, transElemText } from '@/utils/common-config'; describe('index', () => { it('transElemText', () => { diff --git a/lib/utils/common-config.ts b/lib/utils/common-config.ts index d06b2aad86..f8acc81b56 100644 --- a/lib/utils/common-config.ts +++ b/lib/utils/common-config.ts @@ -1,6 +1,7 @@ import { load } from 'cheerio'; -import ofetch from '@/utils/ofetch'; import iconv from 'iconv-lite'; + +import ofetch from '@/utils/ofetch'; import { parseDate as _parseDate } from '@/utils/parse-date'; import _timezone from '@/utils/timezone'; @@ -76,4 +77,4 @@ async function buildData(data) { } export default buildData; -export { transElemText, replaceParams, getProp }; +export { getProp, replaceParams, transElemText }; diff --git a/lib/utils/common-utils.test.ts b/lib/utils/common-utils.test.ts index a13f9a2616..d496b19083 100644 --- a/lib/utils/common-utils.test.ts +++ b/lib/utils/common-utils.test.ts @@ -1,5 +1,6 @@ import { describe, expect, it } from 'vitest'; -import { toTitleCase, collapseWhitespace, convertDateToISO8601, getLocalhostAddress } from '@/utils/common-utils'; + +import { collapseWhitespace, convertDateToISO8601, getLocalhostAddress, toTitleCase } from '@/utils/common-utils'; describe('common-utils', () => { it('toTitleCase', () => { diff --git a/lib/utils/common-utils.ts b/lib/utils/common-utils.ts index a1e44dfeb7..5515a0db43 100644 --- a/lib/utils/common-utils.ts +++ b/lib/utils/common-utils.ts @@ -1,7 +1,9 @@ -import { parseDate } from '@/utils/parse-date'; -import title from 'title'; import os from 'node:os'; +import title from 'title'; + +import { parseDate } from '@/utils/parse-date'; + // convert a string into title case const toTitleCase = (str: string) => title(str); @@ -43,4 +45,4 @@ const getLocalhostAddress = () => { return address; }; -export { toTitleCase, collapseWhitespace, convertDateToISO8601, getSubPath, getLocalhostAddress }; +export { collapseWhitespace, convertDateToISO8601, getLocalhostAddress, getSubPath, toTitleCase }; diff --git a/lib/utils/git-hash.ts b/lib/utils/git-hash.ts index e33b350f32..458651ac24 100644 --- a/lib/utils/git-hash.ts +++ b/lib/utils/git-hash.ts @@ -11,4 +11,4 @@ if (!gitHash) { } } -export { gitHash, gitDate }; +export { gitDate, gitHash }; diff --git a/lib/utils/got-deprecated.ts b/lib/utils/got-deprecated.ts index d99ddc3f6d..7d8fc55d91 100644 --- a/lib/utils/got-deprecated.ts +++ b/lib/utils/got-deprecated.ts @@ -1,6 +1,8 @@ -import logger from '@/utils/logger'; +import type { CancelableRequest, Got, Options, OptionsInit, Response as GotResponse } from 'got'; +import got from 'got'; + import { config } from '@/config'; -import got, { CancelableRequest, Response as GotResponse, OptionsInit, Options, Got } from 'got'; +import logger from '@/utils/logger'; type Response = GotResponse & { data: T; @@ -76,4 +78,4 @@ const custom: { custom.all = (list) => Promise.all(list); export default custom; -export type { Response, Options } from 'got'; +export type { Options, Response } from 'got'; diff --git a/lib/utils/got.test.ts b/lib/utils/got.test.ts index 233a014305..bc1d404ad1 100644 --- a/lib/utils/got.test.ts +++ b/lib/utils/got.test.ts @@ -1,8 +1,9 @@ -import { describe, expect, it, vi } from 'vitest'; import { http, HttpResponse } from 'msw'; -import got from '@/utils/got'; -import { config } from '@/config'; import { Cookie, CookieJar } from 'tough-cookie'; +import { describe, expect, it, vi } from 'vitest'; + +import { config } from '@/config'; +import got from '@/utils/got'; describe('got', () => { it('no ua headers', async () => { diff --git a/lib/utils/got.ts b/lib/utils/got.ts index 372fe125b3..deb9d7cbbf 100644 --- a/lib/utils/got.ts +++ b/lib/utils/got.ts @@ -1,5 +1,7 @@ import { destr } from 'destr'; + import ofetch from '@/utils/ofetch'; + import { getSearchParamsString } from './helpers'; const getFakeGot = (defaultOptions?: any) => { diff --git a/lib/utils/header-generator.test.ts b/lib/utils/header-generator.test.ts index a18f805363..e149ae380c 100644 --- a/lib/utils/header-generator.test.ts +++ b/lib/utils/header-generator.test.ts @@ -1,6 +1,7 @@ import { describe, expect, it } from 'vitest'; -import ofetch from '@/utils/ofetch'; + import { generateHeaders, PRESETS } from '@/utils/header-generator'; +import ofetch from '@/utils/ofetch'; describe('header-generator', () => { it('should has no ua', async () => { diff --git a/lib/utils/header-generator.ts b/lib/utils/header-generator.ts index 230f94f4f9..fd9241be8a 100644 --- a/lib/utils/header-generator.ts +++ b/lib/utils/header-generator.ts @@ -1,4 +1,4 @@ -import { HeaderGenerator, PRESETS, type HeaderGeneratorOptions } from 'header-generator'; +import { HeaderGenerator, type HeaderGeneratorOptions, PRESETS } from 'header-generator'; export { PRESETS } from 'header-generator'; diff --git a/lib/utils/helpers.test.ts b/lib/utils/helpers.test.ts index b5029365f8..8a8fd4adbe 100644 --- a/lib/utils/helpers.test.ts +++ b/lib/utils/helpers.test.ts @@ -1,4 +1,5 @@ import { describe, expect, it } from 'vitest'; + import { getRouteNameFromPath, getSearchParamsString, parseDuration } from '@/utils/helpers'; describe('helpers', () => { diff --git a/lib/utils/helpers.ts b/lib/utils/helpers.ts index 63c8ca3a09..bf2a8c82eb 100644 --- a/lib/utils/helpers.ts +++ b/lib/utils/helpers.ts @@ -1,5 +1,6 @@ -import { fileURLToPath } from 'node:url'; import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + import { stringifyQuery } from 'ufo'; export const getRouteNameFromPath = (path: string) => { diff --git a/lib/utils/logger.ts b/lib/utils/logger.ts index 2243197838..bfb7be7ef9 100644 --- a/lib/utils/logger.ts +++ b/lib/utils/logger.ts @@ -1,5 +1,7 @@ import path from 'node:path'; + import winston from 'winston'; + import { config } from '@/config'; let transports: (typeof winston.transports.File)[] = []; diff --git a/lib/utils/md5.test.ts b/lib/utils/md5.test.ts index f0c56341e0..67eb9df38c 100644 --- a/lib/utils/md5.test.ts +++ b/lib/utils/md5.test.ts @@ -1,4 +1,5 @@ import { describe, expect, it } from 'vitest'; + import md5 from '@/utils/md5'; describe('md5', () => { diff --git a/lib/utils/ofetch.test.ts b/lib/utils/ofetch.test.ts index 7dfa88a838..7b52c2752f 100644 --- a/lib/utils/ofetch.test.ts +++ b/lib/utils/ofetch.test.ts @@ -1,7 +1,8 @@ -import { describe, expect, it, vi } from 'vitest'; import { http, HttpResponse } from 'msw'; -import ofetch from '@/utils/ofetch'; +import { describe, expect, it, vi } from 'vitest'; + import { config } from '@/config'; +import ofetch from '@/utils/ofetch'; describe('ofetch', () => { it('headers', async () => { diff --git a/lib/utils/ofetch.ts b/lib/utils/ofetch.ts index ed4279742b..fe5db4b7d1 100644 --- a/lib/utils/ofetch.ts +++ b/lib/utils/ofetch.ts @@ -1,8 +1,9 @@ +import type { HeaderGeneratorOptions } from 'header-generator'; +import { register } from 'node-network-devtools'; import { createFetch } from 'ofetch'; + import { config } from '@/config'; import logger from '@/utils/logger'; -import { register } from 'node-network-devtools'; -import type { HeaderGeneratorOptions } from 'header-generator'; declare module 'ofetch' { interface FetchOptions { diff --git a/lib/utils/otel/metric.ts b/lib/utils/otel/metric.ts index 97241ed76f..970ac20176 100644 --- a/lib/utils/otel/metric.ts +++ b/lib/utils/otel/metric.ts @@ -1,8 +1,9 @@ -import { resourceFromAttributes } from '@opentelemetry/resources'; -import { PrometheusExporter, PrometheusSerializer } from '@opentelemetry/exporter-prometheus'; -import { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions'; -import { MeterProvider } from '@opentelemetry/sdk-metrics'; import type { Attributes } from '@opentelemetry/api'; +import { PrometheusExporter, PrometheusSerializer } from '@opentelemetry/exporter-prometheus'; +import { resourceFromAttributes } from '@opentelemetry/resources'; +import { MeterProvider } from '@opentelemetry/sdk-metrics'; +import { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions'; + import { config } from '@/config'; interface IMetricAttributes extends Attributes { diff --git a/lib/utils/otel/trace.ts b/lib/utils/otel/trace.ts index 144602b1bb..f3113fe081 100644 --- a/lib/utils/otel/trace.ts +++ b/lib/utils/otel/trace.ts @@ -1,8 +1,8 @@ +import { trace } from '@opentelemetry/api'; +import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http'; import { resourceFromAttributes } from '@opentelemetry/resources'; import { BasicTracerProvider, BatchSpanProcessor } from '@opentelemetry/sdk-trace-base'; import { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions'; -import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http'; -import { trace } from '@opentelemetry/api'; const exporter = new OTLPTraceExporter({ // optional OTEL_EXPORTER_OTLP_ENDPOINT=https://localhost:4318 diff --git a/lib/utils/parse-date.test.ts b/lib/utils/parse-date.test.ts index f4a5c2078f..f9e8200a3b 100644 --- a/lib/utils/parse-date.test.ts +++ b/lib/utils/parse-date.test.ts @@ -1,6 +1,7 @@ -import { describe, expect, it } from 'vitest'; -import { parseRelativeDate } from '@/utils/parse-date'; import MockDate from 'mockdate'; +import { describe, expect, it } from 'vitest'; + +import { parseRelativeDate } from '@/utils/parse-date'; describe('parseRelativeDate', () => { const second = 1000; diff --git a/lib/utils/proxy/index.ts b/lib/utils/proxy/index.ts index 4eb86afd5f..53e3835298 100644 --- a/lib/utils/proxy/index.ts +++ b/lib/utils/proxy/index.ts @@ -1,15 +1,16 @@ -import { config } from '@/config'; -import { PacProxyAgent } from 'pac-proxy-agent'; import { HttpsProxyAgent } from 'https-proxy-agent'; +import { PacProxyAgent } from 'pac-proxy-agent'; import { SocksProxyAgent } from 'socks-proxy-agent'; import { ProxyAgent } from 'undici'; + +import { config } from '@/config'; import logger from '@/utils/logger'; -const proxyIsPAC = config.pacUri || config.pacScript; - +import createMultiProxy, { type MultiProxyResult, type ProxyState } from './multi-proxy'; import pacProxy from './pac-proxy'; import unifyProxy from './unify-proxy'; -import createMultiProxy, { type MultiProxyResult, type ProxyState } from './multi-proxy'; + +const proxyIsPAC = config.pacUri || config.pacScript; interface ProxyExport { agent: PacProxyAgent | HttpsProxyAgent | SocksProxyAgent | null; diff --git a/lib/utils/proxy/multi-proxy.ts b/lib/utils/proxy/multi-proxy.ts index 38209f3160..2406224d8f 100644 --- a/lib/utils/proxy/multi-proxy.ts +++ b/lib/utils/proxy/multi-proxy.ts @@ -1,5 +1,6 @@ import { type Config } from '@/config'; import logger from '@/utils/logger'; + import unifyProxy from './unify-proxy'; export interface ProxyState { diff --git a/lib/utils/proxy/pac-proxy.test.ts b/lib/utils/proxy/pac-proxy.test.ts index 519d3b87b9..97a9b52417 100644 --- a/lib/utils/proxy/pac-proxy.test.ts +++ b/lib/utils/proxy/pac-proxy.test.ts @@ -1,4 +1,5 @@ import { describe, expect, it } from 'vitest'; + import pacProxy from '@/utils/proxy/pac-proxy'; const emptyProxyObj = { diff --git a/lib/utils/proxy/unify-proxy.test.ts b/lib/utils/proxy/unify-proxy.test.ts index 608ef7a0cd..28b1e92c18 100644 --- a/lib/utils/proxy/unify-proxy.test.ts +++ b/lib/utils/proxy/unify-proxy.test.ts @@ -1,4 +1,5 @@ import { describe, expect, it } from 'vitest'; + import unifyProxy from '@/utils/proxy/unify-proxy'; const emptyProxyObj = { diff --git a/lib/utils/puppeteer-utils.test.ts b/lib/utils/puppeteer-utils.test.ts index 08ef0ac224..a97424f8bc 100644 --- a/lib/utils/puppeteer-utils.test.ts +++ b/lib/utils/puppeteer-utils.test.ts @@ -1,7 +1,8 @@ -import { describe, expect, it, vi, afterEach } from 'vitest'; -import { parseCookieArray, constructCookieArray, setCookies, getCookies } from '@/utils/puppeteer-utils'; -import puppeteer from '@/utils/puppeteer'; import type { Browser } from 'rebrowser-puppeteer'; +import { afterEach, describe, expect, it, vi } from 'vitest'; + +import puppeteer from '@/utils/puppeteer'; +import { constructCookieArray, getCookies, parseCookieArray, setCookies } from '@/utils/puppeteer-utils'; let browser: Browser | null = null; diff --git a/lib/utils/puppeteer-utils.ts b/lib/utils/puppeteer-utils.ts index 20ad49a55d..b421a1405c 100644 --- a/lib/utils/puppeteer-utils.ts +++ b/lib/utils/puppeteer-utils.ts @@ -55,4 +55,4 @@ const getCookies = async (page, domainFilter?: string) => { return parseCookieArray(cookies, domainFilter); }; -export { parseCookieArray, constructCookieArray, setCookies, getCookies }; +export { constructCookieArray, getCookies, parseCookieArray, setCookies }; diff --git a/lib/utils/puppeteer.test.ts b/lib/utils/puppeteer.test.ts index 79383ffa0e..8a7b737b98 100644 --- a/lib/utils/puppeteer.test.ts +++ b/lib/utils/puppeteer.test.ts @@ -1,6 +1,7 @@ -import { describe, expect, it, vi, afterEach } from 'vitest'; -import wait from './wait'; import { type Browser } from 'rebrowser-puppeteer'; +import { afterEach, describe, expect, it, vi } from 'vitest'; + +import wait from './wait'; let browser: Browser | null = null; diff --git a/lib/utils/puppeteer.ts b/lib/utils/puppeteer.ts index 9319a9bd8a..60d8382347 100644 --- a/lib/utils/puppeteer.ts +++ b/lib/utils/puppeteer.ts @@ -1,8 +1,11 @@ +import { anonymizeProxy } from 'proxy-chain'; +import type { Browser, Page } from 'rebrowser-puppeteer'; +import puppeteer from 'rebrowser-puppeteer'; + import { config } from '@/config'; -import puppeteer, { Browser, Page } from 'rebrowser-puppeteer'; + import logger from './logger'; import proxy from './proxy'; -import { anonymizeProxy } from 'proxy-chain'; /** * @deprecated use getPage instead diff --git a/lib/utils/readable-social.test.ts b/lib/utils/readable-social.test.ts index 16afaaf1be..4efc7b445f 100644 --- a/lib/utils/readable-social.test.ts +++ b/lib/utils/readable-social.test.ts @@ -1,5 +1,6 @@ import { describe, expect, test } from 'vitest'; -import { fallback, queryToBoolean, queryToInteger, queryToFloat } from './readable-social'; + +import { fallback, queryToBoolean, queryToFloat, queryToInteger } from './readable-social'; describe('fallback', () => { test('应该返回第一个存在的参数', () => { diff --git a/lib/utils/readable-social.ts b/lib/utils/readable-social.ts index abed12271d..973f2462fa 100644 --- a/lib/utils/readable-social.ts +++ b/lib/utils/readable-social.ts @@ -53,4 +53,4 @@ const queryToFloat = (s) => { return Number.parseFloat(s); }; -export { fallback, queryToBoolean, queryToInteger, queryToFloat }; +export { fallback, queryToBoolean, queryToFloat, queryToInteger }; diff --git a/lib/utils/render.ts b/lib/utils/render.ts index 2bae59f1df..f306b58054 100644 --- a/lib/utils/render.ts +++ b/lib/utils/render.ts @@ -1,5 +1,5 @@ -export { default as rss3 } from '@/views/rss3'; +export { default as Atom } from '@/views/atom'; export { default as json } from '@/views/json'; export { default as RSS } from '@/views/rss'; -export { default as Atom } from '@/views/atom'; +export { default as rss3 } from '@/views/rss3'; export { default as art } from 'art-template'; diff --git a/lib/utils/request-rewriter.test.ts b/lib/utils/request-rewriter.test.ts index 3e8a2cf0d5..ab09b3cd10 100644 --- a/lib/utils/request-rewriter.test.ts +++ b/lib/utils/request-rewriter.test.ts @@ -1,7 +1,9 @@ -import { describe, expect, it, vi } from 'vitest'; -import undici from 'undici'; -import got from 'got'; import http from 'node:http'; + +import got from 'got'; +import undici from 'undici'; +import { describe, expect, it, vi } from 'vitest'; + import { PRESETS } from '@/utils/header-generator'; process.env.PROXY_URI = 'http://rsshub.proxy:2333/'; diff --git a/lib/utils/request-rewriter/fetch.test.ts b/lib/utils/request-rewriter/fetch.test.ts index e8de9773bc..f27851bea7 100644 --- a/lib/utils/request-rewriter/fetch.test.ts +++ b/lib/utils/request-rewriter/fetch.test.ts @@ -1,6 +1,7 @@ import { getCurrentCell, setCurrentCell } from 'node-network-devtools'; +import { afterEach, beforeEach, describe, expect, test } from 'vitest'; + import { useCustomHeader } from './fetch'; -import { describe, beforeEach, afterEach, test, expect } from 'vitest'; const getInitRequest = () => ({ diff --git a/lib/utils/request-rewriter/fetch.ts b/lib/utils/request-rewriter/fetch.ts index 6abe97a0b7..8acfe06e58 100644 --- a/lib/utils/request-rewriter/fetch.ts +++ b/lib/utils/request-rewriter/fetch.ts @@ -1,11 +1,13 @@ -import logger from '@/utils/logger'; -import { config } from '@/config'; -import undici, { Request, RequestInfo, RequestInit } from 'undici'; -import proxy from '@/utils/proxy'; -import { RateLimiterMemory, RateLimiterQueue } from 'rate-limiter-flexible'; -import { useRegisterRequest } from 'node-network-devtools'; -import { generateHeaders, generatedHeaders as HEADER_LIST } from '@/utils/header-generator'; import type { HeaderGeneratorOptions } from 'header-generator'; +import { useRegisterRequest } from 'node-network-devtools'; +import { RateLimiterMemory, RateLimiterQueue } from 'rate-limiter-flexible'; +import type { RequestInfo, RequestInit } from 'undici'; +import undici, { Request } from 'undici'; + +import { config } from '@/config'; +import { generatedHeaders as HEADER_LIST, generateHeaders } from '@/utils/header-generator'; +import logger from '@/utils/logger'; +import proxy from '@/utils/proxy'; const limiter = new RateLimiterMemory({ points: 10, diff --git a/lib/utils/request-rewriter/get.ts b/lib/utils/request-rewriter/get.ts index a5bc91e45d..dc35fde38e 100644 --- a/lib/utils/request-rewriter/get.ts +++ b/lib/utils/request-rewriter/get.ts @@ -1,11 +1,13 @@ -import http from 'node:http'; -import https from 'node:https'; -import logger from '@/utils/logger'; -import { config } from '@/config'; -import proxy from '@/utils/proxy'; -import { generateHeaders, generatedHeaders as HEADER_LIST } from '@/utils/header-generator'; +import type http from 'node:http'; +import type https from 'node:https'; + import type { HeaderGeneratorOptions } from 'header-generator'; +import { config } from '@/config'; +import { generatedHeaders as HEADER_LIST, generateHeaders } from '@/utils/header-generator'; +import logger from '@/utils/logger'; +import proxy from '@/utils/proxy'; + type Get = typeof http.get | typeof https.get | typeof http.request | typeof https.request; interface ExtendedRequestOptions extends http.RequestOptions { diff --git a/lib/utils/request-rewriter/index.ts b/lib/utils/request-rewriter/index.ts index 74e793167f..626b4927d9 100644 --- a/lib/utils/request-rewriter/index.ts +++ b/lib/utils/request-rewriter/index.ts @@ -1,7 +1,8 @@ -import { Headers, FormData, Request, Response } from 'undici'; import http from 'node:http'; import https from 'node:https'; +import { FormData, Headers, Request, Response } from 'undici'; + import fetch from '@/utils/request-rewriter/fetch'; import getWrappedGet from '@/utils/request-rewriter/get'; diff --git a/lib/utils/rss-parser.test.ts b/lib/utils/rss-parser.test.ts index 0b09b61ea5..880b454d1b 100644 --- a/lib/utils/rss-parser.test.ts +++ b/lib/utils/rss-parser.test.ts @@ -1,4 +1,5 @@ import { describe, expect, it } from 'vitest'; + import parser from '@/utils/rss-parser'; describe('rss-parser', () => { diff --git a/lib/utils/rss-parser.ts b/lib/utils/rss-parser.ts index 63a94a7aae..01b2d30638 100644 --- a/lib/utils/rss-parser.ts +++ b/lib/utils/rss-parser.ts @@ -1,6 +1,7 @@ -import { config } from '@/config'; import Parser from 'rss-parser'; +import { config } from '@/config'; + const parser = new Parser({ customFields: { item: ['magnet'], diff --git a/lib/utils/timezone.test.ts b/lib/utils/timezone.test.ts index e6217853c9..4efec5bbe0 100644 --- a/lib/utils/timezone.test.ts +++ b/lib/utils/timezone.test.ts @@ -1,4 +1,5 @@ import { describe, expect, it } from 'vitest'; + import timezone from '@/utils/timezone'; describe('timezone', () => { diff --git a/lib/utils/valid-host.test.ts b/lib/utils/valid-host.test.ts index 48945387a8..b447782833 100644 --- a/lib/utils/valid-host.test.ts +++ b/lib/utils/valid-host.test.ts @@ -1,4 +1,5 @@ import { describe, expect, it } from 'vitest'; + import { isValidHost } from '@/utils/valid-host'; describe('valid-host', () => { diff --git a/lib/utils/wait.test.ts b/lib/utils/wait.test.ts index f40fda6b71..b9adc768eb 100644 --- a/lib/utils/wait.test.ts +++ b/lib/utils/wait.test.ts @@ -1,4 +1,5 @@ import { describe, expect, it } from 'vitest'; + import wait from '@/utils/wait'; describe('wait', () => { diff --git a/lib/utils/wechat-mp.test.ts b/lib/utils/wechat-mp.test.ts index 2d24a2110f..e22cc7bed3 100644 --- a/lib/utils/wechat-mp.test.ts +++ b/lib/utils/wechat-mp.test.ts @@ -1,8 +1,10 @@ -import { describe, expect, it, vi, afterEach } from 'vitest'; import { load } from 'cheerio'; import Parser from 'rss-parser'; +import { afterEach, describe, expect, it, vi } from 'vitest'; + import InvalidParameterError from '@/errors/types/invalid-parameter'; -import { exportedForTestingOnly, WeChatMpError, fetchArticle, finishArticleItem, fixArticleContent, normalizeUrl } from '@/utils/wechat-mp'; +import { exportedForTestingOnly, fetchArticle, finishArticleItem, fixArticleContent, normalizeUrl, WeChatMpError } from '@/utils/wechat-mp'; + const { toggleWerror, ExtractMetadata, showTypeMapReverse } = exportedForTestingOnly; vi.mock('@/utils/request-rewriter', () => ({ default: null })); diff --git a/lib/utils/wechat-mp.ts b/lib/utils/wechat-mp.ts index 1b3d0e303e..9abd4dda9d 100644 --- a/lib/utils/wechat-mp.ts +++ b/lib/utils/wechat-mp.ts @@ -25,12 +25,13 @@ * For more details of these functions, please refer to the jsDoc in the source code. */ -import ofetch from '@/utils/ofetch'; import { type Cheerio, type CheerioAPI, load } from 'cheerio'; import type { Element } from 'domhandler'; -import { parseDate } from '@/utils/parse-date'; + import cache from '@/utils/cache'; import logger from '@/utils/logger'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; class WeChatMpError extends Error { constructor(message: string) { @@ -645,4 +646,4 @@ const finishArticleItem = async (item, setMpNameAsAuthor = false, skipLink = fal }; const exportedForTestingOnly = { toggleWerror, ExtractMetadata, showTypeMapReverse }; -export { exportedForTestingOnly, WeChatMpError, fixArticleContent, fetchArticle, finishArticleItem, normalizeUrl }; +export { exportedForTestingOnly, fetchArticle, finishArticleItem, fixArticleContent, normalizeUrl, WeChatMpError }; diff --git a/lib/views/atom.tsx b/lib/views/atom.tsx index 42f5bc2fa4..e2565bfe34 100644 --- a/lib/views/atom.tsx +++ b/lib/views/atom.tsx @@ -1,5 +1,6 @@ import type { FC } from 'hono/jsx'; -import { Data } from '@/types'; + +import type { Data } from '@/types'; const RSS: FC<{ data: Data }> = ({ data }) => ( diff --git a/lib/views/error.tsx b/lib/views/error.tsx index f24e9b27d8..d18372bb94 100644 --- a/lib/views/error.tsx +++ b/lib/views/error.tsx @@ -1,7 +1,7 @@ import type { FC } from 'hono/jsx'; +import { gitDate, gitHash } from '@/utils/git-hash'; import { Layout } from '@/views/layout'; -import { gitHash, gitDate } from '@/utils/git-hash'; const Index: FC<{ requestPath: string; diff --git a/lib/views/index.tsx b/lib/views/index.tsx index 87659a3c3c..b2ecdef28f 100644 --- a/lib/views/index.tsx +++ b/lib/views/index.tsx @@ -1,9 +1,9 @@ import type { FC } from 'hono/jsx'; -import { Layout } from '@/views/layout'; import { config } from '@/config'; -import { gitHash, gitDate } from '@/utils/git-hash'; import { getDebugInfo } from '@/utils/debug-info'; +import { gitDate, gitHash } from '@/utils/git-hash'; +import { Layout } from '@/views/layout'; const startTime = Date.now(); diff --git a/lib/views/json.ts b/lib/views/json.ts index c6f00226fb..fcef99eef4 100644 --- a/lib/views/json.ts +++ b/lib/views/json.ts @@ -1,4 +1,4 @@ -import { Data } from '@/types'; +import type { Data } from '@/types'; /** * This function should be used by RSSHub middleware only. diff --git a/lib/views/rss.tsx b/lib/views/rss.tsx index 4d36c551e5..229a573d20 100644 --- a/lib/views/rss.tsx +++ b/lib/views/rss.tsx @@ -1,5 +1,6 @@ import type { FC } from 'hono/jsx'; -import { Data } from '@/types'; + +import type { Data } from '@/types'; const RSS: FC<{ data: Data }> = ({ data }) => { const hasItunes = data.itunes_author || data.itunes_category || (data.item && data.item.some((i) => i.itunes_item_image || i.itunes_duration)); diff --git a/lib/views/rss3.test.ts b/lib/views/rss3.test.ts index c226cd2a98..693e809ecc 100644 --- a/lib/views/rss3.test.ts +++ b/lib/views/rss3.test.ts @@ -1,4 +1,5 @@ import { describe, expect, it } from 'vitest'; + import rss3 from './rss3'; const NETWORK = 'rsshub'; diff --git a/plugins/rollup-plugin-art-templates.ts b/plugins/rollup-plugin-art-templates.ts index 3b9eed9d5c..4d08ebd3f5 100644 --- a/plugins/rollup-plugin-art-templates.ts +++ b/plugins/rollup-plugin-art-templates.ts @@ -1,7 +1,8 @@ // rollup-plugin-art-templates.js +import { createHash } from 'node:crypto'; import fs from 'node:fs'; import path from 'node:path'; -import { createHash } from 'node:crypto'; + import MagicString from 'magic-string'; /** diff --git a/scripts/workflow/build-docs.ts b/scripts/workflow/build-docs.ts index c24763bb3e..d1fe2cc637 100644 --- a/scripts/workflow/build-docs.ts +++ b/scripts/workflow/build-docs.ts @@ -1,9 +1,10 @@ -import { namespaces } from '../../lib/registry'; import fs from 'node:fs'; import path from 'node:path'; -import { categories } from './data'; -import { getCurrentPath } from '../../lib/utils/helpers'; + import { config } from '../../lib/config'; +import { namespaces } from '../../lib/registry'; +import { getCurrentPath } from '../../lib/utils/helpers'; +import { categories } from './data'; const fullTests = await (await fetch('https://cdn.jsdelivr.net/gh/DIYgod/RSSHub@gh-pages/build/test-full-routes.json')).json(); const testResult = fullTests.testResults[0].assertionResults; diff --git a/scripts/workflow/build-routes.ts b/scripts/workflow/build-routes.ts index 9da6675292..1bbb64cc59 100644 --- a/scripts/workflow/build-routes.ts +++ b/scripts/workflow/build-routes.ts @@ -1,12 +1,14 @@ -import { namespaces } from '../../lib/registry'; -import { RadarItem } from '../../lib/types'; -import { parse } from 'tldts'; import fs from 'node:fs'; import path from 'node:path'; -import toSource from 'tosource'; -import { config } from '../../lib/config'; +import { parse } from 'tldts'; +import toSource from 'tosource'; + +import { config } from '../../lib/config'; +import { namespaces } from '../../lib/registry'; +import type { RadarItem } from '../../lib/types'; import { getCurrentPath } from '../../lib/utils/helpers'; + const __dirname = getCurrentPath(import.meta.url); const foloAnalysis = await ( diff --git a/scripts/workflow/build-vercel-packagejson.ts b/scripts/workflow/build-vercel-packagejson.ts index 3bb8fecf6b..730262cb52 100644 --- a/scripts/workflow/build-vercel-packagejson.ts +++ b/scripts/workflow/build-vercel-packagejson.ts @@ -1,6 +1,7 @@ -import packageJson from '../../package.json'; import fs from 'node:fs'; +import packageJson from '../../package.json'; + packageJson.name = 'rsshub-vercel'; // @ts-ignore delete packageJson.scripts; diff --git a/tsdown-lib.config.ts b/tsdown-lib.config.ts index 9f7ceaef2f..fc4f32a25d 100644 --- a/tsdown-lib.config.ts +++ b/tsdown-lib.config.ts @@ -1,4 +1,5 @@ import { defineConfig } from 'tsdown'; + import artTemplatesPlugin from './plugins/rollup-plugin-art-templates.ts'; export default defineConfig({ diff --git a/tsdown-vercel.config.ts b/tsdown-vercel.config.ts index 3eb8ce7d66..b137eabb3e 100644 --- a/tsdown-vercel.config.ts +++ b/tsdown-vercel.config.ts @@ -1,4 +1,5 @@ import { defineConfig } from 'tsdown'; + import artTemplatesPlugin from './plugins/rollup-plugin-art-templates.ts'; export default defineConfig({ diff --git a/tsdown.config.ts b/tsdown.config.ts index ab948f15e7..45a2d34858 100644 --- a/tsdown.config.ts +++ b/tsdown.config.ts @@ -1,4 +1,5 @@ import { defineConfig } from 'tsdown'; + import artTemplatesPlugin from './plugins/rollup-plugin-art-templates.ts'; export default defineConfig({ diff --git a/vitest.config.ts b/vitest.config.ts index 1f061c8f76..ad2b42010a 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -1,9 +1,10 @@ -import { defineConfig, configDefaults } from 'vitest/config'; -import tsconfigPaths from 'vite-tsconfig-paths'; import os from 'node:os'; import path from 'node:path'; import process from 'node:process'; +import tsconfigPaths from 'vite-tsconfig-paths'; +import { configDefaults, defineConfig } from 'vitest/config'; + export default defineConfig({ plugins: [tsconfigPaths()], test: {