diff options
author | bnewbold <bnewbold@robocracy.org> | 2011-04-28 01:24:57 +0000 |
---|---|---|
committer | bnewbold <bnewbold@robocracy.org> | 2011-04-28 01:24:57 +0000 |
commit | d50250e74fca8911b97454d19ddb782a98866a11 (patch) | |
tree | 2e611a185d82d712d43067f095a1208d3f5371d2 | |
parent | 6051dcfe6715473006ff1dad5d1acd17b8d5a6a9 (diff) | |
download | piccast-d50250e74fca8911b97454d19ddb782a98866a11.tar.gz piccast-d50250e74fca8911b97454d19ddb782a98866a11.zip |
fixed scraping bug
-rw-r--r-- | piccast/feeds/management/commands/scrape_feeds.py | 12 |
1 files 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') |