So I modified a youtube video downloader for a project and the video that is embedded just shows an error. It says “An error occurred. Please try again later. (Playback ID: M-CB0N1oRgwx3evX) Learn More” I have looked at some questions but I can’t get it to work.
My link: “https://youtube.com/embed/LINKHERE”
Here’s the code:
<!DOCTYPE html>
<html>
<head>
<title>Yt watcher</title>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.0.0-alpha1/css/bootstrap.min.css">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.0.0-alpha1/js/bootstrap.min.js"></script>
</head>
<body class="bg-dark">
<div class="col-md-6 offset-md-3 mt-5">
<div class="card">
<div class="card-header bg-info">
<h5>Yt watcher</h5>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label class="text-weight"><b>Online Videos Link:</b></label>
<input type="txt" name="link" class="form-control link" required>
</div>
</div>
</div>
<form class="form-download">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<div class="row">
<div class="col-md-12">
<div class="form-group mt-4 download-video">
<button class="btn btn-success btn-block click-btn-down" type="submit">Search</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</body>
<script type="text/javascript">
$(".click-btn-down").click(function(){
var link = $(".link").val();
var fromate = $(".formte").children("option:selected").val();
var src =""+link+"="+fromate+"";
downloadVideo(link,fromate);
});
function downloadVideo(link,fromate) {
$('.download-video').html('<iframe style="width:100%;height:300px;border:0;overflow:hidden;" scrolling="no" src="https://youtube.com/embed/'+link+'"></iframe>');
}
</script>
</html>