Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 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"].each do |url_entity|
- url, expanded_url = url_entity.values_at("url", "expanded_url")
- text.gsub!(url, expanded_url) rescue nil # FIXME
- end
- end
- end
- end
Add Comment
Please, Sign In to add comment