feat: v3 migration - 3/n
This commit is contained in:
@@ -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,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user