Пробуем по другому

This commit is contained in:
p.belezov 2024-06-18 14:55:50 +08:00
parent 7bc0336b7a
commit 766f7d4f9d
3 changed files with 13 additions and 9 deletions

View File

@ -28,12 +28,15 @@ class YoutubeDownloadController extends Controller
return response(json_encode($response));
} else {
$videotitle = $video->getFile()->getFilename(); // Will return Phonebloks
$videotitle = str_replace('webp', 'mp4', $videotitle);
//$file_path = public_path('/'.'downloads/'.$videotitle);
//return response()->download($file_path);
$videotitle = str_replace('webp', 'mp4', $videotitle);
//$file_path = public_path('/'.'downloads/'.$videotitle);
//return response()->download($file_path);
// $video->getFile(); // \SplFileInfo instance of downloaded file
//$file_path = public_path('/downloads/'.$videotitle);
return redirect()->route('download', [$videotitle]);
$response = new \stdClass();
$response->link = $videotitle;
return response(json_encode($response));
//return redirect()->route('download', [$videotitle]);
//return response()->download($file_path);
}
}

View File

@ -3,9 +3,10 @@
<v-card-text class="d-flex justify-center align-center">
<v-card class="align-center justify-center h-auto w-33">
<v-card-title>Вставьте ссылку:</v-card-title>
<v-card-text>
<v-card-text class="justify-center">
<v-text-field v-model="url" label="Ссылка"/>
<v-btn @click="startDownload">Скачать</v-btn>
<v-btn @click="startDownload">Найти</v-btn>
<v-btn>Скачать</v-btn>
</v-card-text>
</v-card>
</v-card-text>
@ -26,8 +27,8 @@ export default {
startDownload(){
this.fetching = true;
axios.get(`/download_api?videourl=${this.url}`).then((responce)=>{
this.fetching = false;
console.log(responce);
this.fetching = false;
console.log(responce);
})
}
}

View File

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Boilerplate</title>
<title>Youtube Download</title>
@vite('resources/app.js')
@vite('resources/css/app.css')
</head>