/**
* Zero-Quota Multi-Layer Live YouTube Search (Bypasses Cookie Walls & IP Blocks)
*/
public static function scrapeYoutubeLiveSearch($query, $maxResults = 20) {
$query = trim((string)$query);
if ($query === '') {
$query = 'top hits 2026';
}
$cacheFile = APPPATH . 'cache/yt_live_' . md5(strtolower($query) . '_' . $maxResults) . '.json';
if (file_exists($cacheFile) && (time() - @filemtime($cacheFile) < 21600)) {
$cached = json_decode((string)@file_get_contents($cacheFile), true);
if (is_array($cached) && count($cached) >= 3) {
return $cached;
}
}
$results = [];
$searchUrl = "https://www.youtube.com/results?search_query=" . urlencode($query) . "&hl=en&gl=US";
$ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36";
// Fetch HTML with CONSENT cookie to bypass YouTube's EU/Datacenter cookie wall
$html = '';
if (function_exists('curl_init')) {
$ch = curl_init($searchUrl);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_TIMEOUT => 8,
CURLOPT_USERAGENT => $ua,
CURLOPT_HTTPHEADER => [
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Accept-Language: en-US,en;q=0.9",
"Cookie: CONSENT=YES+cb.20230531-07-p0.en+FX+999; PREF=hl=en&gl=US"
]
]);
$html = (string)curl_exec($ch);
curl_close($ch);
} else {
$html = (string)http_get_contents_safe($searchUrl, 8);
}
// Layer 1A: Parse ytInitialData JSON (supports both var ytInitialData and window["ytInitialData"])
if ($html !== '' && preg_match('/(?:var\s+ytInitialData|window\["ytInitialData"\])\s*=\s*(\{.+?\});\s*(?:<\/script>|if\s*\()/s', $html, $m)) {
$data = json_decode($m[1], true);
$sections = $data['contents']['twoColumnSearchResultsRenderer']['primaryContents']['sectionListRenderer']['contents'] ?? [];
foreach ($sections as $sec) {
$items = $sec['itemSectionRenderer']['contents'] ?? [];
foreach ($items as $node) {
if (empty($node['videoRenderer'])) continue;
$v = $node['videoRenderer'];
$vid = $v['videoId'] ?? '';
if ($vid === '' || strlen($vid) !== 11) continue;
$title = $v['title']['runs'][0]['text'] ?? ($v['title']['accessibility']['accessibilityData']['label'] ?? 'Audio Track');
$uploader = $v['ownerText']['runs'][0]['text'] ?? ($v['longBylineText']['runs'][0]['text'] ?? 'Official Artist');
$duration = $v['lengthText']['simpleText'] ?? '3:45';
$results[] = [
'id' => $vid,
'judul' => html_entity_decode($title, ENT_QUOTES, 'UTF-8'),
'description' => html_entity_decode($title, ENT_QUOTES, 'UTF-8'),
'thumbnails' => "https://i.ytimg.com/vi/{$vid}/hqdefault.jpg",
'uploader' => html_entity_decode($uploader, ENT_QUOTES, 'UTF-8'),
'duration' => $duration,
'views' => getSongViewCount($vid, rand(2500, 85000))
];
if (count($results) >= $maxResults) break 2;
}
}
}
// Layer 1B: Direct Regex Fallback on raw HTML if YouTube altered the JSON wrapper
if (empty($results) && $html !== '') {
if (preg_match_all('/"videoRenderer":\{"videoId":"([a-zA-Z0-9_-]{11})".*?"title":\{"runs":\[\{"text":"([^"]+)"\}/s', $html, $matches, PREG_SET_ORDER)) {
$seen = [];
foreach ($matches as $match) {
$vid = $match[1];
if (isset($seen[$vid])) continue;
$seen[$vid] = true;
$cleanTitle = json_decode('"' . $match[2] . '"') ?: stripslashes($match[2]);
$results[] = [
'id' => $vid,
'judul' => html_entity_decode($cleanTitle, ENT_QUOTES, 'UTF-8'),
'description' => html_entity_decode($cleanTitle, ENT_QUOTES, 'UTF-8'),
'thumbnails' => "https://i.ytimg.com/vi/{$vid}/hqdefault.jpg",
'uploader' => ucwords($query),
'duration' => '3:45',
'views' => getSongViewCount($vid, rand(2500, 85000))
];
if (count($results) >= $maxResults) break;
}
}
}
// Layer 2: Public Piped YouTube API Mirror Fallback (if server IP is blocked by youtube.com)
if (empty($results)) {
$pipedApis = [
"https://pipedapi.kavin.rocks/search?q=" . urlencode($query) . "&filter=music_songs",
"https://pipedapi.tokhmi.xyz/search?q=" . urlencode($query) . "&filter=videos"
];
foreach ($pipedApis as $pUrl) {
$pRaw = http_get_contents_safe($pUrl, 6);
if (!$pRaw) continue;
$pJson = json_decode((string)$pRaw, true);
$pItems = $pJson['items'] ?? [];
foreach ($pItems as $pItem) {
if (preg_match('/v=([a-zA-Z0-9_-]{11})/', (string)($pItem['url'] ?? ''), $pm)) {
$vid = $pm[1];
$sec = (int)($pItem['duration'] ?? 225);
$durStr = ($sec > 0) ? sprintf('%d:%02d', floor($sec / 60), $sec % 60) : '3:45';
$results[] = [
'id' => $vid,
'judul' => $pItem['title'] ?? 'Audio Track',
'description' => $pItem['title'] ?? '',
'thumbnails' => "https://i.ytimg.com/vi/{$vid}/hqdefault.jpg",
'uploader' => $pItem['uploaderName'] ?? ucwords($query),
'duration' => $durStr,
'views' => getSongViewCount($vid, (int)($pItem['views'] ?? 12000))
];
if (count($results) >= $maxResults) break 2;
}
}
}
}
if (!empty($results)) {
@file_put_contents($cacheFile, json_encode($results), LOCK_EX);
}
return $results;
}
Download Nf James Arthur Sorry Audio MP3 & MP4 | MP3juices
Home »
Music Details »
Download
Preview: Nf James Arthur Sorry Audio
0:00
0:00
Audio: High Quality MP3, M4A, FLAC, WAV
Video: MP4 720p HD Available
Security: SSL Encrypted & Verified
10
Generating secure download links...
MP3 (320kbps - Standard)
M4A (High Quality)
FLAC (Lossless Audio)
AAC (Advanced Audio)
OPUS (Low Latency)
OGG (Vorbis)
WAV (Uncompressed Audio)
Download Audio
Download Video (MP4)
About Nf James Arthur Sorry Audio Download
Experience the best way to get Nf James Arthur Sorry Audio on your device.
MP3juices provides a fast, safe, and free conversion service for all your favorite music and videos.
Whether you need 320kbps audio for high-fidelity listening or HD MP4 video for offline viewing, our platform
delivers the highest quality available. No registration is required—simply wait for the link and enjoy.
Install MP3juices Browser App
Fast 1-tap access & saved music library on your home screen!
Install App
Home
Trending
Afrobeats
Amapiano