Все еще не работат

This commit is contained in:
Dhaverd 2024-06-18 06:21:52 +03:00
parent b4ea9a0665
commit 04dbef81f6
3 changed files with 9 additions and 4 deletions

View File

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

View File

@ -20,12 +20,14 @@ export default {
name: "Main", name: "Main",
data: () => ({ data: () => ({
url: ref(''), url: ref(''),
fetching: ref(false)
}), }),
methods: { methods: {
startDownload(){ startDownload(){
console.log(this.url); this.fetching = true;
axios.get(`/download_api?videourl=${this.url}`).then((responce)=>{ axios.get(`/download_api?videourl=${this.url}`).then((responce)=>{
console.log(responce); this.fetching = false;
console.log(responce);
}) })
} }
} }

View File

@ -18,4 +18,4 @@ Route::get('/', function () {
}); });
Route::get('/download_api', 'App\Http\Controllers\YoutubeDownloadController@index'); Route::get('/download_api', 'App\Http\Controllers\YoutubeDownloadController@index');
Route::get('/download/{file}', 'App\Http\Controllers\DownloadController@download'); Route::get('/download/{file}', 'App\Http\Controllers\DownloadController@download')->name('download');