feat: v3 migration - 3/n

This commit is contained in:
DIYgod
2024-02-28 16:33:13 +08:00
parent 185b5d1441
commit fdf3fcac57
611 changed files with 3540 additions and 3528 deletions
+8 -8
View File
@@ -1,7 +1,7 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const { parseDate } = require('@/utils/parse-date');
const { art } = require('@/utils/render');
import got from '@/utils/got';
import { load } from 'cheerio';
import { parseDate } from '@/utils/parse-date';
import { art } from '@/utils/render';
const path = require('path');
const bakeTimestamp = (seconds) => {
@@ -18,7 +18,7 @@ const bakeTimestamp = (seconds) => {
module.exports = async (ctx) => {
const { channel } = ctx.params;
const limit = ctx.query.limit ? Number.parseInt(ctx.query.limit, 10) : 10;
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 10;
const rootUrl = 'https://www.transcriptforest.com';
@@ -93,14 +93,14 @@ module.exports = async (ctx) => {
const { data: currentResponse } = await got(currentUrl);
const $ = cheerio.load(currentResponse);
const $ = load(currentResponse);
const title = $('title').text();
const image = $('meta[property="og:image"]').prop('content');
const icon = new URL($('link[rel="apple-touch-icon"]').prop('href'), rootUrl).href;
const author = title.split(/\|/)[0].trim();
ctx.state.data = {
ctx.set('data', {
item: items,
title,
link: currentUrl,
@@ -112,5 +112,5 @@ module.exports = async (ctx) => {
author,
itunes_author: author,
allowEmpty: true,
};
});
};