summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGianni Ceccarelli <gianni.ceccarelli@net-a-porter.com>2012-12-14 14:10:15 +0000
committerGianni Ceccarelli <gianni.ceccarelli@net-a-porter.com>2012-12-14 14:10:15 +0000
commit24de52692532079233b4149c4bbdc4daaf0c58f7 (patch)
tree2370eb962460aea1b6b2f1173cb78b20d4fca714 /lib
parentcustom user agent (diff)
downloadfeeder-24de52692532079233b4149c4bbdc4daaf0c58f7.tar.gz
feeder-24de52692532079233b4149c4bbdc4daaf0c58f7.tar.bz2
feeder-24de52692532079233b4149c4bbdc4daaf0c58f7.zip
allow excluding feeds from opml
Diffstat (limited to 'lib')
-rw-r--r--lib/Feed/Utils.pm6
1 files changed, 5 insertions, 1 deletions
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);
}