all repos — gopipe @ 5a91c6dec0ac3e5f50ca3c46af1228c0d8120223

Embed YouTube videos on Telegram, Discord and more!

templates/video.tmpl (view raw)

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