From 815d7049428a63ec5e8959eecb0b7812e2e558d8 Mon Sep 17 00:00:00 2001 From: Devin <42215787+devinmugen@users.noreply.github.com> Date: Sun, 2 Oct 2022 00:41:59 +0800 Subject: [PATCH] fix: picuki video src and add the controls (#10976) * fix: picuki video src and add the controls Modify the picuki video src and add the controls properties. * fix: picuki video src (Modification of judgement) * fix: picuki video src (Remove spaces) * Create video.art * fix: picuki video src (art-template) * fix: picuki video src (object-shorthand) * fix: picuki video src (controls) --- lib/v2/picuki/profile.js | 16 ++++++++++++++-- lib/v2/picuki/templates/video.art | 3 +++ 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 lib/v2/picuki/templates/video.art diff --git a/lib/v2/picuki/profile.js b/lib/v2/picuki/profile.js index a11787661..269f9cbc3 100644 --- a/lib/v2/picuki/profile.js +++ b/lib/v2/picuki/profile.js @@ -48,8 +48,20 @@ module.exports = async (ctx) => { const $ = cheerio.load(data); // Instagram 允许最多 10 条图片/视频任意混合于一条 post,picuki 在所有情况下都会将它(们)置于 .single-photo 内 let html = ''; - $('.single-photo img,video').each((_, item) => { - html += $(item).toString(); // 可能是视频,也可能是图片,格式都比较友好,这里直接添加 + $('.single-photo img').each((_, item) => { + html += $(item).toString(); + }); + $('.single-photo video').each((_, item) => { + item = $(item); + let videoSrc = item.attr('src'); + if (videoSrc === undefined) { + videoSrc = item.children().attr('src'); + } + const videoPoster = item.attr('poster'); + html += art(path.join(__dirname, 'templates/video.art'), { + videoSrc, + videoPoster, + }); }); return html; } diff --git a/lib/v2/picuki/templates/video.art b/lib/v2/picuki/templates/video.art new file mode 100644 index 000000000..67e673cab --- /dev/null +++ b/lib/v2/picuki/templates/video.art @@ -0,0 +1,3 @@ +