redirect fails, produce a more sensible error message (including the URL
of the feed in question).
+Add the --find option, which shows what feedscanner returns for a given
+URL (as --dump does for feedparser).
+
- rawdog 2.22
When handling an HTTP 301 redirect response, check whether the new
# rawdog: RSS aggregator without delusions of grandeur.
-# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013, 2014, 2015, 2016, 2017 Adam Sampson <ats@offog.org>
+# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013, 2014, 2015, 2016, 2017, 2018 Adam Sampson <ats@offog.org>
#
# rawdog is free software; you can redistribute and/or modify it
# under the terms of that license as published by the Free Software
Special actions (all other options are ignored if one of these is specified):
--dump URL Show what rawdog's parser returns for URL
+--find URL Show what rawdog's feed finder returns for URL
--help Display this help and exit
Report bugs to <ats@offog.org>."""
"config=",
"dir=",
"dump=",
+ "find=",
"help",
"list",
"log=",
import pprint
pprint.pprint(feedparser.parse(a, agent=HTTP_AGENT))
return 0
+ elif o == "--find":
+ feeds = rawdoglib.feedscanner.feeds(a)
+ if len(feeds) == 0:
+ return 1
+ for url in feeds:
+ print url
+ return 0
elif o == "--help":
usage()
return 0
#!/bin/sh
# test-rawdog: run some basic tests to make sure rawdog's working.
-# Copyright 2013, 2014, 2015, 2016 Adam Sampson <ats@offog.org>
+# Copyright 2013, 2014, 2015, 2016, 2018 Adam Sampson <ats@offog.org>
#
# rawdog is free software; you can redistribute and/or modify it
# under the terms of that license as published by the Free Software
run --dump $httpurl/feed.atom
contains $outfile example-feed-title
+begin "--find, successful"
+make_atom10 $httpdir/feed1.atom
+make_atom10 $httpdir/feed2.atom
+make_html_head $httpdir/page.html <<EOF
+<link rel="alternate" type="application/atom+xml" title="one" href="$httpurl/feed1.atom">
+<link rel="alternate" type="application/atom+xml" title="two" href="$httpurl/feed2.atom">
+EOF
+run --find $httpurl/page.html
+contains $outfile $httpurl/feed1.atom
+contains $outfile $httpurl/feed2.atom
+
+begin "--find, unsuccessful"
+make_html_head $httpdir/page.html <<EOF
+(no feeds in this file)
+EOF
+runn --find $httpurl/page.html
+not_contains $outfile '/'
+
begin "filename"
make_rss20 $statedir/simple.rss
add "feed 0 simple.rss"