From b152ae1b4b8adaef5d35d2134cbb70e2516e70a1 Mon Sep 17 00:00:00 2001 From: zoxoy <36219496+zoxoy@users.noreply.github.com> Date: Wed, 30 Dec 2020 10:23:21 +0800 Subject: [PATCH] Update bilibili.html --- layouts/shortcodes/bilibili.html | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/layouts/shortcodes/bilibili.html b/layouts/shortcodes/bilibili.html index 1243618..3c563dc 100644 --- a/layouts/shortcodes/bilibili.html +++ b/layouts/shortcodes/bilibili.html @@ -1,18 +1,24 @@ {{ $vid := (.Get 0) }} -{{ $videopage := (.Get 1) }} -{{ if (strings.HasPrefix $vid "av") }} -
- -
-{{ else if (strings.HasPrefix $vid "AV") }} -
- -
-{{ else if (strings.HasPrefix $vid "BV" )}} -
- -
+{{ $videopage := default 1 (.Get 1) }} +{{ $basicQuery := querify "page" $videopage "high_quality" 1 "as_wide" 1 }} +{{ $videoQuery := "" }} + +{{ if strings.HasPrefix (lower $vid) "av" }} + {{ $videoQuery = querify "aid" (strings.TrimPrefix "av" (lower $vid)) }} +{{ else if strings.HasPrefix (lower $vid) "bv" }} + {{ $videoQuery = querify "bvid" $vid }} {{ else }}

Bilibili 视频av号或BV号错误!请检查视频av号或BV号是否正确

当前视频av或BV号:{{ $vid }},视频分P:{{ $videopage }}

{{ end }} + +
+ +