Skip to content

Commit

Permalink
hashtag search
Browse files Browse the repository at this point in the history
  • Loading branch information
ashaw committed Mar 31, 2015
1 parent 490d3fe commit ffcc810
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app.rb
Expand Up @@ -16,7 +16,7 @@ class QIS < Sinatra::Base
enable :sessions
set :raise_errors, Proc.new { false }
set :show_exceptions, false

get '/' do
if !params["code"] && !session[:access_token]
redirect "https://api.instagram.com/oauth/authorize/?client_id=#{CLIENT_ID}&redirect_uri=#{REQUEST_URI}&response_type=code"
Expand Down Expand Up @@ -65,7 +65,7 @@ class QIS < Sinatra::Base
})
end
elsif @search_params[:tag]
results = RestClient.get("https://api.instagram.com/v1/tags/search", {:params => {:q => @search_params[:tag], :access_token => session[:access_token]}})
results = RestClient.get("https://api.instagram.com/v1/tags/#{@search_params[:tag]}/media/recent", {:params => {:access_token => session[:access_token], :count => 1000}})
else
results = RestClient.get("https://api.instagram.com/v1/media/search", {:params => @search_params.merge!({:access_token => session[:access_token]})})
end
Expand Down

1 comment on commit ffcc810

@gvandendool
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,
Interesting piece of code, especially the part with distance. I read that the max search distance is 5000m around a location; is your code surpassing this, or will the search still be limited? I'm looking for some solution which could give me all pictures, with a hashtag texts, at a certain time interval (5 days), in a certain area (Germany). Will your code help me with this?

Please sign in to comment.