From d50250e74fca8911b97454d19ddb782a98866a11 Mon Sep 17 00:00:00 2001 From: bnewbold Date: Thu, 28 Apr 2011 01:24:57 +0000 Subject: fixed scraping bug --- piccast/feeds/management/commands/scrape_feeds.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/piccast/feeds/management/commands/scrape_feeds.py b/piccast/feeds/management/commands/scrape_feeds.py index 6a85aef..bfa9bfc 100644 --- a/piccast/feeds/management/commands/scrape_feeds.py +++ b/piccast/feeds/management/commands/scrape_feeds.py @@ -170,9 +170,10 @@ def scrape_feed(feed_shortname): # Ok, this is where we split out and do custom, per-site processing if(feed_shortname == u"acidcow"): - p.description = strip_tags(pset['description']) - if(p.description.starts_with(u"Simlar posts:"): - p.description = None + if(len(pset['description']) > 0): + p.description = strip_tags(pset['description']) + if(p.description.startswith(u"Similar posts:")): + p.description = None p.save() print "Great, saved: " + p.title + " (id=" + str(p.id) + ")" scrape_pics_acidcow(p) @@ -203,8 +204,9 @@ class Command(BaseCommand): for shortname in args: try: scrape_feed(shortname) - except Exception: - sys.stderr.write("Error scraping " + shortname + "\n") + except Exception as e: + sys.stderr.write("Error scraping " + shortname + ":\n") + sys.stderr.write(str(e) + "\n") sys.stdout.flush() sys.stdout.write('Done scraping feeds.\n') -- cgit v1.2.3