NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

String baseUrl = "https://vprognoze.ru/forecast/newbie/";

while (true) {
try {
driver.get(baseUrl);
break;
} catch (Exception e) {
if (countError++ >= 3)
throw e;
}
}

Thread.sleep(1500);
// getAllCurrentNewbieBets();
//
// baseUrl = "https://vprognoze.ru/forecast/pro/";
//
// countError=0;
//
// while(true) {
// try {
// driver.get(baseUrl);
// break;
// } catch (Exception e){
// if (countError++>=3) throw e;
// }
// }
//
//
// Thread.sleep(1500);
// getAllCurrentProBets();

// fillUnsettled();

while (true) {
fillBetsFromURLlist();
}

private static void fillBetsFromURLlist() throws Exception {

LocalDataBase db = new LocalDataBase();
ArrayList<VprognozeBet> vprognozeList = new ArrayList<>();
TimeZone.setDefault(TimeZone.getTimeZone("GMT+03"));
Date beginTime = Calendar.getInstance(TimeZone.getTimeZone("GMT+0300")).getTime();

String[] unfilledURLS = LocalDataBase.getNonParsedBetsURLs();

for (String u : unfilledURLS) {

System.out.println(u);

try {
driver.get(URLBuilder.getForecastPage(u));
} catch (Exception e) {
System.out.println("timeout exceeded " + u + " " + URLBuilder.getForecastPage(u));
continue;
}

page = driver.getPageSource();

if (Jsoup.parse(page).select(
"div:contains(К сожалению, данная страница для Вас не доступна, возможно был изменен ее адрес или она была удалена)")
.size() > 0) {
System.out.println("отсутствует " + u);
// прописать заход на поиск прогнозов конкретного пользователя в рамках
// betPlacedDate +- 3 дня
try {
System.out.println("ty");
String author = LocalDataBase.getAuthorNameFromUrl(u);
// Date betPlaced
System.out.println("tryauthor");
driver.get(URLBuilder.getPlayerMainPage(author));
System.out.println(URLBuilder.getPlayerMainPage(author));
} catch (Exception e) {
System.out.println("timeout exceeded " + u + " "
+ URLBuilder.getPlayerMainPage(LocalDataBase.getAuthorNameFromUrl(u)));
continue;
}

page = driver.getPageSource();

if (Jsoup.parse(page).select(
"div:contains(По данному критерию новости не найдены, либо у вас нет доступа для просмотра этих новостей)")
.size() > 0) {
continue;
}

// задание Task - прописать сбор адресов прогнозов с страницы пользователя с
// критерием +- 3 дня от основного прогноза;
Document doc = Jsoup.parse(page);
Date lastUserPredictionDate;
lastUserPredictionDate = VprCurBetsParser.getDateTimeOfBetPlacing(doc);
System.out.println("lastUserPredictionDate" + " " + lastUserPredictionDate);
// цикл while last v-user-lastprognoz__date date > u.betDatePlaced-3 дня then
// push ПОКАЗАТЬ_ЕЩЕ"
// проходим по всем v-user-lastprognoz__date
// if Mod (u.betdate placed - oneOfUserBets) < = 3 дня - добавить в лист адресов
// пройти по адресам из листа

// стереть прогноз с адресом u
continue;
}

vprognozeList.addAll(VprCurBetsParser.parseSeparateBet(page, u));
if (vprognozeList.size() == 100) {
db.updateVprUserBetsNoMerge(vprognozeList);
vprognozeList.clear();
System.out.println(Calendar.getInstance(TimeZone.getTimeZone("GMT+0300")).getTime());
}
}

db.updateVprUserBetsNoMerge(vprognozeList);
vprognozeList.clear();

Date endTime = Calendar.getInstance(TimeZone.getTimeZone("GMT+0300")).getTime();

System.out.println("begin " + beginTime);
System.out.println("end " + endTime);

}


public static String[] getNonParsedBetsURLs() throws SQLException {
String[] URLS;
ArrayList<String> list = new ArrayList<String>();
LocalDataBase db = new LocalDataBase();
Connection conn = db.getConnection();
Statement statement = conn.createStatement();
ResultSet rs = statement.executeQuery("SELECT betURL,author FROM vprUserBets WHERE author = '192.168.0.192'");
while (rs.next()) {
String url = rs.getString("betURL");
list.add(url);
}

CachedRowSetImpl crs = new CachedRowSetImpl();

int counter = 2000 - list.size();
if (counter > 0) {
rs = statement.executeQuery("WITH cte AS ( " + "SELECT TOP(" + counter
+ ") betURL,author FROM vprUserBets WHERE betplacedate IS NULL AND author = '' ORDER BY eventdate) "
+ "UPDATE cte SET author = '192.168.0.192' OUTPUT inserted.betURL ");

crs.populate(rs);

while (crs.next()) {
String url = crs.getString("betURL");
list.add(url);
}
}

crs.close();

URLS = new String[list.size()];
URLS = list.toArray(URLS);
statement.close();
conn.close();
return URLS;
}

public void updateVprUserBetsNoMerge(List<VprognozeBet> vprlist) throws SQLException {
LocalDataBase db = new LocalDataBase();
Connection conn = db.getConnection();
PreparedStatement prepared = conn.prepareStatement(
"UPDATE vprUserBets SET eventdate=?, author=?, league=?, mainMatch=?, betSelection=?, betKoeff=?, betAmount=?, betDesc=?, result=?, resultcolor=?, betplacedate=?, bankAtBetMoment=? "
+ "WHERE betURL=?");

for (VprognozeBet vpbet : vprlist) {
prepared.setTimestamp(1, new Timestamp(vpbet.dateOfEvent.getTime().getTime()));
prepared.setString(2, vpbet.author);
prepared.setString(3, vpbet.league);
prepared.setString(4, vpbet.competitor1 + " - " + vpbet.competitor2);
prepared.setString(5, vpbet.selection);
prepared.setFloat(6, vpbet.betKoeff);
prepared.setFloat(7, vpbet.betAmount);
prepared.setString(8, vpbet.betDescription);
prepared.setString(9, vpbet.result);
prepared.setString(10, vpbet.resultColor);
prepared.setTimestamp(11, new Timestamp(vpbet.dateOfBetplace.getTime()));
prepared.setFloat(12, vpbet.bankAtBetMoment);
prepared.setString(13, vpbet.betURL);
prepared.addBatch();
}

// System.out.println(tmpSQL);
try {
prepared.executeBatch();
} catch (Exception e) {
throw e;
}

prepared.close();
conn.close();
System.out.println("database insert completed");
}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.