Now I can do this:
$ proxy | connect | kill_youtube_comments | respond
And lo! Works in all browsers. :-)
Breaking it down:
- The proxy command listens on port 8080 (I configure my browser to proxy to localhost:8080). It spits all requests it sees to stdout.
- The connect command reads a HTTP request on stdin, connects to the remote server, fetches the content, and spits a HTTP request on stdout.
- The kill_youtube_comments command reads in HTML and strips out the div that contains YouTube comments.
- The respond command reads a HTTP response and sends that (via named pipe) back to the proxy command so that it can return it to the browser.
I sometimes wonder if anyone else in the world would find a personal, hackable proxy useful.