Files
kr_1/Main.java
2026-05-23 15:11:39 +00:00

34 lines
1.0 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
public class Main {
public static void main(String[] args) {
String botToken = "8586609598:AAHRN6eqpkqCOP4xjX_FH20jdpjbJncmqBY";
String chatId = "462049828";
TelegramNotifier.init(botToken, chatId);
System.out.println("Telegram-уведомления активированы!");
String url = "https://cbr.ru/currency_base/daily/";
while (true) {
try {
String html = WebLoader.loadPage(url);
double usd = CurrencyParser.parseUSD(html);
if (usd != -1) {
System.out.println("USD: " + usd);
ExcelWriter.write(usd);
CurrencyAnalyzer.analyze(usd);
} else {
System.err.println("Не удалось спарсить курс USD");
}
Thread.sleep(60 * 1000);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}