Exclude spam links from mememe results

Sam Ruby rubys at intertwingly.net
Sun Apr 20 21:01:21 EST 2008


Ben Welsh wrote:
> Hey,
> 
> i'm curious if anyone can help me exclude specific links from mememe 
> compliation. An example would be self-promotional links that a site 
> includes with every post.

I haven't tested it, but a change like the one listed at the bottom of 
this email would probably meet your needs.  If you get something that 
you can verify works for you, I'll gladly add it to my repository.

Usage would be something like the following:

[mememe.plugin]
spam:
   http://foo.org/
   http://bar.com/

- Sam Ruby

=== modified file 'filters/mememe.plugin'
--- filters/mememe.plugin       2008-02-05 01:27:05 +0000
+++ filters/mememe.plugin       2008-04-20 10:59:51 +0000
@@ -28,6 +28,7 @@
  import feedparser
  log = planet.logger
  options = config.filter_options(sys.argv[0])
+spam = options.get('spam', '').split()

  MEMES_ATOM = os.path.join(config.output_dir(),'memes.atom')

@@ -375,6 +376,7 @@
  from urllib import quote_plus
  for i in range(0,len(weighted_links)):
    weight, link, updated = weighted_links[i]
+  if link in spam: continue

    # ensure that somebody new points to this entry.  This guards against
    # groups of related links which several posts point to all.



More information about the devel mailing list