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)
This commit is contained in:
parent
085844a45b
commit
815d704942
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
<video poster="{{ videoPoster }}" controls>
|
||||
<source src="{{ videoSrc }}" type="video/mp4">
|
||||
</video>
|
||||
Loading…
Reference in New Issue