根据在doveip proxy 获得的ip 可以进行换ip进行curl

require 'json'
#url = "https://curl.se/docs/sslcerts.html"
url = "https://www.google.com"
i = 1
loop do
  command_get_token = %Q{curl -d "user=username&password=password" https://dvapi.doveproxy.net/cmapi.php?rq=login}
  puts command_get_token
  get_token = `#{command_get_token}`
  puts get_token
  token = JSON.parse(get_token)['data']['token']
  puts token
  command_get_ip = %Q{curl -ipv4 -d "user=username&token=#{token}&geo=mx" https://dvapi.doveproxy.net/cmapi.php?rq=distribute}
  #puts command_get_ip
  get_ip = `#{command_get_ip}`
  #puts "=== get_ip#{get_ip.inspect}"
  temp_ip = get_ip.to_s.split("\r\n\r\n").last
  #puts "=== temp ip:"
  #puts temp_ip
  ip = JSON.parse(temp_ip)['data']['ip']
  port = JSON.parse(temp_ip)['data']['port']
  puts "=== ip #{ip} port #{port}"
  (1..5).each do |e|
    puts "=== e#{e}"
    command_get_content = %Q{curl -ipv4 --socks5 #{ip}:#{port} #{url}}
    puts command_get_content
    get_content = `#{command_get_content}`
    sleep 1
    puts "=== sleep end"
  end
  i = i + 1
  if i > 20
    break
  end
end