lib/share_checker/providers/twitter.rb in share_checker-0.1.1 vs lib/share_checker/providers/twitter.rb in share_checker-0.1.2
- old
+ new
@@ -8,11 +8,11 @@
#
# twttr.receiveCount({"count":38,"url":"http://www.mcdonaldseurokids2012.com.ua/challenges/1/works/98/"})
#
def parse(response)
if response =~ /^twttr.receiveCount\((.+)\)$/i
- obj = Crack::JSON.parse($1)
- obj["count"].to_i
+ doc = parse_json($1)
+ doc.nil? ? 0 : doc["count"].to_i
end
end
def url
"http://urls.api.twitter.com/1/urls/count.json?callback=twttr.receiveCount&url="