From ed8a45875c6005e2d98c823ef5e4ec944a3104ad Mon Sep 17 00:00:00 2001 From: pictuga Date: Mon, 25 Feb 2013 21:36:02 +0100 Subject: [PATCH] Default to "//h1/.." since most website use it because it is said to be good for SEO. Debug now requires env variable "DEBUG" to be set to something else than "". --- morss | 14 +++++--------- rules | 12 ------------ 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/morss b/morss index a545cc1..633ccf3 100755 --- a/morss +++ b/morss @@ -7,15 +7,11 @@ import urllib2 import urllib from cookielib import CookieJar -def log(str): - if (len(sys.argv) == 3): - print str +def log(txt): + if os.getenv('DEBUG', False): + print txt -if len(sys.argv) < 2: - print "argument please" - sys.exit(1) - -node = sys.argv[1] +node = sys.argv[1] if len(sys.argv) > 1 else "//h1/.." xml = sys.stdin.read() rss = etree.fromstring(xml) @@ -66,5 +62,5 @@ for item in items: log(error) log("http error") -if len(sys.argv) == 2: +if not os.getenv('DEBUG', False): print etree.tostring(rss) diff --git a/rules b/rules index 28844d9..66b0038 100644 --- a/rules +++ b/rules @@ -1,23 +1,11 @@ -LeMonde -http://www.lemonde.fr/rss/une.xml -//*[contains(@class,'article') or contains(@id,'content')] - TehranTimes http://www.tehrantimes.com/component/ninjarsssyndicator/?feed_id=1&format=raw //div[@class='article-indent'] -BBC -http://feeds.bbci.co.uk/news/rss.xml -//h1/.. - FranceInfo http://www.franceinfo.fr/rss.xml //h2[@class='chapo']/.. -Courrier International -http://www.courrierinternational.com/rss/all/rss.xml -//div[@class='story-content'] - Spiegel http://www.spiegel.de/schlagzeilen/tops/index.rss //div[@id='spArticleSection']