diff --git a/lib/v2/yuque/book.js b/lib/v2/yuque/book.js index 9f8264cbc..aa6ba0fd8 100644 --- a/lib/v2/yuque/book.js +++ b/lib/v2/yuque/book.js @@ -60,6 +60,20 @@ module.exports = async (ctx) => { elem.remove(); } }); + // obtain real video src + for await (const v of $('video').toArray()) { + const $v = $(v); + const src = $v.attr('src'); + if (src.startsWith('inputs')) { + const { data } = await got(`${baseUrl}/api/video`, { + searchParams: { + video_id: src, + }, + }); + const { info } = data.data; + $v.replaceWith(``); + } + } item.description = $.html(); item.author = data.contributors.map((c) => c.name).join(', '); diff --git a/lib/v2/yuque/utils.js b/lib/v2/yuque/utils.js index e2a3ddb53..a9da88c91 100644 --- a/lib/v2/yuque/utils.js +++ b/lib/v2/yuque/utils.js @@ -35,6 +35,10 @@ const card2Html = (elem, link) => { case 'table': html = value.html; break; + case 'video': + // fake video src + html = ``; + break; default: throw Error(`Unhandled card on ${link}: ${name}`); }