<!DOCTYPE html> <html> <head> <title>Video Downloader</title> <link…
- User
download.php:
style.css:
.video-container { position:relative; padding-bottom:56.25%; height:0; overflow:hidden; margin-bottom: 30px; }
.video-container iframe { position:absolute; top:0; left:0;
- Assistant
width:100%; height:100%; }
.navbar-brand { font-size: 2rem; font-weight: 700; }
.btn-danger { background-color: #dc3545; border-color: #dc3545; }
.btn-danger:hover { background-color: #c82333; border-color: #bd2130; }
.container { max-width: 800px; }
.form-group label { font-size: 1.2rem; font-weight: 500; }
.form-control { padding: 14px; font-size: 1rem; }
h1 { font-size: 2.5rem; font-weight: 500; margin-bottom: 30px; }
@media (max-width: 767px) { .navbar-brand { font-size: 1.5rem; }
h1 { font-size: 2rem; }
.btn-danger { font-size: 0.9rem; padding: 10px 20px; }
.form-control { font-size: 0.9rem; padding: 10px; }
.container { padding: 0 15px; } }
- User
download.php:
style.css:
.video-container { position:relative; padding-bottom:56.25%; height:0; overflow:hidden; margin-bottom: 30px; }
.video-container iframe { position:absolute; top:0; left:0; width:100%; height:100%; }
.navbar-brand { font-size: 2rem; font-weight: 700; }
.btn-danger { background-color: #dc3545; border-color: #dc3545; }
.btn-danger:hover { background-color: #c82333; border-color: #bd2130; }
.container { max-width: 800px; }
.form-group label { font-size: 1.2rem; font-weight: 500; }
.form-control { padding: 14px; font-size: 1rem; }
h1 { font-size: 2.5rem; font-weight: 500; margin-bottom: 30px; }
@media (max-width: 767px) { .navbar-brand { font-size: 1.5rem; }
h1 { font-size: 2rem; }
.btn-danger { font-size: 0.9rem; padding: 10px 20px; }
.form-control { font-size: 0.9rem; padding: 10px; }
.container { padding: 0 15px; } }
- Assistant
There are a few issues with the code:
-
The quotes being used in the HTML and PHP code are "smart quotes" (curly quotes), which should be regular quotes. For example, in the HTML code, change
“and”to". In the PHP code, change‘and’to'. -
In the
download.phpcode, there are some errors with the variable names. Change_POSTto$_POSTand add the$sign before the variable names. Also, changeechoembed_linkto$embed_link. -
It's a good idea to sanitize and validate user input before using it in your code. Consider using filters or functions like
filter_var()orpreg_match()to ensure that the user input is in the correct format.
Here's the corrected code:
index.html:
<!DOCTYPE html> <html> <head> <title>Video Downloader</title> <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700" rel="stylesheet"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-LecjJY2zWGUh1gLP18jyfG2qYrQKJ1V361k18F+Xdnm/uJjm8VqSMGSq0fq6D1nE" crossorigin="anonymous"> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <nav class="navbar navbar-dark bg-dark"> <div class="container-fluid"> <a class="navbar-brand" href="#">Video Downloader</a> </div> </nav> <div class="container my-5"> <form action="download.php" method="POST"> <div class="form-group"> <label for="video_url">Enter a video URL</label> <input type="text" class="form-control" id="video_url" name="video_url" placeholder="Video URL"> </div> <button type="submit" class="btn btn-danger">Download</button> </form> </div> </body> </html>download.php:
<?php $video_url = $_POST['video_url']; parse_str(parse_url($video_url, PHP_URL_QUERY), $video_params); $video_id = $video_params['v']; $video_title = $video_params['title']; $embed_link = "https://www.youtube.com/embed/".$video_id; //Download video code - please add your own code for downloading the video based on the video_id here ?> <!DOCTYPE html> <html> <head> <title>Video Downloader - Video Player</title> <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700" rel="stylesheet"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-LecjJY2zWGUh1gLP18jyfG2qYrQKJ1V361k18F+Xdnm/uJjm8VqSMGSq0fq6D1nE" crossorigin="anonymous"> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <nav class="navbar navbar-dark bg-dark"> <div class="container-fluid"> <a class="navbar-brand" href="index.php">Video Downloader</a> </div> </nav> <div class="container my-5"> <h1><?php echo $video_title; ?></h1> <div class="video-container my-5"><iframe src="<?php echo $embed_link; ?>" frameborder="0" allowfullscreen></iframe></div> </div> </body> </html>style.css:
.video-container { position:relative; padding-bottom:56.25%; height:0; overflow:hidden; margin-bottom: 30px; } .video-container iframe { position:absolute; top:0; left:0; width:100%; height:100%; } .navbar-brand { font-size: 2rem; font-weight: 700; } .btn-danger { background-color: #dc3545; border-color: #dc3545; } .btn-danger:hover { background-color: #c82333; border-color: #bd2130; } .container { max-width: 800px; } .form-group label { font-size: 1.2rem; font-weight: 500; } .form-control { padding: 14px; font-size: 1rem; } h1 { font-size: 2.5rem; font-weight: 500; margin-bottom: 30px; } @media (max-width: 767px) { .navbar-brand { font-size: 1.5rem; } h1 { font-size: 2rem; } .btn-danger { font-size: 0.9rem; padding: 10px 20px; } .form-control { font-size: 0.9rem; padding: 10px; } .container { padding: 0 15px; } } -
- User
download.php:
style.css:
.video-container { position:relative; padding-bottom:56.25%; height:0; overflow:hidden; margin-bottom: 30px; }
.video-container iframe { position:absolute; top:0; left:0; width:100%; height:100%; }
.navbar-brand { font-size: 2rem; font-weight: 700; }
.btn-danger { background-color: #dc3545; border-color: #dc3545; }
.btn-danger:hover { background-color: #c82333; border-color: #bd2130; }
.container { max-width: 800px; }
.form-group label { font-size: 1.2rem; font-weight: 500; }
.form-control { padding: 14px; font-size: 1rem; }
h1 { font-size: 2.5rem; font-weight: 500; margin-bottom: 30px; }
@media (max-width: 767px) { .navbar-brand { font-size: 1.5rem; }
h1 { font-size: 2rem; }
.btn-danger { font-size: 0.9rem; padding: 10px 20px; }
.form-control { font-size: 0.9rem; padding: 10px; }
.container { padding: 0 15px; } }
- Assistant
There are a few issues with the code:
- The quotes being used in the HTML and PHP code are "smart quotes" (curly quotes), which should be regular quotes. For example, in the HTML code, change `“