bilibili.html 858 B

1234567891011121314151617181920212223
  1. {{ $vid := (.Get 0) }}
  2. {{ $videopage := default 1 (.Get 1) }}
  3. {{ $basicQuery := querify "page" $videopage "high_quality" 1 "as_wide" 1 }}
  4. {{ $videoQuery := "" }}
  5. {{ if strings.HasPrefix (lower $vid) "av" }}
  6. {{ $videoQuery = querify "aid" (strings.TrimPrefix "av" (lower $vid)) }}
  7. {{ else if strings.HasPrefix (lower $vid) "bv" }}
  8. {{ $videoQuery = querify "bvid" $vid }}
  9. {{ else }}
  10. <p>Bilibili 视频av号或BV号错误!请检查视频av号或BV号是否正确</p>
  11. <p>当前视频av或BV号:{{ $vid }},视频分P:{{ $videopage }}</p>
  12. {{ end }}
  13. <div class="video-wrapper">
  14. <iframe src="https://player.bilibili.com/player.html?{{ $basicQuery | safeURL }}&{{ $videoQuery | safeURL }}"
  15. scrolling="no"
  16. frameborder="no"
  17. framespacing="0"
  18. allowfullscreen="true"
  19. >
  20. </iframe>
  21. </div>