Skip to content

Instantly share code, notes, and snippets.

@naoto
Created October 24, 2016 11:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naoto/72d48c7205e1ef11193f4e2c661bb15d to your computer and use it in GitHub Desktop.
Save naoto/72d48c7205e1ef11193f4e2c661bb15d to your computer and use it in GitHub Desktop.
# -*- mode:ruby; coding:utf-8 -*-
module Atig
module IFilter
module Media
def self.call(status)
media_urls = []
if status.extended_entities && status.extended_entities.media
status.extended_entities.media.each do |media|
media_urls << media.media_url
end
elsif status.entities.media
status.entities.media.each do |media|
media_urls << media.media_url
end
end
status.merge text: "#{status.text} #{media_urls.join(' ')}"
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment