Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #62553

Re: BLANK PAGE when i try Filtering Adsense with abpy

From Terry Reedy <tjreedy@udel.edu>
Subject Re: BLANK PAGE when i try Filtering Adsense with abpy
Date 2013-12-22 16:13 -0500
References <bf7b5838-9f24-4a94-9c14-0976a21578ff@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.4510.1387746820.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 12/22/2013 12:20 PM, 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

Please update your Python 3 if you are not in a straightjacket 
preventing you from doing so.

> import cgitb;cgitb.enable()

I suggest commenting this out and running normally in a console or Idle 
so you are guaranteed to see output, including error tracebacks. Only 
use cgi when this runs successfully in normal mode.

> import urllib.request
> response = urllib.request.build_opener()
> response.addheaders = [('User-agent', 'Mozilla/5.0')]
> response = urllib.request.urlopen("www.youtube.com";)

The ; is a SyntaxError and Python exits. See above.


> html = response.read()
>
> from abpy import Filter
> with open("easylist.txt") as f:
> f = Filter(file('easylist.txt'))
> f.match(html)
>
>
> print("Content-type: text/html")
> print()
> print (html)
>


-- 
Terry Jan Reedy

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

BLANK PAGE when i try Filtering Adsense with abpy em rexhepi <em.rexhepi@gmail.com> - 2013-12-22 09:20 -0800
  Re: BLANK PAGE when i try Filtering Adsense with abpy Chris Angelico <rosuav@gmail.com> - 2013-12-23 04:58 +1100
  Re: BLANK PAGE when i try Filtering Adsense with abpy Michael Torrie <torriem@gmail.com> - 2013-12-22 11:08 -0700
  Re: BLANK PAGE when i try Filtering Adsense with abpy Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-12-22 18:25 +0000
  Re: BLANK PAGE when i try Filtering Adsense with abpy MRAB <python@mrabarnett.plus.com> - 2013-12-22 20:28 +0000
  Re: BLANK PAGE when i try Filtering Adsense with abpy Terry Reedy <tjreedy@udel.edu> - 2013-12-22 16:13 -0500

csiph-web