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:
Devin 2022-10-02 00:41:59 +08:00 committed by GitHub
parent 085844a45b
commit 815d704942
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 2 deletions

View File

@ -48,8 +48,20 @@ module.exports = async (ctx) => {
const $ = cheerio.load(data);
// Instagram 允许最多 10 条图片/视频任意混合于一条 postpicuki 在所有情况下都会将它(们)置于 .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;
}

View File

@ -0,0 +1,3 @@
<video poster="{{ videoPoster }}" controls>
<source src="{{ videoSrc }}" type="video/mp4">
</video>