From 1c48f64b75f2706e2f8c05b26aa79e1a583de6a6 Mon Sep 17 00:00:00 2001
From: imgyh <1974355683@qq.com>
Date: Fri, 21 Apr 2023 20:20:31 +0800
Subject: [PATCH] =?UTF-8?q?fix(web):=20=E8=A7=A3=E5=86=B3=E6=B5=8F?=
=?UTF-8?q?=E8=A7=88=E5=99=A8=E6=8F=90=E7=A4=BA=E4=B8=8D=E5=AE=89=E5=85=A8?=
=?UTF-8?q?=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
static/js/custom.js | 27 ++++++++++++++++-----------
1 file changed, 16 insertions(+), 11 deletions(-)
diff --git a/static/js/custom.js b/static/js/custom.js
index 59a3433..c5c08e2 100644
--- a/static/js/custom.js
+++ b/static/js/custom.js
@@ -18,8 +18,8 @@ function SendAjax() {
if (result.awemeType === 0) {
$("#awemeType").html("预览视频");
$("#AwemeOrLive").html("下载视频");
- $("#video").attr("href", result.video.play_addr.url_list);
- $("#pre_video").attr("src", result.video.play_addr.url_list);
+ $("#video").attr("href", removeHttp(result.video.play_addr.url_list[0]));
+ $("#pre_video").attr("src", removeHttp(result.video.play_addr.url_list[0]));
$("#video").attr("style", "display:inline;");//显示 video
}
if (result.awemeType === 1) {
@@ -27,17 +27,17 @@ function SendAjax() {
var images = result.images;
var licontent = ""; // 拼接输入的 li 标签的字符串
for (var i = 0; i < images.length; i++) {
- licontent += "
"
+ licontent += "
"
}
document.getElementById("images").innerHTML = licontent;
$("#video").attr("style", "display:none;");//隐藏 video
}
if (result.awemeType === 0 || result.awemeType === 1) {
- $("#cover").attr("href", result.video.cover_original_scale.url_list[0]);
- $("#pre_video").attr("poster", result.video.dynamic_cover.url_list[0]);
- $("#music").attr("href", result.music.play_url.url_list[0]);
+ $("#cover").attr("href", removeHttp(result.video.cover_original_scale.url_list[0]));
+ $("#pre_video").attr("poster", removeHttp(result.video.dynamic_cover.url_list[0]));
+ $("#music").attr("href", removeHttp(result.music.play_url.url_list[0]));
- $("#avatar").attr("src", result.author.avatar.url_list[0]);
+ $("#avatar").attr("src", removeHttp(result.author.avatar.url_list[0]));
$("#avatar").attr("alt", result.author.nickname);
$("#nickname").html(result.author.nickname);
$("#desc").html(result.desc);
@@ -104,12 +104,12 @@ function SendAjax() {
} else {
$("#AwemeOrLive").html("下载直播");
$("#awemeType").html("预览直播");
- $("#video").attr("href", result.flv_pull_url0);
- $("#pre_video").attr("src", result.flv_pull_url0);
+ $("#video").attr("href", removeHttp(result.flv_pull_url0));
+ $("#pre_video").attr("src", removeHttp(result.flv_pull_url0));
- $("#cover").attr("href", result.cover);
+ $("#cover").attr("href", removeHttp(result.cover));
$("#pre_video").attr("poster", result.cover);
- $("#avatar").attr("src", result.avatar);
+ $("#avatar").attr("src", removeHttp(result.avatar));
$("#avatar").attr("alt", result.nickname);
$("#nickname").html(result.nickname);
$("#desc").html(result.title);
@@ -227,3 +227,8 @@ window.addEventListener('DOMContentLoaded', function () {
$("#show-video").hide();
})
});
+
+
+function removeHttp(url) {
+ return url.replace(/^https?:/, '');
+}
\ No newline at end of file