File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 1
1
"use strict" ;
2
2
3
+ // Important: to use this you must also install ytdl-core as a dependency
4
+
3
5
const ytdl = require ( "ytdl-core" ) ;
4
6
5
7
// handles youtube video pages and replaces them with a custom page that just streams the video
6
8
function processRequest ( data ) {
7
- const { hostname, pathname } = new URL ( data . url ) ;
8
- if ( hostname === "www.youtube.com" && pathname === "/watch" ) {
9
+ if ( ytdl . validateURL ( data . url ) ) {
9
10
const res = data . clientResponse ;
10
11
// if we write headers, unblocker will detect that and stop trying to process this request
11
12
res . writeHead ( 200 , { "content-type" : "text/html; charset=utf-8" } ) ;
@@ -27,7 +28,7 @@ function processRequest(data) {
27
28
</head>
28
29
<body>
29
30
<h1>${ info . videoDetails . title } </h1>
30
- <video controls poster="${ thumb . url } " style="width: 100%">
31
+ <video controls poster="/proxy/ ${ thumb . url } " style="width: 100%">
31
32
${ formats
32
33
. map (
33
34
( format ) =>
You can’t perform that action at this time.
0 commit comments