... // Hàm xử lý remote upload cho từng host function mhvm_multihost_upload($mp4_url, $mhru_config) { $results = []; $google_drive_id = mhvm_extract_drive_id($mp4_url); // Mixdrop remote upload if (!empty($mhru_config['mixdrop_key']) && !empty($mhru_config['mixdrop_email'])) { $api_url = 'https://api.mixdrop.ag/remoteupload?email=' . urlencode($mhru_config['mixdrop_email']) . '&key=' . urlencode($mhru_config['mixdrop_key']) . '&url=' . urlencode($mp4_url); $response = wp_remote_get($api_url, ['timeout' => 30]); if (is_array($response) && !is_wp_error($response)) { $data = json_decode($response['body'], true); // LOG DATA if (!$data || empty($data['result'])) { $results['Mixdrop'] = '[DEBUG] Không có dữ liệu trả về: ' . $response['body']; } elseif (isset($data['result']['embedurl'])) { $results['Mixdrop'] = $data['result']['embedurl']; } elseif (isset($data['result']['msg'])) { $results['Mixdrop'] = 'Lỗi: ' . esc_html($data['result']['msg']); } else { $results['Mixdrop'] = '[DEBUG] Dữ liệu trả về: ' . print_r($data, true); } } else { $results['Mixdrop'] = '[DEBUG] Lỗi kết nối hoặc lỗi WP: ' . print_r($response, true); } } // Doodstream remote upload if (!empty($mhru_config['dood_key'])) { $api_url = 'https://doodapi.com/api/upload/url?key=' . urlencode($mhru_config['dood_key']) . '&url=' . urlencode($mp4_url); $response = wp_remote_get($api_url, ['timeout' => 30]); if (is_array($response) && !is_wp_error($response)) { $data = json_decode($response['body'], true); if (!$data || empty($data['result'])) { $results['Doodstream'] = '[DEBUG] Không có dữ liệu trả về: ' . $response['body']; } elseif (isset($data['result']['filecode'])) { $results['Doodstream'] = 'https://dood.la/e/' . $data['result']['filecode']; } elseif (isset($data['msg'])) { $results['Doodstream'] = 'Lỗi: ' . esc_html($data['msg']); } else { $results['Doodstream'] = '[DEBUG] Dữ liệu trả về: ' . print_r($data, true); } } else { $results['Doodstream'] = '[DEBUG] Lỗi kết nối hoặc lỗi WP: ' . print_r($response, true); } } // Hydrax remote upload (Google Drive hoặc link mp4) - chỉ trả về slug! if (!empty($mhru_config['hydrax_key'])) { if ($google_drive_id) { $api_url = 'https://api.hydrax.net/' . $mhru_config['hydrax_key'] . '/drive/' . $google_drive_id; $response = wp_remote_post($api_url, ['timeout' => 30]); } else { $api_url = 'https://up.hydrax.net/' . $mhru_config['hydrax_key'] . '/remote'; $response = wp_remote_post($api_url, [ 'body' => ['url' => $mp4_url], 'timeout' => 30, ]); } if (is_array($response) && !is_wp_error($response)) { $data = json_decode($response['body'], true); if (!$data) { $results['Hydrax'] = '[DEBUG] Không có dữ liệu trả về: ' . $response['body']; } elseif (isset($data['status']) && $data['status'] && isset($data['slug'])) { $results['Hydrax'] = $data['slug']; // Chỉ trả về slug! } elseif (isset($data['msg'])) { $results['Hydrax'] = 'Lỗi: ' . esc_html($data['msg']); } else { $results['Hydrax'] = '[DEBUG] Dữ liệu trả về: ' . print_r($data, true); } } else { $results['Hydrax'] = '[DEBUG] Lỗi kết nối hoặc lỗi WP: ' . print_r($response, true); } } // Voe remote upload if (!empty($mhru_config['voe_key'])) { $api_url = 'https://voe.sx/api/upload/url'; $response = wp_remote_post($api_url, [ 'body' => [ 'key' => $mhru_config['voe_key'], 'url' => $mp4_url ], 'timeout' => 30, ]); if (is_array($response) && !is_wp_error($response)) { $data = json_decode($response['body'], true); if (!$data || empty($data['result'])) { $results['Voe'] = '[DEBUG] Không có dữ liệu trả về: ' . $response['body']; } elseif (isset($data['result']['id'])) { $results['Voe'] = 'https://voe.sx/e/' . $data['result']['id']; } elseif (isset($data['msg'])) { $results['Voe'] = 'Lỗi: ' . esc_html($data['msg']); } else { $results['Voe'] = '[DEBUG] Dữ liệu trả về: ' . print_r($data, true); } } else { $results['Voe'] = '[DEBUG] Lỗi kết nối hoặc lỗi WP: ' . print_r($response, true); } } return $results; } ...