我正在用Java编写一个程序来解析来自Steam社区市场网页的数据。我知道如果连接在一定时期内进入市场的次数太多,那么蒸汽社区市场会在一段时间内阻止连接。现在,我的程序每250毫秒访问一个网页,在切换到另一个代理之前它将执行10次。我的问题是,即使我切换代理,我仍然会得到http错误429(请求太多)。我知道代理切换有效,因为我从http://checkip.amazonaws.com访问我的ip,它将返回新代理的ip。蒸汽社区市场是否会阻止客户以及连接?有办法解决这个问题吗?
以下是代码:
switch(proxyInt){
case 0:
System.out.println("default");
break;
case 1:
System.setProperty("http.proxyHost", "104.238.131.206");
System.setProperty("http.proxyPort", "8080");
break;
case 2:
System.setProperty("http.proxyHost", "158.85.241.82");
System.setProperty("http.proxyPort", "1080");
break;
case 3:
System.setProperty("http.proxyHost", "45.63.85.44");
System.setProperty("http.proxyPort", "3128");
break;
}
URL whatismyip = new URL("http://checkip.amazonaws.com");
BufferedReader ins = new BufferedReader(new InputStreamReader(whatismyip.openStream()));
String ip = ins.readLine();
System.out.println(ip);
URL url = new URL("http://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name=" + skins[x].substring(46));
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String gun = in.readLine();
skinsLowest[x] = moneyLowest(gun);
skinsMedian[x] = moneyMedian(gun);
skinsProfit[x] = skinsMedian[x] * .87 - skinsLowest[x];
lowestPrices[x].setText(skinsLowest[x] + "");
medianPrices[x].setText(skinsMedian[x] + "");
String round = skinsProfit[x] + "";
profitPrices[x].setText(round.substring(0, 5));
System.out.println("Lowest: " + skinsLowest[x]);
System.out.println("Median: " + skinsMedian[x]);
repaint();
if(x % 10 == 0 && x != 0)
proxyInt++;
if(x == amount)
x = 0;
else
x++;