Files
RSSHub/lib/routes/ifeng/utils.ts
T
DIYgod 83e701b592 feat: compile ts through tsdown (#18908)
* feat: build ts via tsdown

* feat: exec tsdown

* fix

* fix

* fix

* feat: use tsdown shims

* chore: run rolldown lifecycle script

* fix: use shims

---------
2025-04-22 22:29:11 +08:00

24 lines
627 B
TypeScript

import { art } from '@/utils/render';
import 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,
});
export { extractDoc, renderVideo };