Created
August 31, 2011 23:47
-
-
Save no6v/1185063 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# replace t.co shortened url to origin if entity is available | |
Earthquake.init do | |
output_filter do |item| | |
text = item["text"] | |
entities = item["entities"] | |
if text and entities | |
[entities["urls"], entities["media"]].compact.flatten.each do |url_entity| | |
url, expanded_url = url_entity.values_at("url", "expanded_url") | |
text.gsub!(url, expanded_url) | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment