root/trunk/plagger/lib/Plagger/Plugin/Subscription/Planet.pm

Revision 618 (checked in by miyagawa, 14 years ago)

nuke MSN Search

Line 
1 package Plagger::Plugin::Subscription::Planet;
2 use strict;
3 use base qw( Plagger::Plugin::Subscription::Config );
4
5 use Encode;
6 use URI::Escape;
7
8 my @sites = (
9     'http://www.blogpulse.com/rss?query=%s&sort=date&operator=and',
10     'http://www.feedster.com/search/type/rss/%s',
11     'http://blogsearch.google.com/blogsearch_feeds?hl=en&q=%s&scoring=d&ie=utf-8&num=100&output=rss',
12     'http://blog-search.yahoo.co.jp/rss?p=%s:euc-jp',
13     'http://blog.goo.ne.jp/search/search.php?status=select&tg=all&st=time&dc=10&dp=all&bu=&ts=all&MT=%s:euc-jp&da=all&rss=1',
14     'http://www.namaan.net/rss?namaan=NAMA&ty=5&query=%s',
15     'http://bulkfeeds.net/app/search2.rdf?q=%s',
16     'http://rss.sf.livedoor.com/search?q=%s&sf=update_date&start=0',
17     'http://b.hatena.ne.jp/t/%s?mode=rss&sort=eid&threshold=1',
18     'http://d.hatena.ne.jp/keyworddiary/%s?mode=rss',
19 );
20
21 sub load {
22     my($self, $context) = @_;
23
24     my $keyword = $self->conf->{keyword};
25        $keyword = [ $keyword ] unless ref $keyword;
26
27     for my $kw (@$keyword) {
28         for my $site (@sites) {
29             my $site_url = $site;
30             $site_url =~ s{%s(?::([\w\-]+))?}{
31                 my $query = $kw;
32                 if ($1) {
33                     Encode::from_to($query, "utf-8" => $1);
34                 }
35                 URI::Escape::uri_escape($query);
36             }eg;
37             push @{$self->conf->{feed}}, { url => $site_url }
38         }
39     }
40
41     $self->SUPER::load($context);
42 }
43
44 1;
Note: See TracBrowser for help on using the browser.