From 24de52692532079233b4149c4bbdc4daaf0c58f7 Mon Sep 17 00:00:00 2001 From: Gianni Ceccarelli Date: Fri, 14 Dec 2012 14:10:15 +0000 Subject: allow excluding feeds from opml --- lib/Feed/Utils.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/Feed/Utils.pm b/lib/Feed/Utils.pm index db2fb18..60ea383 100644 --- a/lib/Feed/Utils.pm +++ b/lib/Feed/Utils.pm @@ -62,18 +62,22 @@ sub feeds { } sub feeds_from_opml { - my ($common_args,$opml_source) = @_; + my ($common_args,$opml_source,$opts) = @_; my $opml = try { XML::LibXML->load_xml(location => $opml_source); } catch { warn $_; return }; return unless $opml; + my @exclude = @{$opts->{exclude} // []}; + for my $feed_node ($opml->findnodes(q{/opml/body/outline[@xmlUrl != '']})) { my $title = $feed_node->findvalue('@title') // $feed_node->findvalue('@text') // ''; my $uri = $feed_node->findvalue('@xmlUrl'); + next if $uri ~~ @exclude; + feed(%$common_args,title=>$title,uri=>$uri); } -- cgit v1.2.3