| 23 | | $self->load_xoxo($context, $uri); |
|---|
| 24 | | } |
|---|
| 25 | | |
|---|
| 26 | | sub load_xoxo { |
|---|
| 27 | | my($self, $context, $uri) = @_; |
|---|
| 28 | | |
|---|
| 29 | | my $xhtml = Plagger::Util::load_uri($uri, $self); |
|---|
| 30 | | my $tree = HTML::TreeBuilder::XPath->new; |
|---|
| 31 | | $tree->parse($xhtml); |
|---|
| 32 | | $tree->eof; |
|---|
| 33 | | |
|---|
| 34 | | $self->find_xoxo($tree); |
|---|
| 35 | | } |
|---|
| 36 | | |
|---|
| 37 | | sub find_xoxo { |
|---|
| 38 | | my($self, $tree) = @_; |
|---|
| 39 | | |
|---|
| 40 | | for my $child ($tree->findnodes('//ul[@class="xoxo" or @class="subscriptionlist"]//a')) { |
|---|
| 41 | | my $href = $child->attr('href') or next; |
|---|
| 42 | | my $title = $child->attr('title') || $child->as_text; |
|---|
| 43 | | |
|---|
| 44 | | my $feed = Plagger::Feed->new; |
|---|
| 45 | | $feed->url($href); |
|---|
| 46 | | $feed->title($title); |
|---|
| 47 | | |
|---|
| 48 | | Plagger->context->subscription->add($feed); |
|---|
| 49 | | } |
|---|
| | 8 | $self->conf->{xpath} = '//ul[@class="xoxo" or @class="subscriptionlist"]//a'; |
|---|
| | 9 | $self->SUPER::load($context); |
|---|