all repos — gopipe @ 6eff4ae6fb13714b5c8a946da03292c0f530ac4e

Embed YouTube videos on Telegram, Discord and more!

templates/video.tmpl (view raw)

 1{{ extends "base.tmpl" }}
 2
 3{{define "meta" -}}
 4    <title>{{ .Title }} - GoTube</title>
 5    <link rel="canonical" href="https://www.youtube.com/watch?v={{ .VideoID }}" />
 6    {{ if not .Debug }}
 7    <meta http-equiv="refresh" content="0;url=https://www.youtube.com/watch?v={{ .VideoID }}" />
 8    {{ end }}
 9    <meta property="og:url" content="https://www.youtube.com/watch?v={{ .VideoID }}" />
10    <meta property="theme-color" content="0000FF" />
11    <meta property="twitter:card" content="player" />
12    <meta property="twitter:site" content="{{ .Author }}" />
13    <meta property="twitter:creator" content="{{ .Author }}" />
14    <meta property="twitter:title" content="{{ .Title }}" />
15    <meta property="og:title" content="{{ .Title }}" />
16    <meta property="og:description" content="{{ .Description }}" />
17    <meta property="og:site_name" content="GoTube ({{ .Author }})" />
18    <meta property="twitter:image" content="{{ .Thumbnail }}" />
19    <meta property="twitter:player:stream:content_type" content="video/mp4" />
20    {{ if .VideoURL }}
21    <meta property="og:video" content="{{ .VideoURL }}" />
22    <meta property="og:video:secure_url" content="{{ .VideoURL }}" />
23    <meta property="og:video:duration" content="{{ .Duration }}">
24    <meta property="og:video:type" content="video/mp4" />
25    {{ end }}
26{{end}}
27
28
29{{define "content" -}}
30    <video style="width: 100%" autoplay controls>
31        <source src="{{ .VideoURL }}" type="video/mp4" />
32        {{ range .Captions }}
33        <track kind="subtitles" label="{{ .Language }}" src="/sub/{{ .VideoID }}/{{ .Language }}.vtt" srclang="{{ .Language }}" />
34        {{ end }}
35    </video>
36    <h2>{{ .Title }}</h2>
37    <h3>&gt; {{ .Author }}</h3>
38    <pre style="white-space: pre-wrap">{{ .Description }}</pre>
39    <a href="https://www.youtube.com/watch?v={{ .VideoID }}">Watch on YouTube</a>
40    <br />
41    <a href="/">What is this?</a>
42{{end}}