Permalink
Browse files

Fixes RSS parser so it takes all published_at formats. closes #96

  • Loading branch information...
1 parent 6cb09f9 commit c3e111ed2f87bfcdd06a54db2fb74d66c44d6741 @fdv fdv committed Dec 26, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 app/controllers/admin/dashboard_controller.rb
@@ -109,7 +109,7 @@ def parse_rss(body)
item.link = REXML::XPath.match(elem, "link/text()").first.value rescue ""
item.description = REXML::XPath.match(elem, "description/text()").first.value rescue ""
item.author = REXML::XPath.match(elem, "dc:publisher/text()").first.value rescue ""
- item.date = Time.mktime(*ParseDate.parsedate(REXML::XPath.match(elem, "dc:date/text()").first.value)) rescue Time.now
+ item.date = Time.mktime(*ParseDate.parsedate(REXML::XPath.match(elem, "dc:date/text()").first.value)) rescue Date.parse(REXML::XPath.match(elem, "pubDate/text()").first.value) rescue Time.now
item.description_link = item.description
item.description.gsub!(/<\/?a\b.*?>/, "") # remove all <a> tags

0 comments on commit c3e111e

Please sign in to comment.