all repos — gopipe @ 83cd0bd9237351f9da3ef236617c2f915f2277c4

Embed YouTube videos on Telegram, Discord and more!

templates/video.html (view raw)

 1<!DOCTYPE html>
 2<!--
 3███████ ██ ██   ██ ██    ██   ███   ██   ██ ██████ ██   ██ ██████  ███████
 4██      ██  ██ ██   ██  ██  ██   ██ ██   ██   ██   ██   ██ ██   ██ ██     
 5█████   ██   ███     ████   ██   ██ ██   ██   ██   ██   ██ ██████  █████  
 6██      ██  ██ ██     ██    ██   ██ ██   ██   ██   ██   ██ ██   ██ ██     
 7██      ██ ██   ██    ██      ███     ███     ██     ███   ██████  ███████
 8██
 9██  A better way to embed YouTube videos on Telegram (inspired by FixTweet).
10██  -->
11<html lang="en">
12
13<head>
14    <link rel="canonical" href="https://www.youtube.com/watch?v={{ .VideoID }}" />
15    {{ if not .Debug }}
16    <meta http-equiv="refresh" content="0;url=https://www.youtube.com/watch?v={{ .VideoID }}" />
17    {{ end }}
18    <meta charset="utf-8">
19    <meta name="viewport" content="width=device-width, initial-scale=1">
20    <meta property="og:url" content="https://www.youtube.com/watch?v={{ .VideoID }}" />
21    <meta property="theme-color" content="0000FF" />
22    <meta property="twitter:card" content="player" />
23    <meta property="twitter:site" content="{{ .Uploader }}" />
24    <meta property="twitter:creator" content="{{ .Uploader }}" />
25    <meta property="twitter:title" content="{{ .Title }}" />
26    <meta property="og:title" content="{{ .Title }}" />
27    <meta property="og:description" content="{{ .Description }}" />
28    <meta property="og:site_name" content="GoTube ({{ .Uploader }})" />
29    <meta property="twitter:image" content="{{ .Thumbnail }}" />
30    <meta property="twitter:player:stream:content_type" content="video/mp4" />
31    {{ if .VideoURL }}
32    <meta property="og:video" content="{{ .VideoURL }}" />
33    <meta property="og:video:secure_url" content="{{ .VideoURL }}" />
34    <meta property="og:video:duration" content="{{ .Duration }}">
35    <meta property="og:video:type" content="video/mp4" />
36    {{ end }}
37    <link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text fill=%22white%22 y=%22.9em%22 font-size=%2290%22>🛠</text></svg>">
38    <link rel="stylesheet" href="https://unpkg.com/@picocss/pico@latest/css/pico.min.css">
39</head>
40
41<body>
42    {{ if .VideoURL }}
43    <main class="container" style="max-width: 35rem">
44        <video style="width: 100%" autoplay controls>
45            <source src="{{ .VideoURL }}" type="video/mp4" />
46        </video>
47        <h2>{{ .Title }}</h2>
48        <h3>&gt; {{ .Uploader }}</h3>
49        <p>{{ .Description }}</p>
50        <a href="https://www.youtube.com/watch?v={{ .VideoID }}">Watch on YouTube.</a>
51    </main>
52    {{ end }}
53</body>
54
55</html>