| 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.jp/search/lang/all/%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 |
'http://feeds.technorati.com/feed/posts/tag/%s', |
|---|
| 20 |
'http://bloglines.com/search?q=%s&ql=any&s=f&pop=l&news=m&n=100&format=rss', |
|---|
| 21 |
); |
|---|
| 22 |
|
|---|
| 23 |
sub load { |
|---|
| 24 |
my($self, $context) = @_; |
|---|
| 25 |
|
|---|
| 26 |
my $keyword = $self->conf->{keyword}; |
|---|
| 27 |
$keyword = [ $keyword ] unless ref $keyword; |
|---|
| 28 |
|
|---|
| 29 |
for my $kw (@$keyword) { |
|---|
| 30 |
for my $site (@sites) { |
|---|
| 31 |
my $site_url = $site; |
|---|
| 32 |
$site_url =~ s{%s(?::([\w\-]+))?}{ |
|---|
| 33 |
my $query = $kw; |
|---|
| 34 |
if ($1) { |
|---|
| 35 |
Encode::from_to($query, "utf-8" => $1); |
|---|
| 36 |
} |
|---|
| 37 |
URI::Escape::uri_escape($query); |
|---|
| 38 |
}eg; |
|---|
| 39 |
push @{$self->conf->{feed}}, { url => $site_url } |
|---|
| 40 |
} |
|---|
| 41 |
} |
|---|
| 42 |
|
|---|
| 43 |
$self->SUPER::load($context); |
|---|
| 44 |
} |
|---|
| 45 |
|
|---|
| 46 |
1; |
|---|