const cheerio = require('cheerio'); const got = require('@/utils/got'); const md5 = require('@/utils/md5'); const path = require('path'); const { art } = require('@/utils/render'); const rootUrl = 'https://www.iyingdi.com'; const infoUrL = 'https://api.iyingdi.com/web/post/info'; const ProcessFeed = async (cache, articleList) => { const items = await Promise.all( articleList.map((item) => cache.tryGet(item.link, async () => { const infoForm = { post_id: item.postId, timestamp: '', }; const { body } = await got({ method: 'post', url: infoUrL, headers: { Host: 'api.iyingdi.com', 'Login-Token': 'nologin', Origin: rootUrl, Platform: 'pc', Referer: `${rootUrl}/`, }, form: ProcessForm(infoForm), }); item.description = cleanHtml(JSON.parse(body).post.content); return item; }) ) ); return items; }; const ProcessForm = (form, type) => { const key = type ? '8a11ed3712b699e749185674f1dc20b4' : 'b8d5b38577b8bb382b0c783b474b95f9'; form.key = key; form.timestamp = Math.floor(new Date().getTime() / 1000); form.sign = md5(new URLSearchParams(form).toString()); delete form.key; return form; }; const cleanHtml = (htmlString) => { const regex = new RegExp('(
|