On 22/12/2013 17:20, em rexhepi wrote:
I know is my fault i'm no good programmer, I'm a begginer that's why i need
your help.
I have a python 3.3 project to be finished. I did what i could there is not
much help on google about this topic.
The project is to load a webpage from any website and filter the ads.
I'm using ABPY library to filter, here is the link:
https://github.com/atereshkin/abpy <- needs to be converted in python 3.x it is
on 2.x
easylist.txt link: https://easylist-downloads.adblockplus.org/easylist.txt
When I use my code it just displays nothing
My code:
#!/usr/local/bin/python3.1
import cgitb;cgitb.enable()
import urllib.request
response = urllib.request.build_opener()
response.addheaders = [('User-agent', 'Mozilla/5.0')]
response = urllib.request.urlopen("www.youtube.com";)
html = response.read()
from abpy import Filter
with open("easylist.txt") as f:
f = Filter(file('easylist.txt'))
f.match(html)
Whats the above meant to be doing? You've opened easylist.txt as f and
then reassigned f, passing easylist.txt to file which doesn't exist in
Python 3.
print("Content-type: text/html")
print()
print (html)
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
--
https://mail.python.org/mailman/listinfo/python-list