Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/monara/public_html/test.athavaneng.com/themes.php on line 99
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 226
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 227
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 228
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 229
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 230
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 231
Global Sync started at: $currentTime";
// -----------------------------
// 1. Teledramas Sync
// -----------------------------
$startTeledrama = date('Y-m-d H:i:s');
echo "Teledrama sync started at: $startTeledrama
";
$totalTeledramas = updateTeledramasAndEpisodes($conn, $api_key, 0);
echo "Teledrama sync completed. Total updated: $totalTeledramas
";
// -----------------------------
// 2. Programmes Sync
// -----------------------------
$startProgramme = date('Y-m-d H:i:s');
echo "Programme sync started at: $startProgramme
";
$totalProgrammes = updateProgrammesAndEpisodes($conn, $api_key, 0);
echo "Programme sync completed. Total updated: $totalProgrammes
";
// -----------------------------
// 3. Events (YouTube Shorts) Sync - NEW
// -----------------------------
$startEvents = date('Y-m-d H:i:s');
echo "Events (Shorts) sync started at: $startEvents
";
$eventCount = 0;
$url = "https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=50&playlistId=$shorts_playlist_id&key=$shorts_api_key";
$response = @file_get_contents($url);
if ($response) {
$data = json_decode($response, true);
if (isset($data['items'])) {
$stmt = $conn->prepare("INSERT IGNORE INTO youtube_shorts (video_id, title, thumbnail_url, published_at) VALUES (?, ?, ?, ?)");
foreach ($data['items'] as $item) {
$v_id = $item['snippet']['resourceId']['videoId'];
$title = $item['snippet']['title'];
$thumb = $item['snippet']['thumbnails']['high']['url'] ?? '';
$pub_at = date('Y-m-d H:i:s', strtotime($item['snippet']['publishedAt']));
if (!in_array($title, ["Private video", "Deleted video"])) {
if($stmt->execute([$v_id, $title, $thumb, $pub_at])) {
$eventCount++;
}
}
}
echo "Events sync completed. New shorts processed: $eventCount
";
}
} else {
echo "Events sync failed: Could not connect to YouTube API.
";
}
$finished = date('Y-m-d H:i:s');
echo "
All syncs finished at: $finished
";
?>