mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-21 12:49:53 +08:00
feat: replace require with import 4/n
This commit is contained in:
@@ -81,4 +81,4 @@ const utils = {
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = utils;
|
||||
export default utils;
|
||||
|
||||
@@ -21,4 +21,4 @@ async function loadArticle(link) {
|
||||
link,
|
||||
};
|
||||
}
|
||||
module.exports = loadArticle;
|
||||
export default loadArticle;
|
||||
|
||||
@@ -2,7 +2,7 @@ import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { SUB_NAME_PREFIX, SUB_URL } from './const';
|
||||
const loadArticle = require('./article');
|
||||
import loadArticle from './article';
|
||||
export default async (ctx) => {
|
||||
const limit = Number.parseInt(ctx.req.query('limit'));
|
||||
const { cat = '8kasianidol' } = ctx.req.param();
|
||||
|
||||
@@ -2,7 +2,7 @@ import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { SUB_NAME_PREFIX, SUB_URL } from './const';
|
||||
const loadArticle = require('./article');
|
||||
import loadArticle from './article';
|
||||
const url = SUB_URL;
|
||||
|
||||
export default async (ctx) => {
|
||||
|
||||
@@ -2,7 +2,7 @@ import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { SUB_NAME_PREFIX, SUB_URL } from './const';
|
||||
const loadArticle = require('./article');
|
||||
import loadArticle from './article';
|
||||
export default async (ctx) => {
|
||||
const limit = Number.parseInt(ctx.req.query('limit'));
|
||||
const tag = ctx.req.param('tag');
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import parser from '@/utils/rss-parser';
|
||||
const utils = require('./utils');
|
||||
import utils from './utils';
|
||||
|
||||
export default async (ctx) => {
|
||||
let title = '9To5',
|
||||
|
||||
@@ -31,4 +31,4 @@ const ProcessFeed = (data) => {
|
||||
return content.html();
|
||||
};
|
||||
|
||||
export { ProcessFeed };
|
||||
export default { ProcessFeed };
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import got from '@/utils/got';
|
||||
import { config } from '@/config';
|
||||
|
||||
module.exports = (tryGet) => {
|
||||
export default (tryGet) => {
|
||||
const bgmCalendarUrl = 'https://api.bgm.tv/calendar';
|
||||
const bgmDataUrl = 'https://cdn.jsdelivr.net/npm/bangumi-data/dist/data.json';
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { getCurrentPath } from '@/utils/helpers';
|
||||
const __dirname = getCurrentPath(import.meta.url);
|
||||
|
||||
import cache from '@/utils/cache';
|
||||
const getData = require('./_base');
|
||||
import getData from './_base';
|
||||
import { art } from '@/utils/render';
|
||||
import * as path from 'node:path';
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import parser from '@/utils/rss-parser';
|
||||
import { load } from 'cheerio';
|
||||
const utils = require('./utils');
|
||||
import utils from './utils';
|
||||
|
||||
export default async (ctx) => {
|
||||
let feed, title, link;
|
||||
|
||||
@@ -32,4 +32,4 @@ const ProcessFeed = ($) => {
|
||||
return content.html();
|
||||
};
|
||||
|
||||
export { ProcessFeed };
|
||||
export default { ProcessFeed };
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
const util = require('./utils');
|
||||
import util from './utils';
|
||||
|
||||
export default async (ctx) => {
|
||||
const link = 'https://cs.bit.edu.cn/tzgg/';
|
||||
|
||||
@@ -48,4 +48,4 @@ const ProcessFeed = (list, caches) => {
|
||||
);
|
||||
};
|
||||
|
||||
export { ProcessFeed };
|
||||
export default { ProcessFeed };
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
const util = require('./utils');
|
||||
import util from './utils';
|
||||
|
||||
export default async (ctx) => {
|
||||
const link = 'https://jwc.bit.edu.cn/tzgg/';
|
||||
|
||||
@@ -44,4 +44,4 @@ const ProcessFeed = (list, caches) => {
|
||||
);
|
||||
};
|
||||
|
||||
export { ProcessFeed };
|
||||
export default { ProcessFeed };
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
const util = require('./utils');
|
||||
import util from './utils';
|
||||
const iconv = require('iconv-lite');
|
||||
|
||||
export default async (ctx) => {
|
||||
|
||||
@@ -68,4 +68,4 @@ const ProcessFeed = (base, list, caches) =>
|
||||
});
|
||||
})
|
||||
);
|
||||
export { ProcessFeed };
|
||||
export default { ProcessFeed };
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
const util = require('./utils');
|
||||
import util from './utils';
|
||||
|
||||
export default async (ctx) => {
|
||||
const type = ctx.req.param('type');
|
||||
|
||||
@@ -55,4 +55,4 @@ const ProcessFeed = (base, list, caches) =>
|
||||
});
|
||||
})
|
||||
);
|
||||
export { ProcessFeed };
|
||||
export default { ProcessFeed };
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
const util = require('./utils');
|
||||
import util from './utils';
|
||||
const iconv = require('iconv-lite');
|
||||
|
||||
export default async (ctx) => {
|
||||
|
||||
@@ -56,4 +56,4 @@ const ProcessFeed = (base, list, caches) =>
|
||||
});
|
||||
})
|
||||
);
|
||||
export { ProcessFeed };
|
||||
export default { ProcessFeed };
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import cache from '@/utils/cache';
|
||||
const utils = require('./utils');
|
||||
import utils from './utils';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
|
||||
@@ -23,4 +23,4 @@ function typeFilter(list, type) {
|
||||
return type === '全部' ? list : list.filter((item) => item.tags.some((tag) => tag.name === type));
|
||||
}
|
||||
|
||||
export { TYPE, BASE_URL, LANG_TYPE, langBase, typeFilter };
|
||||
export default { TYPE, BASE_URL, LANG_TYPE, langBase, typeFilter };
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import cache from '@/utils/cache';
|
||||
const utils = require('./utils');
|
||||
import utils from './utils';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
import getMzzlbg from './utils/mzzlbg';
|
||||
import xinwen1j1 from './utils/xinwen1j1';
|
||||
import getNews from './utils/news';
|
||||
|
||||
export default async (ctx) => {
|
||||
const category = ctx.req.param('category');
|
||||
let responseData;
|
||||
|
||||
if (category === 'mzzlbg') {
|
||||
// 每周质量报告
|
||||
const getMzzlbg = require('./utils/mzzlbg');
|
||||
responseData = await getMzzlbg();
|
||||
} else if (category === 'xinwen1j1') {
|
||||
// 新闻1+1
|
||||
const xinwen1j1 = require('./utils/xinwen1j1');
|
||||
responseData = await xinwen1j1();
|
||||
} else {
|
||||
// 央视新闻
|
||||
const getNews = require('./utils/news');
|
||||
responseData = await getNews(category);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import timezone from '@/utils/timezone';
|
||||
|
||||
module.exports = async () => {
|
||||
export default async () => {
|
||||
const url = 'https://api.cntv.cn/video/videolistById?serviceId=cbox&vsid=C10354&em=01&p=1&n=50';
|
||||
|
||||
const response = await got({
|
||||
|
||||
@@ -7,7 +7,7 @@ import randUserAgent from '@/utils/rand-user-agent';
|
||||
|
||||
const UA = randUserAgent({ browser: 'mobile safari', os: 'ios', device: 'mobile' });
|
||||
|
||||
module.exports = async (category) => {
|
||||
export default async (category) => {
|
||||
const url = `https://news.cctv.com/2019/07/gaiban/cmsdatainterface/page/${category}_1.jsonp`;
|
||||
|
||||
const response = await got({
|
||||
|
||||
@@ -53,7 +53,7 @@ const ProcessFeed = (data) =>
|
||||
return { ...single, ...other };
|
||||
})
|
||||
);
|
||||
module.exports = async () => {
|
||||
export default async () => {
|
||||
const baseUrl = 'https://api.cntv.cn/NewVideo/getVideoListByColumn?id=TOPC1451559066181661&n=20&sort=desc&p=1&mode=0&serviceId=tvcctv';
|
||||
// 获取要处理的页面
|
||||
const res = await got({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import cache from '@/utils/cache';
|
||||
const utils = require('./utils');
|
||||
import utils from './utils';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
@@ -14,4 +14,4 @@ const getCookie = () =>
|
||||
.join('');
|
||||
});
|
||||
|
||||
export { title, rootUrl, getCookie };
|
||||
export default { title, rootUrl, getCookie };
|
||||
|
||||
@@ -5,7 +5,7 @@ import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
import * as path from 'node:path';
|
||||
const utils = require('./utils');
|
||||
import utils from './utils';
|
||||
|
||||
const baseUrl = 'https://www.cde.org.cn';
|
||||
const xxgkMap = {
|
||||
|
||||
@@ -2,7 +2,7 @@ import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
const utils = require('./utils');
|
||||
import utils from './utils';
|
||||
|
||||
const baseUrl = 'https://www.cde.org.cn';
|
||||
const zdyzMap = {
|
||||
|
||||
@@ -5,7 +5,7 @@ import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import * as path from 'node:path';
|
||||
import { art } from '@/utils/render';
|
||||
const utils = require('./utils');
|
||||
import utils from './utils';
|
||||
|
||||
const { TYPE } = utils;
|
||||
|
||||
|
||||
@@ -65,4 +65,4 @@ const TYPE = {
|
||||
},
|
||||
};
|
||||
|
||||
export { TYPE };
|
||||
export default { TYPE };
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import cache from '@/utils/cache';
|
||||
const utils = require('./utils');
|
||||
import utils from './utils';
|
||||
import { load } from 'cheerio';
|
||||
import got from '@/utils/got';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
const utils = require('./utils');
|
||||
import utils from './utils';
|
||||
|
||||
const rootUrl = 'https://kns.cnki.net';
|
||||
|
||||
|
||||
@@ -24,4 +24,4 @@ const ProcessItem = async (item) => {
|
||||
return item;
|
||||
};
|
||||
|
||||
export { ProcessItem };
|
||||
export default { ProcessItem };
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import got from '@/utils/got';
|
||||
const utils = require('./utils');
|
||||
import utils from './utils';
|
||||
|
||||
export default async (ctx) => {
|
||||
const dyhId = ctx.req.param('dyhId');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import got from '@/utils/got';
|
||||
const utils = require('./utils');
|
||||
import utils from './utils';
|
||||
const getLinkAndTitle = (type, period) => {
|
||||
const baseURL = 'https://api.coolapk.com/v6/page/dataList?url=';
|
||||
let link;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import got from '@/utils/got';
|
||||
const utils = require('./utils');
|
||||
import utils from './utils';
|
||||
|
||||
export default async (ctx) => {
|
||||
const tag = ctx.req.param('tag');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import got from '@/utils/got';
|
||||
const utils = require('./utils');
|
||||
import utils from './utils';
|
||||
|
||||
export default async (ctx) => {
|
||||
const type = ctx.req.param('type') || 'history';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import got from '@/utils/got';
|
||||
const utils = require('./utils');
|
||||
import utils from './utils';
|
||||
|
||||
export default async (ctx) => {
|
||||
const type = ctx.req.param('type') || 'hot';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import got from '@/utils/got';
|
||||
const utils = require('./utils');
|
||||
import utils from './utils';
|
||||
|
||||
export default async (ctx) => {
|
||||
const uid = ctx.req.param('uid');
|
||||
|
||||
@@ -141,4 +141,4 @@ const parseDynamic = async (item) => {
|
||||
};
|
||||
};
|
||||
|
||||
export { get_app_token, base_url, getHeaders, parseDynamic, dynamicTpye };
|
||||
export default { get_app_token, base_url, getHeaders, parseDynamic, dynamicTpye };
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
const utils = require('./utils');
|
||||
import utils from './utils';
|
||||
const { TYPE, parseUrl } = utils;
|
||||
|
||||
export default async (ctx) => {
|
||||
|
||||
@@ -41,4 +41,4 @@ function parseUrl(type) {
|
||||
return type === 'recommend' ? 'https://www.dahecube.com/index.html?recid=1' : `https://www.dahecube.com/channel.html?recid=${TYPE[type].id}`;
|
||||
}
|
||||
|
||||
export { TYPE, parseUrl };
|
||||
export default { TYPE, parseUrl };
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import cache from '@/utils/cache';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
const utils = require('./utils');
|
||||
import utils from './utils';
|
||||
import puppeteer from '@/utils/puppeteer';
|
||||
|
||||
export default async (ctx) => {
|
||||
|
||||
@@ -45,4 +45,4 @@ const ProcessFeed = async (items, cookies, browser, limit, cache) => {
|
||||
return [...result, ...items.slice(limit)];
|
||||
};
|
||||
|
||||
export { ProcessFeed };
|
||||
export default { ProcessFeed };
|
||||
|
||||
@@ -2,8 +2,8 @@ import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
const defaults = require('./defaults');
|
||||
const shortcuts = require('./shortcuts');
|
||||
import defaults from './defaults';
|
||||
import shortcuts from './shortcuts';
|
||||
import { isValidHost } from '@/utils/valid-host';
|
||||
|
||||
export default async (ctx) => {
|
||||
|
||||
@@ -208,4 +208,4 @@ function getTagItems(cache, tag, page, get_bittorrent = false, embed_thumb = fal
|
||||
return page ? gatherItemsByPage(cache, `tag/${tag}?next=${page}`, get_bittorrent, embed_thumb) : gatherItemsByPage(cache, `tag/${tag}`, get_bittorrent, embed_thumb);
|
||||
}
|
||||
|
||||
export { getFavoritesItems, getSearchItems, getTagItems, has_cookie, from_ex };
|
||||
export default { getFavoritesItems, getSearchItems, getTagItems, has_cookie, from_ex };
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import cache from '@/utils/cache';
|
||||
const EhAPI = require('./ehapi');
|
||||
import EhAPI from './ehapi';
|
||||
|
||||
export default async (ctx) => {
|
||||
if (!EhAPI.has_cookie) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import cache from '@/utils/cache';
|
||||
const EhAPI = require('./ehapi');
|
||||
import EhAPI from './ehapi';
|
||||
|
||||
export default async (ctx) => {
|
||||
const page = ctx.req.param('page');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import cache from '@/utils/cache';
|
||||
const EhAPI = require('./ehapi');
|
||||
import EhAPI from './ehapi';
|
||||
|
||||
export default async (ctx) => {
|
||||
const page = ctx.req.param('page');
|
||||
|
||||
@@ -3,7 +3,7 @@ import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
const supportedList = require('./supported-list');
|
||||
import supportedList from './supported-list';
|
||||
|
||||
export default async (ctx) => {
|
||||
const country = ctx.req.param('country');
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
const util = require('./utils');
|
||||
import util from './utils';
|
||||
const iconv = require('iconv-lite');
|
||||
|
||||
const gbk2utf8 = (s) => iconv.decode(s, 'gbk');
|
||||
|
||||
@@ -69,4 +69,4 @@ const ProcessFeed = (list, caches) => {
|
||||
);
|
||||
};
|
||||
|
||||
export { ProcessFeed };
|
||||
export default { ProcessFeed };
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import cache from '@/utils/cache';
|
||||
const utils = require('./utils');
|
||||
import utils from './utils';
|
||||
import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
const shortcuts = require('./shortcuts');
|
||||
import shortcuts from './shortcuts';
|
||||
|
||||
export default async (ctx) => {
|
||||
let thePath = getSubPath(ctx).replace(/^\/nsfc/, '');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
const utils = require('./utils');
|
||||
import utils from './utils';
|
||||
|
||||
const typeMap = {
|
||||
351: {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
const utils = require('./utils');
|
||||
import utils from './utils';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
export default async (ctx) => {
|
||||
|
||||
@@ -10,4 +10,4 @@ function langBase(lang) {
|
||||
return lang ? `${BASE_URL}/${lang}` : `https://www.icac.org.hk/sc`;
|
||||
}
|
||||
|
||||
export { LANG_TYPE, BASE_URL, langBase };
|
||||
export default { LANG_TYPE, BASE_URL, langBase };
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
const utils = require('./utils');
|
||||
import utils from './utils';
|
||||
|
||||
export default async (ctx) => {
|
||||
const apiUrl = 'https://www.infoq.cn/public/v1/my/recommond';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
const utils = require('./utils');
|
||||
import utils from './utils';
|
||||
|
||||
export default async (ctx) => {
|
||||
const paramId = ctx.req.param('id');
|
||||
|
||||
@@ -106,4 +106,4 @@ function parseContent(content) {
|
||||
return parseToSimpleText([JSON.parse(content)]);
|
||||
}
|
||||
|
||||
export { ProcessFeed };
|
||||
export default { ProcessFeed };
|
||||
|
||||
@@ -5,7 +5,7 @@ import got from '@/utils/got';
|
||||
import { art } from '@/utils/render';
|
||||
import { load } from 'cheerio';
|
||||
import * as path from 'node:path';
|
||||
const utils = require('./utils');
|
||||
import utils from './utils';
|
||||
|
||||
let baseTitle = '日本郵便';
|
||||
const baseUrl = 'https://trackings.post.japanpost.jp/services/srv/search/direct?';
|
||||
|
||||
@@ -86,4 +86,4 @@ const utils = {
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = utils;
|
||||
export default utils;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
const util = require('./utils');
|
||||
import util from './utils';
|
||||
|
||||
export default async (ctx) => {
|
||||
const id = ctx.req.param('id');
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
const util = require('./utils');
|
||||
import util from './utils';
|
||||
|
||||
export default async (ctx) => {
|
||||
const response = await got({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
const util = require('./utils');
|
||||
import util from './utils';
|
||||
|
||||
export default async (ctx) => {
|
||||
const id = ctx.req.param('id');
|
||||
|
||||
@@ -53,4 +53,4 @@ const ProcessFeed = (list, caches) => {
|
||||
);
|
||||
};
|
||||
|
||||
export { ProcessFeed };
|
||||
export default { ProcessFeed };
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
const util = require('./utils');
|
||||
import util from './utils';
|
||||
|
||||
export default async (ctx) => {
|
||||
const category = ctx.req.param('category');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
const util = require('./utils');
|
||||
import util from './utils';
|
||||
|
||||
export default async (ctx) => {
|
||||
const collectionId = ctx.req.param('collectionId');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
const util = require('./utils');
|
||||
import util from './utils';
|
||||
|
||||
export default async (ctx) => {
|
||||
const id = ctx.req.param('id');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
const util = require('./utils');
|
||||
import util from './utils';
|
||||
|
||||
export default async (ctx) => {
|
||||
const userId = ctx.req.param('userId');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
const util = require('./utils');
|
||||
import util from './utils';
|
||||
|
||||
export default async (ctx) => {
|
||||
const id = ctx.req.param('id');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
const util = require('./utils');
|
||||
import util from './utils';
|
||||
|
||||
export default async (ctx) => {
|
||||
const tag = ctx.req.param('tag');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
const util = require('./utils');
|
||||
import util from './utils';
|
||||
|
||||
export default async (ctx) => {
|
||||
const { category, type } = ctx.req.param();
|
||||
|
||||
@@ -51,4 +51,4 @@ const ProcessFeed = (list, caches) =>
|
||||
})
|
||||
);
|
||||
|
||||
export { ProcessFeed };
|
||||
export default { ProcessFeed };
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
const utils = require('./utils');
|
||||
import utils from './utils';
|
||||
const MarkdownIt = require('markdown-it');
|
||||
|
||||
async function getUserName(uid) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
const utils = require('./utils');
|
||||
import utils from './utils';
|
||||
const MarkdownIt = require('markdown-it');
|
||||
|
||||
export default async (ctx) => {
|
||||
|
||||
@@ -10,4 +10,4 @@ const courseDesc = (picurl, desc) =>
|
||||
desc,
|
||||
});
|
||||
|
||||
export { courseDesc };
|
||||
export default { courseDesc };
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
const utils = require('./utils');
|
||||
import utils from './utils';
|
||||
|
||||
export default async (ctx) => {
|
||||
const todo = ctx.req.param('do') ?? '';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
const utils = require('./utils');
|
||||
import utils from './utils';
|
||||
// import { load } from 'cheerio';
|
||||
|
||||
export default async (ctx) => {
|
||||
|
||||
@@ -36,4 +36,4 @@ const ProcessFeed = async (list, cache) => {
|
||||
return items;
|
||||
};
|
||||
|
||||
export { ProcessFeed };
|
||||
export default { ProcessFeed };
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
const getRssItem = require('./utils');
|
||||
import getRssItem from './utils';
|
||||
|
||||
const rootApiUrl = 'https://www.lifeweek.com.cn/api/userWebFollow/getFollowTagContentList?type=3&sort=2&tagId';
|
||||
const rootUrl = 'https://www.lifeweek.com.cn/column';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
const getRssItem = require('./utils');
|
||||
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';
|
||||
|
||||
@@ -15,4 +15,4 @@ async function getRssItem(item, articleLink) {
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = getRssItem;
|
||||
export default getRssItem;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { config } from '@/config';
|
||||
|
||||
const parseArticle = require('./parse-article.js');
|
||||
import parseArticle from './parse-article.js';
|
||||
import { getFollowingFeedQuery } from './graphql.js';
|
||||
|
||||
export default async (ctx) => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { config } from '@/config';
|
||||
|
||||
const parseArticle = require('./parse-article.js');
|
||||
import parseArticle from './parse-article.js';
|
||||
import { getWebInlineRecommendedFeedQuery } from './graphql.js';
|
||||
|
||||
export default async (ctx) => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { config } from '@/config';
|
||||
|
||||
const parseArticle = require('./parse-article.js');
|
||||
import parseArticle from './parse-article.js';
|
||||
import { getUserCatalogMainContentQuery } from './graphql.js';
|
||||
|
||||
export default async (ctx) => {
|
||||
|
||||
@@ -46,7 +46,7 @@ async function parse(url, cookie = '') {
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = function (ctx, url) {
|
||||
export default function (ctx, url) {
|
||||
return cache.tryGet(`medium:article:${url}`, async () => {
|
||||
const { title, author, publishedTime, html } = await parse(url, config.medium.articleCookie);
|
||||
|
||||
@@ -58,4 +58,4 @@ module.exports = function (ctx, url) {
|
||||
pubDate: publishedTime,
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { config } from '@/config';
|
||||
|
||||
const parseArticle = require('./parse-article.js');
|
||||
import parseArticle from './parse-article.js';
|
||||
import { getWebInlineTopicFeedQuery } from './graphql.js';
|
||||
|
||||
export default async (ctx) => {
|
||||
|
||||
@@ -38,4 +38,4 @@ const getUserFullInfo = (ctx, uid) => {
|
||||
});
|
||||
};
|
||||
|
||||
export { getUserFullInfo };
|
||||
export default { getUserFullInfo };
|
||||
|
||||
@@ -4,7 +4,7 @@ const __dirname = getCurrentPath(import.meta.url);
|
||||
import got from '@/utils/got';
|
||||
import { art } from '@/utils/render';
|
||||
import * as path from 'node:path';
|
||||
const cache = require('./cache');
|
||||
import cache from './cache';
|
||||
|
||||
const renderDescription = (description, images) => art(path.join(__dirname, '../templates/description.art'), { description, images });
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import got from '@/utils/got';
|
||||
const cache = require('./cache');
|
||||
import cache from './cache';
|
||||
import { config } from '@/config';
|
||||
import { post2item } from './utils';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import got from '@/utils/got';
|
||||
const utils = require('./utils');
|
||||
import utils from './utils';
|
||||
import { config } from '@/config';
|
||||
|
||||
export default async (ctx) => {
|
||||
|
||||
@@ -28,4 +28,4 @@ const parseNotes = (data, site) =>
|
||||
};
|
||||
});
|
||||
|
||||
export { parseNotes, allowSiteList };
|
||||
export default { parseNotes, allowSiteList };
|
||||
|
||||
@@ -17,7 +17,7 @@ const markdownIt = require('markdown-it')({
|
||||
html: true,
|
||||
});
|
||||
|
||||
module.exports = async (
|
||||
export default async (
|
||||
/** @type {import('koa').Context} */
|
||||
ctx
|
||||
) => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import got from '@/utils/got';
|
||||
const utils = require('./utils');
|
||||
import utils from './utils';
|
||||
import { config } from '@/config';
|
||||
|
||||
export default async (ctx) => {
|
||||
|
||||
@@ -103,4 +103,4 @@ async function getCookie() {
|
||||
return token;
|
||||
}
|
||||
|
||||
export { getCookie, random_nonce, decrypt_wechat_detail_xyz, decrypt_douyin_account_xyz, decrypt_douyin_detail_xyz, flatten };
|
||||
export default { getCookie, random_nonce, decrypt_wechat_detail_xyz, decrypt_douyin_account_xyz, decrypt_douyin_detail_xyz, flatten };
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user