Armandolqr
Gamma
Verificado por Whatsapp
¡Usuario con pocos negocios! ¡Utiliza siempre saldo de Forobeta!
Serial algo asi...https://api.filelions.com/api/file/direct_link?key=895bvq8x2cvnmt2bih6&file_code=5lnhh4j4noaf
este link da esta respuesta
{"server_time":"2023-06-10 18:01:55","msg":"OK","result":{"file_length":5367,"player_img":"https://lions-img.xyz/5lnhh4j4noaf.jpg","file_name":"Anaconda","versions":[{"size":2539674937,"url":" ","name":"o"}]},"status":200}
lo que quiero es usar la seccion url que trae. que cargue directamente ese link y que no traiga lo demas algo como un fetch
lo que quiero que traiga directamente esta marcado en negrita
<?php
$url = 'https://api.filelions.com/api/file/direct_link?key=895bvq8x2cvnmt2bih6&file_code=5lnhh4j4noaf';
$get = file_get_contents($url);
$json = json_decode($get, true);
echo $json['result']['versions'][0]['url'];
?>
Si, de nada bro.pusiste el 0 y trajo ya
<?php
function curl_url($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_REFERER, 'https://google.com');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36');
$resp = curl_exec($ch);
curl_close($ch);
return $resp;
}
$url = 'https://api.filelions.com/api/file/direct_link?key=895bvq8x2cvnmt2bih6&file_code=5lnhh4j4noaf';
$get = curl_url($url);
$json = json_decode($get, true);
echo $json['result']['versions'][0]['url'];
?>
solo faltaria redirigir
<?php
function curl_url($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_REFERER, 'https://google.com');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36');
$resp = curl_exec($ch);
curl_close($ch);
return $resp;
}
$url = 'https://api.filelions.com/api/file/direct_link?key=895bvq8x2cvnmt2bih6&file_code=5lnhh4j4noaf';
$get = curl_url($url);
$json = json_decode($get, true);
if(!empty($json['result']['versions'][0]['url'])){
$video_url = $json['result']['versions'][0]['url'];
header('Location: '.$video_url);
}
?>
Name | Description | Example | Format | Required |
---|---|---|---|---|
key | API key | 450fhvveofkpzts8b | STRING | |
file_code | File code | fb5asfuj2snh | STRING | |
q | Video quality if available. Possible values: n , h , l, o | n | STRING | |
hls | Generate HLS manifest URL (HLS mod required) | 1 | INT |
{"msg":"OK","result":"https://026ljzhkje3707.lions-vidcdn...U&s=1686946264&e=129600&f=243938&sp=800&i=0.0","status":200,"server_time":"2023-06-16 20:11:04"} trae asi la api pero no funciona en el get ya que no dice url ahora dice result
es h la que pase recienLee bien la documentación
FileLions
FileLions - StreamSB offers you free unlimited storage space for all your media. We want to simplify the handling of your data for you.filelions.com
Según la API es el mismo formato. Y como veo en la respuesta, retorna todas las calidades disponibles, y en el link que pasaste solo retorna la calidad 'n', ya que las otras no figuran si lo revisas de manera independiente.
if(!empty($json['result']['versions'][0]['url'])){
$video_url = $json['result']['versions'][0]['url'];
header('Location: '.$video_url);
aqui habria que modificar creo
if (!empty($json['result']['versions'])) {
$all_video_url = $json['result']['versions'];
# Asumiendo que el ultimo elemento es el que tiene mayor calidad
$video_url = end($all_video_url);
header('Location: ' . $video_url['url']);
}
Utilizamos cookies y tecnologías similares para los siguientes fines:
¿Aceptas las cookies y estas tecnologías?
Utilizamos cookies y tecnologías similares para los siguientes fines:
¿Aceptas las cookies y estas tecnologías?