[dev] [surf] filter patch

From: Nick <suckless-dev_AT_njw.me.uk>
Date: Mon, 2 Aug 2010 22:39:21 +0100

Hi gang,

So, for the past month or so I've had the idea floating around in my
head that it'd be really nice to be able to send HTML from a browser
through any program, and load the output. That way you aren't
restricted to javascript for changing a page, and lots of
interesting possibilities are opened up. For example link URL
rewriting can be done simply with a sed script like:

sed 's|http://lwn.net|https://lwn.net|g'

The most interesting usage I plan for it is to rewrite a much
simpler version of readability
http://code.google.com/p/arc90labs-readability/ in Go, though I
haven't got around to writing it.

So anyway, attached is a patch for surf to bind a key to filter the
downloaded HTML through another program. I confess it's my first
time interacting with pipes with C, so it's quite possible the code
could be improved (let me know!)

It would also be quite easy to automatically trigger some script for
each page load (think adblocking,) though I haven't done that yet,
and doing it cleanly may get tricky (as the easiest way would be for
webkit to load the page, then filter the HTML, then re-load the new
HTML, but that's not too pretty.)

On a related note, what's the etiquette regarding adding patches to
the website? Is it just a "I think this is useful, I'll add it"
thing, or do you prefer it to be only patches lots of people have
acked?

I look forward to hear any comments,

Nick

Received on Mon Aug 02 2010 - 23:39:21 CEST

This archive was generated by hypermail 2.2.0 : Mon Aug 02 2010 - 23:36:02 CEST