generated from mirzaev/pot
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
8ea9e7ef3d | |||
05143b6865 | |||
accfe5a496 | |||
53f8f3871c | |||
d2c86a6222 | |||
830ba25b8d |
@@ -5,7 +5,7 @@ Wants=network.target
|
||||
After=syslog.target network-online.target
|
||||
|
||||
[Service]
|
||||
ExecStart=sudo -u www-data /usr/bin/php /var/www/project/mirzaev/parser_from_interneturok/system/public/telegram.php
|
||||
ExecStart=sudo -u www-data /usr/bin/php /var/www/parser_from_interneturok/mirzaev/parser_from_interneturok/system/public/telegram.php
|
||||
PIDFile=/var/run/php/parser_from_interneturok-telegram.pid
|
||||
RemainAfterExit=no
|
||||
RuntimeMaxSec=3600s
|
||||
|
@@ -175,7 +175,7 @@ final class interneturok extends core
|
||||
if (!empty($accounts)) {
|
||||
// Initialized accounts
|
||||
|
||||
/* if (shuffle($accounts)) { */
|
||||
if (shuffle($accounts)) {
|
||||
// Shuffled accounts
|
||||
|
||||
foreach ($accounts as $account) {
|
||||
@@ -184,6 +184,8 @@ final class interneturok extends core
|
||||
// Waiting for processing the request
|
||||
sleep($waiting);
|
||||
|
||||
try {
|
||||
|
||||
if ($this->authentication($account)->wait()) {
|
||||
// Authenticated the account
|
||||
|
||||
@@ -233,7 +235,7 @@ final class interneturok extends core
|
||||
// Found the target subject
|
||||
|
||||
// Writing into the output buffer
|
||||
echo "Найден школьный предмет: $subject->value для $grade класса (с " . new datetime($event->date)->format('d.m') . ' по ' . new datetime($event->date)->modify('+6 days')->format('d.m') . ")\n";
|
||||
/* echo "Найден школьный предмет: $subject->value для $grade класса (с " . new datetime($event->date)->format('d.m') . ' по ' . new datetime($event->date)->modify('+6 days')->format('d.m') . ")\n"; */
|
||||
|
||||
// Initializing the unblock time
|
||||
$unblock = svoboda::timestamp() - 31536000;
|
||||
@@ -318,8 +320,11 @@ final class interneturok extends core
|
||||
// Proceed to processing the next account
|
||||
continue;
|
||||
}
|
||||
} catch (exception $exception) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* } */
|
||||
}
|
||||
|
||||
// Exit (fail)
|
||||
@@ -642,7 +647,8 @@ final class interneturok extends core
|
||||
);
|
||||
|
||||
return $this->browser->sendAsync($request)
|
||||
->then(function ($response) use ($homework) {
|
||||
->then(
|
||||
function ($response) use ($homework) {
|
||||
// Sended the request and received the response
|
||||
|
||||
// Initializing the lesson
|
||||
@@ -833,7 +839,8 @@ final class interneturok extends core
|
||||
// Exit (fail)
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// Exit (fail)
|
||||
@@ -898,6 +905,7 @@ final class interneturok extends core
|
||||
*/
|
||||
public static function amount(): int
|
||||
{
|
||||
try {
|
||||
// Opening the interneturok accounts file
|
||||
$file = new spl(INTERNETUROK_ACCOUNTS_FILE, 'r');
|
||||
|
||||
@@ -909,5 +917,9 @@ final class interneturok extends core
|
||||
|
||||
// Exit (success)
|
||||
return $rows;
|
||||
} catch (exception $exception) {
|
||||
// Exit (fail)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -17,6 +17,9 @@ use Zanzara\Context as context,
|
||||
// Framework for asynchronous PHP
|
||||
use function React\Async\await;
|
||||
|
||||
// Built-in libraries
|
||||
use Exception as exception;
|
||||
|
||||
/**
|
||||
* Telegram shcool subjects parser
|
||||
*
|
||||
@@ -205,8 +208,9 @@ final class parser extends core
|
||||
// Initializing the parser
|
||||
$parser = new interneturok();
|
||||
|
||||
try {
|
||||
// Parsing homework files
|
||||
$files = $parser->parse(subject: $subject, grade: $grade, waiting: 0);
|
||||
$files = $parser->parse(subject: $subject, grade: $grade, waiting: 3);
|
||||
|
||||
if (!empty($files)) {
|
||||
// Initialized homework files
|
||||
@@ -224,7 +228,17 @@ final class parser extends core
|
||||
// Not initialized homework files
|
||||
|
||||
// Sending the message
|
||||
$context->sendMessage('❌ *Не найдены домашние задания')
|
||||
$context->sendMessage('❌ *Не найдены домашние задания*')
|
||||
->then(function (message $message) use ($context) {
|
||||
// Sended the message
|
||||
|
||||
// Sending the menu with subjects
|
||||
commands::menu($context);
|
||||
});
|
||||
}
|
||||
} catch (exception $exception) {
|
||||
// Sending the message
|
||||
$context->sendMessage('⚠️ *Произошла ошибка при обработке домашних заданий*')
|
||||
->then(function (message $message) use ($context) {
|
||||
// Sended the message
|
||||
|
||||
|
@@ -32,9 +32,6 @@ define('VIEWS', INDEX . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'view
|
||||
// Initializing path to the directory of settings
|
||||
define('SETTINGS', INDEX . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'settings');
|
||||
|
||||
// Initializing system settings
|
||||
require SETTINGS . DIRECTORY_SEPARATOR . 'system.php';
|
||||
|
||||
// Initializing path to the directory of the storage
|
||||
define('STORAGE', INDEX . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'storage');
|
||||
|
||||
|
@@ -5,5 +5,7 @@
|
||||
*/
|
||||
|
||||
return [
|
||||
1053489457 // Arsen Mirzaev Tatyano-Muradovich @redloser
|
||||
1053489457, // Arsen Mirzaev Tatyano-Muradovich @redloser
|
||||
6831961323, // @IU_K1LLER777
|
||||
1142807069 // @kysakapro
|
||||
];
|
||||
|
@@ -1,4 +0,0 @@
|
||||
<?php
|
||||
|
||||
// Initializing default theme for the views templater
|
||||
define('THEME', 'default');
|
Reference in New Issue
Block a user