-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwatch.php
More file actions
98 lines (81 loc) · 3.01 KB
/
watch.php
File metadata and controls
98 lines (81 loc) · 3.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?php
/* ---------------------------------------------------------------------------
* GooseRSS the YouTube and EZTV RSS Generator.
*
* COPYRIGHT NOTICE
* Copyright 2025-2026 Arnan de Gans. All Rights Reserved.
*
* COPYRIGHT NOTICES AND ALL THE COMMENTS SHOULD REMAIN INTACT.
* By using this code you agree to indemnify Arnan de Gans from any
* liability that might arise from its use.
--------------------------------------------------------------------------- */
if(!defined('MAIN_PATH')) {
define('MAIN_PATH', __DIR__);
}
require_once(MAIN_PATH . '/config.php');
require_once(MAIN_PATH . '/functions/functions.php');
// Fetch the url parameters
$handle = isset($_GET['ch']) ? sanitize($_GET['ch']) : '';
$video_id = isset($_GET['vid']) ? sanitize($_GET['vid']) : '';
// Only cached videos can be watched here
$channel = cache_get($handle, CACHE_YT_PREFIX); // 360 days. We don't care for the cache age, just that it's there.
$video = false;
if(is_array($channel)) {
$key = array_search($video_id, array_column($channel['items'], 'id'));
if($key !== false) {
$video = $channel['items'][$key];
}
}
if(!$video) {
if(ERROR_LOG) logger('YT: Invalid or missing Video ID ('.$handle.': '.$video_id.') on watch.php.');
die("Please refresh your feeds and provide a valid Video ID.");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GooseRSS: <?php echo $video['title']; ?></title>
<link rel="stylesheet" href="./assets/embed-simple.css">
<meta name="description" content="<?php echo $video['title']; ?> by <?php echo $channel['channel_name']; ?>" />
<meta name="generator" content="GooseRSS" />
<meta property="og:type" content="website" />
<meta property="og:locale" content="en_US" />
<meta property="og:url" content="<?php echo MAIN_URL; ?>/watch.php?vid=<?php echo $video_id; ?>&ch=<?php echo $handle; ?>" />
<meta property="og:site_name" content="GooseRSS" />
<meta property="og:title" content="Watch this video from '<?php echo $channel['channel_name']; ?>'" />
<meta property="og:description" content="<?php echo $video['title']; ?>" />
<?php
if(isset($video['thumbnail'])) {
echo '<meta property="og:image" content="'.$video['thumbnail'].'" />';
echo '<meta property="og:image:alt" content="'.$video['thumbnail'].'" />';
}
?>
</head>
<body id="top">
<header>
<h1><?php echo $video['title']; ?></h1>
</header>
<main>
<section id="text">
<div class="videowrap">
<iframe
id="player"
type="text/html"
src="https://www.youtube.com/embed/<?php echo $video_id; ?>"
title="YouTube video player"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
referrerpolicy="strict-origin-when-cross-origin"
allowfullscreen
></iframe>
</div>
</section>
</main>
<footer>
<p>This page does not store or distribute videos.</p>
</footer>
<script src="./assets/embed-keepalive.js"></script>
</body>
</html>