Skip to content

Commit 5a4ae38

Browse files
committed
Update
1 parent 188afd8 commit 5a4ae38

20 files changed

+1665
-883
lines changed

app/Http/Controllers/ConverterController.php

Lines changed: 0 additions & 88 deletions
This file was deleted.
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
<?php
2+
3+
namespace App\Http\Controllers;
4+
5+
use Illuminate\Http\Request;
6+
use Illuminate\View\View;
7+
use Illuminate\Http\JsonResponse;
8+
9+
class DownloaderController extends Controller
10+
{
11+
public function fourKVideo(): View
12+
{
13+
$pageData = [
14+
'title' => '4K Video Downloader',
15+
'subtitle' => 'Download videos in ultra-high 4K resolution',
16+
'description' => 'Get stunning 4K quality videos from your favorite platforms with our advanced downloading technology.',
17+
'supportedQualities' => ['4K (2160p)', '2K (1440p)', '1080p (Full HD)', '720p (HD)', '480p (SD)']
18+
];
19+
20+
return view('downloaders.4k-video', compact('pageData'));
21+
}
22+
23+
public function videoToMp3(): View
24+
{
25+
$pageData = [
26+
'title' => 'Video to MP3 Downloader',
27+
'subtitle' => 'Extract audio and download as MP3',
28+
'description' => 'Convert and download video audio as high-quality MP3 files from any supported platform.',
29+
'supportedFormats' => ['MP3', 'WAV', 'M4A', 'AAC', 'OGG']
30+
];
31+
32+
return view('downloaders.video-mp3', compact('pageData'));
33+
}
34+
35+
public function playlistDownloader(): View
36+
{
37+
$pageData = [
38+
'title' => 'Playlist Downloader',
39+
'subtitle' => 'Download entire playlists with one click',
40+
'description' => 'Save time by downloading complete playlists, channels, or collections in batch.',
41+
'features' => ['Batch downloading', 'Queue management', 'Progress tracking', 'Format selection per video']
42+
];
43+
44+
return view('downloaders.playlist', compact('pageData'));
45+
}
46+
47+
public function videoToWav(): View
48+
{
49+
$pageData = [
50+
'title' => 'Video to WAV Downloader',
51+
'subtitle' => 'Download video audio as high-quality WAV files',
52+
'description' => 'Extract and download video audio in uncompressed WAV format for the best quality.',
53+
'benefits' => ['Lossless audio quality', 'Professional standard', 'Universal compatibility']
54+
];
55+
56+
return view('downloaders.video-wav', compact('pageData'));
57+
}
58+
59+
public function video1080p(): View
60+
{
61+
$pageData = [
62+
'title' => '1080p Video Downloader',
63+
'subtitle' => 'Download videos in Full HD 1080p resolution',
64+
'description' => 'Get crisp Full HD quality videos perfect for any device or screen.',
65+
'features' => ['Full HD quality', 'Fast downloading', 'Multiple format support']
66+
];
67+
68+
return view('downloaders.1080p', compact('pageData'));
69+
}
70+
71+
public function getVideoInfo(Request $request): JsonResponse
72+
{
73+
$request->validate([
74+
'url' => 'required|url'
75+
]);
76+
77+
// Simulate video info extraction
78+
$videoInfo = [
79+
'title' => 'Sample Video Title',
80+
'duration' => '3:45',
81+
'thumbnail' => 'https://via.placeholder.com/480x360',
82+
'available_qualities' => ['4K', '1080p', '720p', '480p'],
83+
'available_formats' => ['MP4', 'WEBM', 'MP3', 'WAV']
84+
];
85+
86+
return response()->json([
87+
'success' => true,
88+
'video_info' => $videoInfo
89+
]);
90+
}
91+
92+
public function download(Request $request): JsonResponse
93+
{
94+
$request->validate([
95+
'url' => 'required|url',
96+
'quality' => 'required|string|in:4k,1080p,720p,480p',
97+
'format' => 'required|string|in:mp4,webm,mp3,wav'
98+
]);
99+
100+
// Simulate download process
101+
return response()->json([
102+
'success' => true,
103+
'message' => 'Download started successfully',
104+
'download_id' => uniqid(),
105+
'estimated_time' => rand(10, 120) // seconds
106+
]);
107+
}
108+
}

app/Http/Controllers/HomeController.php

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,54 +10,54 @@ class HomeController extends Controller
1010
public function index(): View
1111
{
1212
$heroData = [
13-
'title' => 'Media File Converter',
14-
'subtitle' => 'Convert your media files to any format quickly and easily',
15-
'description' => 'Fast, secure, and reliable media conversion tool supporting multiple formats.'
13+
'title' => 'Video Downloader',
14+
'subtitle' => 'Download videos from popular social platforms',
15+
'description' => 'Fast, secure, and reliable video downloading tool supporting multiple formats and qualities.'
1616
];
1717

1818
$features = [
1919
[
2020
'icon' => 'video',
21-
'title' => 'Video Conversion',
22-
'description' => 'Convert videos to various formats including MP4, AVI, MOV, and more.'
21+
'title' => 'HD Video Download',
22+
'description' => 'Download videos in various qualities including 4K, 1080p, 720p, and more.'
2323
],
2424
[
2525
'icon' => 'audio',
26-
'title' => 'Audio Conversion',
27-
'description' => 'Transform audio files to MP3, WAV, FLAC, and other popular formats.'
26+
'title' => 'Audio Extraction',
27+
'description' => 'Extract audio from videos and save as MP3, WAV, or other audio formats.'
2828
],
2929
[
30-
'icon' => 'batch',
31-
'title' => 'Batch Processing',
32-
'description' => 'Process multiple files at once to save time and effort.'
30+
'icon' => 'playlist',
31+
'title' => 'Playlist Support',
32+
'description' => 'Download entire playlists with a single click to save time and effort.'
3333
],
3434
[
35-
'icon' => 'quality',
36-
'title' => 'High Quality',
37-
'description' => 'Maintain excellent quality during conversion with advanced algorithms.'
35+
'icon' => 'fast',
36+
'title' => 'Fast Processing',
37+
'description' => 'Quick downloads with high-speed servers and optimized processing.'
3838
]
3939
];
4040

4141
$partners = [
42-
'TechCorp', 'MediaPro', 'DigitalWave', 'StreamTech', 'ConvertMax'
42+
'VideoTech', 'MediaStream', 'DownloadPro', 'StreamSaver', 'QuickVid'
4343
];
4444

4545
$faqs = [
4646
[
47-
'question' => 'What file formats are supported?',
48-
'answer' => 'We support all major video and audio formats including MP4, AVI, MOV, MP3, WAV, FLAC, and many more.'
47+
'question' => 'What video platforms are supported?',
48+
'answer' => 'We support downloads from all major video sharing platforms and social media sites.'
4949
],
5050
[
51-
'question' => 'Is the conversion process secure?',
52-
'answer' => 'Yes, all files are processed securely and deleted from our servers after conversion.'
51+
'question' => 'Is the downloading process secure?',
52+
'answer' => 'Yes, all downloads are processed securely and we don\'t store any personal information.'
5353
],
5454
[
55-
'question' => 'How long does conversion take?',
56-
'answer' => 'Conversion time depends on file size and format, but most conversions complete within minutes.'
55+
'question' => 'How long does downloading take?',
56+
'answer' => 'Download time depends on video length and quality, but most downloads complete within minutes.'
5757
],
5858
[
59-
'question' => 'Is there a file size limit?',
60-
'answer' => 'Free users can convert files up to 100MB. Premium users have higher limits.'
59+
'question' => 'Are there any limits on video length?',
60+
'answer' => 'Free users can download videos up to 2 hours. Premium users have no limits.'
6161
]
6262
];
6363

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace App\Http\Middleware;
4+
5+
use Closure;
6+
use Illuminate\Http\Request;
7+
use Illuminate\Cache\RateLimiter;
8+
use Symfony\Component\HttpFoundation\Response;
9+
10+
class RateLimitDownloads
11+
{
12+
protected $limiter;
13+
14+
public function __construct(RateLimiter $limiter)
15+
{
16+
$this->limiter = $limiter;
17+
}
18+
19+
public function handle(Request $request, Closure $next, $maxAttempts = 10, $decayMinutes = 60): Response
20+
{
21+
$key = $request->ip();
22+
23+
if ($this->limiter->tooManyAttempts($key, $maxAttempts)) {
24+
return response()->json([
25+
'error' => 'Too many download requests. Please try again later.',
26+
'retry_after' => $this->limiter->availableIn($key)
27+
], 429);
28+
}
29+
30+
$this->limiter->hit($key, $decayMinutes * 60);
31+
32+
return $next($request);
33+
}
34+
}

app/Models/Download.php

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<?php
2+
3+
namespace App\Models;
4+
5+
use Illuminate\Database\Eloquent\Model;
6+
use Illuminate\Database\Eloquent\Factories\HasFactory;
7+
use Illuminate\Database\Eloquent\Casts\Attribute;
8+
9+
class Download extends Model
10+
{
11+
use HasFactory;
12+
13+
protected $fillable = [
14+
'download_id',
15+
'video_url',
16+
'video_title',
17+
'video_duration',
18+
'quality',
19+
'format',
20+
'file_size',
21+
'status',
22+
'download_path',
23+
'error_message',
24+
'metadata',
25+
'started_at',
26+
'completed_at',
27+
'ip_address',
28+
];
29+
30+
protected $casts = [
31+
'metadata' => 'array',
32+
'started_at' => 'datetime',
33+
'completed_at' => 'datetime',
34+
];
35+
36+
public function isCompleted(): bool
37+
{
38+
return $this->status === 'completed';
39+
}
40+
41+
public function isFailed(): bool
42+
{
43+
return $this->status === 'failed';
44+
}
45+
46+
public function isProcessing(): bool
47+
{
48+
return $this->status === 'processing';
49+
}
50+
51+
protected function fileSize(): Attribute
52+
{
53+
return Attribute::make(
54+
get: fn ($value) => $value ? $this->formatBytes($value) : null,
55+
);
56+
}
57+
58+
private function formatBytes($bytes, $precision = 2)
59+
{
60+
$units = array('B', 'KB', 'MB', 'GB', 'TB');
61+
62+
for ($i = 0; $bytes > 1024; $i++) {
63+
$bytes /= 1024;
64+
}
65+
66+
return round($bytes, $precision) . ' ' . $units[$i];
67+
}
68+
}

0 commit comments

Comments
 (0)