Files
RSSHub/lib/v2/ifeng/utils.js
T
2024-02-28 19:40:21 +08:00

27 lines
651 B
JavaScript

import { art } from '@/utils/render';
import * as path from 'node:path';
const extractDoc = (data) =>
data
.map((item) => {
const type = item.type;
if (type === 'video') {
return renderVideo(item.data);
}
if (type === 'text') {
return item.data.replaceAll(/data-lazyload=(.+?) src=(.+?) style=".+?"/g, 'src=$1');
}
return '';
})
.join('<br>');
const renderVideo = (videoInfo) =>
art(path.join(__dirname, 'templates/video.art'), {
videoInfo,
});
module.exports = {
extractDoc,
renderVideo,
};