youtube downloader
This commit is contained in:
43
JavaScript/calculator/index.html
Normal file
43
JavaScript/calculator/index.html
Normal file
@@ -0,0 +1,43 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="style.css" />
|
||||
<title>Calculator</title>
|
||||
</head>
|
||||
<body>
|
||||
<script src="index.js"></script>
|
||||
<div class="calc-container">
|
||||
<textarea class="calc-display" id="calc-display" cols="30" rows="10" readonly></textarea>
|
||||
<div></div><div></div><div></div>
|
||||
|
||||
<div class="calc-item" id="clear" onclick="ac();">AC</div>
|
||||
<div class="calc-item" id="delete">C</div>
|
||||
|
||||
<div class="calc-item"></div>
|
||||
<div class="calc-item"></div>
|
||||
|
||||
<div class="calc-item" id="button7">7</div>
|
||||
<div class="calc-item" id="button8">8</div>
|
||||
<div class="calc-item" id="button9">9</div>
|
||||
<div class="calc-item" id="divide">÷</div>
|
||||
|
||||
<div class="calc-item" id="button4">4</div>
|
||||
<div class="calc-item" id="button5">5</div>
|
||||
<div class="calc-item" id="button6">6</div>
|
||||
<div class="calc-item" id="multiply">x</div>
|
||||
|
||||
<div class="calc-item" id="button1">1</div>
|
||||
<div class="calc-item" id="button2">2</div>
|
||||
<div class="calc-item" id="button3">3</div>
|
||||
<div class="calc-item" id="subtract">-</div>
|
||||
|
||||
<div class="calc-item" id="button0">0</div>
|
||||
<div class="calc-item" id="point">.</div>
|
||||
<div class="calc-item" id="evaluate">=</div>
|
||||
<div class="calc-item" id="add">+</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
3
JavaScript/calculator/index.js
Normal file
3
JavaScript/calculator/index.js
Normal file
@@ -0,0 +1,3 @@
|
||||
function ac() {
|
||||
console.log('ac');
|
||||
}
|
||||
38
JavaScript/calculator/style.css
Normal file
38
JavaScript/calculator/style.css
Normal file
@@ -0,0 +1,38 @@
|
||||
@import url('https://fonts.googleapis.com/css?family=Roboto:400,100');
|
||||
|
||||
body {
|
||||
-webkit-background-size: cover;
|
||||
-moz-background-size: cover;
|
||||
-o-background-size: cover;
|
||||
background-size: cover;
|
||||
background: rgb(245, 245, 245);
|
||||
font-family: 'Roboto', sans-serif;
|
||||
color: #2f2f2f
|
||||
}
|
||||
|
||||
.calc-container {
|
||||
display: grid;
|
||||
grid-template-columns: 100px 100px 100px 100px;
|
||||
width: 400px;
|
||||
background-color: rgb(122, 184, 255);
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.calc-display {
|
||||
width: 395px;
|
||||
height: 70px;
|
||||
padding-bottom: 20px;
|
||||
resize: none;
|
||||
}
|
||||
|
||||
.calc-item {
|
||||
background-color: rgb(228, 228, 228);
|
||||
border: 1px solid #2f2f2f;
|
||||
padding: 20px;
|
||||
font-size: 30px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.calc-item:hover {
|
||||
background-color: rgb(195, 195, 195);
|
||||
}
|
||||
40
JavaScript/youtube-dowloader/index.js
Normal file
40
JavaScript/youtube-dowloader/index.js
Normal file
@@ -0,0 +1,40 @@
|
||||
const fs = require('fs');
|
||||
const ytdl = require('ytdl-core');
|
||||
|
||||
let videos = [];
|
||||
|
||||
if (!fs.existsSync('./videos.txt')) {
|
||||
console.log('Could not find videos.txt, make sure it exists and has youtube links, each on new lines');
|
||||
process.exit();
|
||||
}
|
||||
|
||||
let text = fs.readFileSync('./videos.txt').toString();
|
||||
text.split('\n').forEach((line) => {
|
||||
videos.push(line.replace(/\r/, ''));
|
||||
});
|
||||
|
||||
videos.forEach((url) => {
|
||||
if (ytdl.validateURL(url)) {
|
||||
ytdl.getInfo(url, (err, info) => {
|
||||
if (err) {
|
||||
console.log(`An error occured while downloading '${url}'`)
|
||||
} else {
|
||||
let title = info.title;
|
||||
|
||||
try {
|
||||
let stream = ytdl(url, {quality: 'highest'}).pipe(fs.createWriteStream(`${title}.mp4`));
|
||||
stream.on('finish', () => console.log(`Finish downloading ${title}`));
|
||||
} catch (e) {
|
||||
console.log(`An error occured while downloaing '${title}' retrying`)
|
||||
try {
|
||||
let stream = ytdl(url, {quality: 'highest'}).pipe(fs.createWriteStream(`${title}.mp4`));
|
||||
stream.on('finish', () => console.log(`Finish downloading '${title}'`));
|
||||
} catch (e) {
|
||||
console.log(`Unable to download '${title}'`)
|
||||
}
|
||||
}
|
||||
console.log(`Downloading '${title}'`);
|
||||
}
|
||||
})
|
||||
} else console.log(`Video ${url} was not found`);
|
||||
});
|
||||
47
JavaScript/youtube-dowloader/package-lock.json
generated
Normal file
47
JavaScript/youtube-dowloader/package-lock.json
generated
Normal file
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"name": "youtube-dowloader",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"fs": {
|
||||
"version": "0.0.1-security",
|
||||
"resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz",
|
||||
"integrity": "sha1-invTcYa23d84E/I4WLV+yq9eQdQ="
|
||||
},
|
||||
"html-entities": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/html-entities/-/html-entities-1.2.1.tgz",
|
||||
"integrity": "sha1-DfKTUfByEWNRXfueVUPl9u7VFi8="
|
||||
},
|
||||
"m3u8stream": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/m3u8stream/-/m3u8stream-0.3.0.tgz",
|
||||
"integrity": "sha512-0tvjXDIa6BolPEGo9zioQiPqfQhjopZXN3L7vZH/rZQCOLd4rPXNZc1UBMdW3TRpjNBoD0+F1X41/f0iY23rlQ==",
|
||||
"requires": {
|
||||
"miniget": "1.2.0"
|
||||
}
|
||||
},
|
||||
"miniget": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/miniget/-/miniget-1.2.0.tgz",
|
||||
"integrity": "sha1-ADY3Oia71S2+aUX85sjAOR6eEkE="
|
||||
},
|
||||
"sax": {
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
|
||||
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw=="
|
||||
},
|
||||
"ytdl-core": {
|
||||
"version": "0.21.1",
|
||||
"resolved": "https://registry.npmjs.org/ytdl-core/-/ytdl-core-0.21.1.tgz",
|
||||
"integrity": "sha512-K6ysXuHW0X3MgeLpO4IHvHp5gdF2DDrgFPP7kQODBSpeaq4+/y8lvWy6ZpxtJdQGE0+GUaBZ2H1/kYcP327UdQ==",
|
||||
"requires": {
|
||||
"html-entities": "1.2.1",
|
||||
"m3u8stream": "0.3.0",
|
||||
"miniget": "1.2.0",
|
||||
"sax": "1.2.4"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
15
JavaScript/youtube-dowloader/package.json
Normal file
15
JavaScript/youtube-dowloader/package.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "youtube-dowloader",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "Ben (plane000)",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"fs": "0.0.1-security",
|
||||
"ytdl-core": "^0.21.1"
|
||||
}
|
||||
}
|
||||
9
JavaScript/youtube-dowloader/videos.txt
Normal file
9
JavaScript/youtube-dowloader/videos.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
https://www.youtube.com/watch?v=Np1dc0BoS4k&list=PL8flSFeCsFvJhFpz0usI6diGT2stP8WF1
|
||||
https://www.youtube.com/watch?v=YoIMP57as4A&list=PL8flSFeCsFvJhFpz0usI6diGT2stP8WF1&index=2
|
||||
https://www.youtube.com/watch?v=8ys_n86INW0&index=3&list=PL8flSFeCsFvJhFpz0usI6diGT2stP8WF1
|
||||
https://www.youtube.com/watch?v=78nD9HeN2wU&index=4&list=PL8flSFeCsFvJhFpz0usI6diGT2stP8WF1
|
||||
https://www.youtube.com/watch?v=2HlgmpcYrKs&list=PL8flSFeCsFvJhFpz0usI6diGT2stP8WF1&index=5
|
||||
https://www.youtube.com/watch?v=mNJjJ5JjQdc&list=PL8flSFeCsFvJhFpz0usI6diGT2stP8WF1&index=6
|
||||
https://www.youtube.com/watch?v=-zK-sOTujMc&list=PL8flSFeCsFvJhFpz0usI6diGT2stP8WF1&index=7
|
||||
https://www.youtube.com/watch?v=vRUh0XNORiY&list=PL8flSFeCsFvJhFpz0usI6diGT2stP8WF1&index=8
|
||||
https://www.youtube.com/watch?v=Z3ZqRVrHAbY&list=PL8flSFeCsFvJhFpz0usI6diGT2stP8WF1&index=9
|
||||
Reference in New Issue
Block a user