File tree Expand file tree Collapse file tree 2 files changed +3
-0
lines changed
Expand file tree Collapse file tree 2 files changed +3
-0
lines changed Original file line number Diff line number Diff line change 474474 }
475475 }
476476 )
477+ next "ratelimited" if response . code == 401 && response . body . include? ( '"Please wait a few minutes before you try again."' )
477478 raise ( App ::InstagramError , response ) if !response . success? || !response . json?
478479 data = response . json [ "data" ] [ "xdt_api__v1__fbsearch__topsearch_connection" ] [ "users" ] . find { |data | data [ "user" ] [ "username" ] == name }
479480 next "Error: Could not find an Instagram user with that username. Please enter the username exactly." if !data
480481 user = data [ "user" ]
481482 "#{ user [ "id" ] } /#{ user [ "username" ] } "
482483 end
483484 return [ 422 , "Something went wrong. Try again later." ] if path . nil?
485+ return [ 429 , "Ratelimited. Try again later." ] if path == "ratelimited"
484486 return [ 422 , path ] if path . start_with? ( "Error:" )
485487 end
486488 redirect Addressable ::URI . new ( path : "/instagram/#{ path } " ) . normalize . to_s , 301
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ def self.get_post(id)
3232 }
3333 }
3434 )
35+ next nil if response . code == 401 && response . body . include? ( '"Please wait a few minutes before you try again."' )
3536 raise ( InstagramError , response ) if !response . success? || !response . json
3637
3738 data = response . json [ "data" ] [ "xdt_shortcode_media" ]
You can’t perform that action at this time.
0 commit comments