|
|
@@ -198,13 +198,8 @@ public class OddsPortal extends ParserBase implements ParserJoinedFunctions {
|
|
|
result.setSeason(getLastSeason(leagueId, countryId));
|
|
|
|
|
|
resultsToInsert.add(result);
|
|
|
-// System.out.println("INSERTING RESULT: " + result);
|
|
|
-//
|
|
|
if (resultsToInsert.size() > 100) {
|
|
|
Logger.getGlobal().log(Level.INFO, "INSERTING 100 results");
|
|
|
-// System.out.println("INSERTING RESULT " + result.getHomeTeam() + "-" + result.getAwayTeam()
|
|
|
-// + " league " + result.getLeagueId() + " score " + result.getHomeScore() + "-"
|
|
|
-// + result.getAwayScore());
|
|
|
mysql.addResults(resultsToInsert);
|
|
|
resultsToInsert.clear();
|
|
|
}
|
|
|
@@ -260,12 +255,7 @@ public class OddsPortal extends ParserBase implements ParserJoinedFunctions {
|
|
|
|
|
|
private void setOdds(ResultDTO result, WebElement firstResultsDiv) {
|
|
|
List<WebElement> oddsDivs = firstResultsDiv.findElements(By.xpath("./div/div"));
|
|
|
-
|
|
|
try {
|
|
|
-// result.setOdds1(Float.parseFloat(oddsDivs.get(0).getText()));
|
|
|
-// result.setOddsX(Float.parseFloat(oddsDivs.get(1).getText()));
|
|
|
-// result.setOdds2(Float.parseFloat(oddsDivs.get(2).getText()));
|
|
|
-
|
|
|
result.setOdds1(Float.parseFloat(oddsDivs.get(1).getText()));
|
|
|
result.setOddsX(Float.parseFloat(oddsDivs.get(2).getText()));
|
|
|
result.setOdds2(Float.parseFloat(oddsDivs.get(3).getText()));
|
|
|
@@ -278,14 +268,13 @@ public class OddsPortal extends ParserBase implements ParserJoinedFunctions {
|
|
|
}
|
|
|
|
|
|
private void setScoring(ResultDTO result, WebElement firstResultsDiv) {
|
|
|
-// String resultPath = "./div/a/div[2]/div/div/div/div/div";
|
|
|
- String resultPath = "./div/div/div[2]/div/div/div/div";
|
|
|
+ String resultPath = "./div/div/div[2]/div/div/div/div/div";
|
|
|
|
|
|
if (checkIfElementExists(firstResultsDiv, resultPath)) {
|
|
|
List<WebElement> scoringDivs = firstResultsDiv.findElements(By.xpath(resultPath));
|
|
|
try {
|
|
|
result.setHomeScore(Integer.parseInt(scoringDivs.get(0).getText()));
|
|
|
- result.setAwayScore(Integer.parseInt(scoringDivs.get(2).getText()));
|
|
|
+ result.setAwayScore(Integer.parseInt(scoringDivs.get(1).getText()));
|
|
|
} catch (NumberFormatException e) {
|
|
|
// There is no scoring yet continue processing
|
|
|
}
|
|
|
@@ -294,11 +283,6 @@ public class OddsPortal extends ParserBase implements ParserJoinedFunctions {
|
|
|
}
|
|
|
|
|
|
private void setTeamsInfo(ResultDTO result, WebElement firstResultsDiv) {
|
|
|
- //List<WebElement> teams = firstResultsDiv.findElements(By.xpath(".//div//a//div[2]//a"));
|
|
|
- // List<WebElement> teams = firstResultsDiv.findElements(By.xpath(".//a"));
|
|
|
- // String homeTeamName = teams.get(0).findElement(By.xpath("./div")).getText().trim();
|
|
|
- //String awayTeamName = teams.get(1).findElement(By.xpath("./div")).getText().trim();
|
|
|
-
|
|
|
String homeTeamName = firstResultsDiv.findElement(By.xpath(".//a[1]/div")).getText().trim();
|
|
|
String awayTeamName = firstResultsDiv.findElement(By.xpath(".//a[2]/div")).getText().trim();
|
|
|
|