How would you adblock using Python?

Posted by regomodo on Stack Overflow See other posts from Stack Overflow or by regomodo
Published on 2009-07-04T23:29:48Z Indexed on 2010/03/09 2:06 UTC
Read the original article Hit count: 351

Filed under:
|
|

I'm slowly building a web browser in PyQt4 and like the speed i'm getting out of it. However, I want to combine easylist.txt with it. I believe adblock uses this to block http requests by the browser.

How would you go about it using python/PyQt4?

[edit1] Ok. I think i've setup Privoxy. I haven't setup any additional filters and it seems to work. The PyQt4 i've tried to use looks like this

self.proxyIP = "127.0.0.1"
self.proxyPORT= 8118
proxy = QNetworkProxy()
proxy.setType(QNetworkProxy.HttpProxy)
proxy.setHostName(self.proxyIP)
proxy.setPort(self.proxyPORT)
QNetworkProxy.setApplicationProxy(proxy)

However, this does absolutely nothing and I cannot make sense of the docs and can not find any examples.

[edit2] I've just noticed that i'f I change self.proxyIP to my actual local IP rather than 127.0.0.1 the page doesn't load. So something is happening.

© Stack Overflow or respective owner

Related posts about python

Related posts about pyqt4