for(String Country : Countries) { System.out.println(MessageFormat.format("Connecting to {0} Steam Store...", Country)); final String storeURL = MessageFormat.format("http://store.steampowered.com/search/?sort_by=Name&sort_order=ASC&category1=998&cc={0}&v5=1&page=1", Country); Document pageContent = Jsoup.connect(storeURL).get(); int totalPages = Integer.parseInt(pageContent.select("div.search_pagination_right").first().select("a[href]").get(2).text()); for(int page = 1; page < totalPages + 1; page++) { System.out.println(MessageFormat.format("Loading page {0} of {1}", page, totalPages)); Document cPageContent = Jsoup.connect(MessageFormat.format("http://store.steampowered.com/search/?sort_by=Name&sort_order=ASC&category1=998&cc={0}&v5=1&page={1}", Country, page)).timeout(20000).get(); Elements Games = cPageContent.select("#main > #main_content > #search_results > #search_result_container > div").get(5).select("a[href]"); for(Element Game : Games) { int id = Integer.parseInt(StringExtract(Game.attr("href").toString(), "(\\d{1,})").group(0)); double price = 0.00; String name = Game.select("div").get(5).select("h4").text(); String release = Game.select("div").get(3).text(); String tempPrice = Game.select("div").first().html(); if(tempPrice.contains("strike")) { tempPrice = Game.select("div").first().select("span").text().replaceAll("[$€£]", "").replaceAll("[,]", "."); } else { tempPrice = Game.select("div").first().text().replaceAll("[$€£]", "").replaceAll("[,]", "."); } if(tempPrice.contains("Free to Play") || tempPrice.contains("Free") || tempPrice.contains("Third") || tempPrice.contains("Play it Now") || tempPrice.contains("Install") || tempPrice.equals("")) { price = 0.00; } else if(tempPrice.contains("--")) { price = Double.parseDouble(tempPrice.replace("--", "00")); } else { price = Double.parseDouble(tempPrice); } SteamGames.add(new SteamGame(id, price, name, release, Country)); } }