const ytdl = require('..');

const stream = ytdl('https://www.youtube.com/watch?v=2UBFIhS1YBk', {
  requestOptions: (parsed) => {
    return {
      host: '127.0.0.1',
      port: 8888,
      path: '/' + parsed.href,
      headers: { Host: parsed.host },
    };
  },
});

console.log('Starting Download');

stream.on('data', (chunk) => {
  console.log('downloaded', chunk.length);
});

stream.on('end', () => {
  console.log('Finished');
});
@@ -108,16 +108,33 @@
 Options:
+ %7B%0A    transform:
  (parsed
@@ -144,16 +144,18 @@
 %3E %7B%0A    
+ 
+ 
 return %7B
@@ -155,16 +155,18 @@
 eturn %7B%0A
+  
       ho
@@ -182,16 +182,18 @@
 0.0.1',%0A
+  
       po
@@ -208,16 +208,18 @@
 ,%0A      
+  
 path: '/
@@ -235,16 +235,18 @@
 d.href,%0A
+  
       he
@@ -283,16 +283,24 @@
     
+  
 %7D;%0A
+  
   %7D,%0A
+  %7D%0A
 %7D);%0A
@@ -466,11 +466,12 @@
 shed');%0A
-
 %7D);
+%0A

Fix proxy example to actually transform URL (#227)