module RSocial::Instagram::Client::Tags

Public Instance Methods

tag(query) click to toggle source
# File lib/rsocial/instagram/client/tags.rb, line 5
def tag(query)
  run(
    "https://www.instagram.com/explore/tags/#{query}/",
    tag_injections
  ).merge(:query => query)
end
tags_instance(query) click to toggle source
# File lib/rsocial/instagram/client/tags.rb, line 12
def tags_instance(query)
  wd = Driver.instance.send( "chrome" )
  wd.get "https://www.instagram.com/explore/tags/#{query}/"
  wd
end

Private Instance Methods

tag_injections() click to toggle source
# File lib/rsocial/instagram/client/tags.rb, line 20
def tag_injections
  {
    :post_count => "return document.getElementsByClassName('_fd86t')[0].innerHTML",
    :images => "return function() { var urls = []; arr = document.getElementsByClassName('_4rbun'); for (var i=0; i< arr.length; i++) { urls.push({alt: arr[i].childNodes[0].alt, src: arr[i].childNodes[0].currentSrc}) }; return urls}()",
  }
end