-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathimage.rb
executable file
·32 lines (26 loc) · 928 Bytes
/
image.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/ruby
# Imagetypers API test
load "lib/imagetyperzapi.rb"
def test_api
# grab token from https://imagetyperz.com
access_token = "your_access_token"
ita = ImageTyperzAPI.new(access_token)
# check account balance
balance = ita.account_balance # get balance
puts "Account balance: #{balance}" # print balance
# submit image captcha, and check for solution
puts "Waiting for captcha to be solved..."
captcha_id = ita.submit_image(image_path = 'captcha.jpg')
# with optional image parameters
# captcha_id = ita.solve_captcha(image_path = 'captcha.jpg', is_case_sensitive = true, is_math = true, is_phrase = true, digits_only = false, letters_only = true, min_length = 2, max_length = 5)
captcha_text = ita.retrieve_response captcha_id
puts "Response: #{captcha_text}"
end
def main
begin
test_api
rescue => details
puts "[!] Error occured: #{details}"
end
end
main