Upload via Git Manager GUI - test-live.php

This commit is contained in:
2026-03-30 18:42:39 +00:00
parent db2ca87135
commit 558f827fa5

View File

@@ -1,47 +1,47 @@
<?php <?php
define('WP_USE_THEMES', false); define('WP_USE_THEMES', false);
require('../../../wp-load.php'); require('../../../wp-load.php');
$urls = array( $urls = array(
'https://www.youtube.com/@NashvilleBirdCam/live', 'https://www.youtube.com/@NashvilleBirdCam/live',
'https://www.youtube.com/channel/UClOWy1mPxNB1D3cpmmxqGEg/live', 'https://www.youtube.com/channel/UClOWy1mPxNB1D3cpmmxqGEg/live',
); );
foreach ($urls as $url) { foreach ($urls as $url) {
echo "\n=== Testing: $url ===\n"; echo "\n=== Testing: $url ===\n";
$response = wp_remote_get($url, array( $response = wp_remote_get($url, array(
'timeout' => 10, 'timeout' => 10,
'redirection' => 5, 'redirection' => 5,
'user-agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36', 'user-agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36',
'headers' => array( 'headers' => array(
'Accept-Language' => 'en-US,en;q=0.9,de;q=0.8', 'Accept-Language' => 'en-US,en;q=0.9,de;q=0.8',
), ),
)); ));
if (is_wp_error($response)) { if (is_wp_error($response)) {
echo "ERROR: " . $response->get_error_message() . "\n"; echo "ERROR: " . $response->get_error_message() . "\n";
continue; continue;
} }
$body = wp_remote_retrieve_body($response); $body = wp_remote_retrieve_body($response);
echo "Response size: " . strlen($body) . " bytes\n"; echo "Response size: " . strlen($body) . " bytes\n";
if (strpos($body, 'PAmS12qbdzA') !== false) { if (strpos($body, 'PAmS12qbdzA') !== false) {
echo "✓ Found PAmS12qbdzA\n"; echo "✓ Found PAmS12qbdzA\n";
$pos = strpos($body, 'PAmS12qbdzA'); $pos = strpos($body, 'PAmS12qbdzA');
$start = max(0, $pos - 150); $start = max(0, $pos - 150);
$context = substr($body, $start, 350); $context = substr($body, $start, 350);
echo "Context:\n" . htmlspecialchars($context) . "\n"; echo "Context:\n" . htmlspecialchars($context) . "\n";
} else { } else {
echo "✗ PAmS12qbdzA NOT found\n"; echo "✗ PAmS12qbdzA NOT found\n";
} }
$video_id = mm_video_extract_youtube_live_video_id($body); $video_id = mm_video_extract_youtube_live_video_id($body);
if ($video_id) { if ($video_id) {
echo "✓ Extracted video_id: $video_id\n"; echo "✓ Extracted video_id: $video_id\n";
} else { } else {
echo "✗ NO video_id extracted\n"; echo "✗ NO video_id extracted\n";
} }
} }