';
} else {
// Check for YouTube video link
$youtubeRegex = '/https?:\/\/(www\.)?(m\.)?youtube\.com\/watch\?v=([a-zA-Z0-9_-]{11})/';
preg_match($youtubeRegex, $status['content'], $youtubeMatch);
if ($youtubeMatch) {
// Extract video ID from YouTube link
$videoId = $youtubeMatch[3];
// Create embedded player for YouTube video
$embeddedPlayer = '';
// Create link to YouTube video
$videoLink = '
';
// Add both embedded player and link to the content
$media = $embeddedPlayer . $videoLink;
// Remove YouTube link from content
$content = str_replace($youtubeMatch[0], '', $content);
} else {
// Check for image attachments
if (count($status['media_attachments']) > 0) {
$media = '