aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2011-04-28 01:24:57 +0000
committerbnewbold <bnewbold@robocracy.org>2011-04-28 01:24:57 +0000
commitd50250e74fca8911b97454d19ddb782a98866a11 (patch)
tree2e611a185d82d712d43067f095a1208d3f5371d2
parent6051dcfe6715473006ff1dad5d1acd17b8d5a6a9 (diff)
downloadpiccast-d50250e74fca8911b97454d19ddb782a98866a11.tar.gz
piccast-d50250e74fca8911b97454d19ddb782a98866a11.zip
fixed scraping bug
-rw-r--r--piccast/feeds/management/commands/scrape_feeds.py12
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')