diff --git a/lib/ruby-instagram-scraper.rb b/lib/ruby-instagram-scraper.rb index 404a2af..4a8b587 100644 --- a/lib/ruby-instagram-scraper.rb +++ b/lib/ruby-instagram-scraper.rb @@ -54,5 +54,12 @@ def self.get_media_comments ( shortcode, count = 40, before = nil ) JSON.parse( open( url ).read )["comments"] end + + def self.get_location ( code ) + url = "https://www.instagram.com/explore/locations/#{ code }/?__a=1" + params = "" + + JSON.parse( open( url + params ).read )["location"] + end -end \ No newline at end of file +end diff --git a/test/ruby_instagram_scraper_test.rb b/test/ruby_instagram_scraper_test.rb index 73e4d60..522ef58 100644 --- a/test/ruby_instagram_scraper_test.rb +++ b/test/ruby_instagram_scraper_test.rb @@ -39,4 +39,10 @@ end end -end \ No newline at end of file + describe "when request location by id" do + it "users must be an array" do + RubyInstagramScraper.get_location(2327407)["name"].must_be_instance_of String + end + end + +end