Hello. I'm using l2jserver High Five. I have this code:
/**
* Get the votes of TOPZONE
* @return
*/
public static int getVotesTopzone()
{
int votes = -1;
URL url = null;
URLConnection urlConnection = null;
InputStream inputStream = null;
InputStreamReader inputStreamReader = null;
BufferedReader bufferedReader = null;
try
{
url = new URL(ConfigData.TOPZONE_URL);
urlConnection = url.openConnection();
urlConnection.addRequestProperty("User-Agent", "L2TopZone");
inputStream = urlConnection.getInputStream();
inputStreamReader = new InputStreamReader(inputStream);
bufferedReader = new BufferedReader(inputStreamReader);
String inputLine;
while ((inputLine = bufferedReader.readLine()) != null)
{
switch (TOPZONE_VOTE_LINK_TYPE)
{
case 0:
if (inputLine.contains("fa fa-fw fa-lg fa-thumbs-up"))
{
votes = Integer.valueOf(inputLine.split(">")[1922].replace("</span", ""));
}
break;
case 1:
if (inputLine.contains("fa fa-fw fa-lg fa-thumbs-up"))
{
votes = Integer.valueOf(inputLine.split(">")[1926].replace("</span", ""));
}
break;
}
}
}
catch (Exception e)
{
e.printStackTrace();
}
return votes;
}
But return total votes -1