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>> {{ .Author }}</h3>
35 <pre style="white-space: pre-wrap">{{ .Description }}</pre>
36 <form action="/download" method="post" rel="noopener" target="_blank" style="display: grid; grid-template-columns: auto auto; justify-content: space-between;">
37 <input type="hidden" name="video" value="{{ .VideoID }}">
38 <select name="itagno">
39 {{ range .VideoFormats }}
40 <option value="{{ .ItagNo }}">
41 {{ parseFormat . }}
42 </option>
43 {{ end }}
44 {{ range .AudioFormats }}
45 <option value="{{ .ItagNo }}">
46 {{ parseFormat . }}
47 </option>
48 {{ end }}
49 </select>
50 <button type="submit">Download</button>
51 </form>
52 <a href="https://www.youtube.com/watch?v={{ .VideoID }}">Watch on YouTube</a>
53 <br />
54 <a href="/">What is this?</a>
55{{end}}