62 lines
2.0 KiB
PHP
62 lines
2.0 KiB
PHP
<?php
|
|
/**
|
|
* Update DreamTripspk post with direct video URL
|
|
*/
|
|
|
|
define('WP_USE_THEMES', false);
|
|
require('../../../wp-load.php');
|
|
|
|
$video_url = 'https://www.youtube.com/watch?v=kWRhLLbLFE0';
|
|
$post_id = 17512; // DreamTripspk Post ID
|
|
|
|
echo "=== Updating DreamTripspk Post ===\n\n";
|
|
|
|
// Update the meta field
|
|
$result = update_post_meta($post_id, '_mm_livestream_player_url', $video_url);
|
|
|
|
if ($result) {
|
|
echo "✓ Updated _mm_livestream_player_url to: $video_url\n";
|
|
} else {
|
|
// Check if value already exists
|
|
$current = get_post_meta($post_id, '_mm_livestream_player_url', true);
|
|
if ($current === $video_url) {
|
|
echo "✓ Value already set to: $video_url\n";
|
|
} else {
|
|
echo "✗ Update failed. Current value: $current\n";
|
|
}
|
|
}
|
|
|
|
// Clear caches
|
|
$channel_id = get_post_meta($post_id, '_mm_livestream_youtube_channel_id', true);
|
|
if ($channel_id) {
|
|
$channel_url = 'https://www.youtube.com/channel/' . $channel_id . '/live';
|
|
$cache_key = 'mm_yt_live_v2_' . md5($channel_url);
|
|
delete_transient($cache_key);
|
|
echo "✓ Cleared cache for channel\n";
|
|
}
|
|
|
|
// Clear video status cache
|
|
delete_transient('mm_yt_status_kWRhLLbLFE0');
|
|
echo "✓ Cleared video status cache\n";
|
|
|
|
// Test the livestream data
|
|
echo "\n=== Testing Livestream Item ===\n";
|
|
$item = mm_video_get_livestream_item($post_id);
|
|
if ($item) {
|
|
echo "Title: " . $item['title'] . "\n";
|
|
echo "Owner: " . $item['owner'] . "\n";
|
|
echo "Platform: " . $item['stream']['platform'] . "\n";
|
|
echo "Video ID: " . $item['stream']['video_id'] . "\n";
|
|
echo "Embed URL: " . ($item['stream']['embed_url'] ? 'SET' : 'EMPTY') . "\n";
|
|
|
|
// Test live status
|
|
if (!empty($item['stream']['video_id'])) {
|
|
$is_live = mm_video_check_youtube_live_status($item['stream']['video_id']);
|
|
echo "Live Status: " . ($is_live ? "LIVE" : "NOT LIVE") . "\n";
|
|
}
|
|
} else {
|
|
echo "ERROR: Could not get livestream item data\n";
|
|
}
|
|
|
|
echo "\n✓ Update Complete! Reload the page.\n";
|