hopefully fixed youtube-dlc by updating to the latest version and specifying mp4 as the hardcoded extension for youtube, removing youtube-dl not working line from how.html, adding some css to the item page to make it more amoled!

This commit is contained in:
Flummi 2020-11-04 15:19:34 +01:00
parent 98f613237e
commit b1a62bf651
4 changed files with 35 additions and 12 deletions

View File

@ -117,9 +117,9 @@ a {
align-self: center; align-self: center;
} }
a.id-link { /*a.id-link {
padding-right: 5; padding-right: 5;
} }*/
div#my-video { div#my-video {
max-height: unset; max-height: unset;
@ -230,4 +230,29 @@ img#biohaz {
span.badge.badge-dark { span.badge.badge-dark {
margin-right: 5px; margin-right: 5px;
} }
.badge-dark, #themeselector {
color: #fff;
background-color: #000000;
border-radius: 0;
border-left: 1px solid #262626;
border-right: 1px solid #262626;
border-top: 1px solid #000;
border-bottom: 1px solid #262626;
}
.video-js .vjs-control-bar {
background-color: #1b1b1b !important;
}
a#rndbtn {
color: #fff;
background-color: #1b1b1b;
border-radius: 0;
border-left: 1px solid #262626;
border-right: 1px solid #262626;
border-top: 1px solid #262626;
border-bottom: 1px solid #262626;
padding: 0px 5px 0px 5px;
text-decoration: none;
}

View File

@ -43,16 +43,16 @@ export default async bot => {
const uuid = (await sql.query("select left(uuid(), 8) as uuid"))[0].uuid; const uuid = (await sql.query("select left(uuid(), 8) as uuid"))[0].uuid;
// read metadata // read metadata
const meta = JSON.parse((await exec(`youtube-dl --skip-download --dump-json "${link}"`)).stdout); const meta = JSON.parse((await exec(`youtube-dlc --skip-download --dump-json "${link}"`)).stdout);
const filename = `${uuid}.${meta.ext}`; const filename = `${uuid}.mp4`;
e.reply(`downloading ${filename}...`); e.reply(`downloading ${filename}...`);
// download data // download data
const start = new Date(); const start = new Date();
const maxfilesize = getLevel(e.user).level > 50 ? cfg.main.maxfilesize * 2.5 : cfg.main.maxfilesize; const maxfilesize = getLevel(e.user).level > 50 ? cfg.main.maxfilesize * 2.5 : cfg.main.maxfilesize;
const source = (await exec(`youtube-dl "${link}" --max-filesize ${maxfilesize} -o ./tmp/${filename}`)).stdout.trim(); const source = (await exec(`youtube-dlc "${link}" -f "bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best" --max-filesize ${maxfilesize} -o ./tmp/${filename}`)).stdout.trim();
if(source.match(/larger than/)) if(source.match(/larger than/))
return e.reply("too large lol"); return e.reply("too large lol");
const end = ~~((new Date() - start) / 1e3); const end = ~~((new Date() - start) / 1e3);
@ -80,7 +80,7 @@ export default async bot => {
); );
// generate thumbnail // generate thumbnail
let thumb_orig = (await exec(`youtube-dl --get-thumbnail "${link}"`)).stdout.trim(); let thumb_orig = (await exec(`youtube-dlc --get-thumbnail "${link}"`)).stdout.trim();
if(!thumb_orig.startsWith("http")) { if(!thumb_orig.startsWith("http")) {
if(mime.startsWith("image") && mime !== "image/gif") if(mime.startsWith("image") && mime !== "image/gif")
thumb_orig = `./public/b/${filename}`; thumb_orig = `./public/b/${filename}`;

View File

@ -27,9 +27,7 @@
<p>f0ck will f0ck any media link posted in the channel ending with: jpg|gif|png|webm|mp3|mp4|ogg|flac</p> <p>f0ck will f0ck any media link posted in the channel ending with: jpg|gif|png|webm|mp3|mp4|ogg|flac</p>
<p>If you don't want f0ck to f0ck it put !ignore behind your link. Example: <p>If you don't want f0ck to f0ck it put !ignore behind your link. Example:
https://retard-journal.com/stupidshit.png !ignore</a> https://retard-journal.com/stupidshit.png !ignore</a>
<p>f0ck will only f0ck media links with the maximum size of 30MB for cool people 80MB</p> <p>f0ck will only f0ck media links with the maximum size of 40MB for cool people ??MB</p>
<p>YouTube Links are currently not working, if you really want to f0ck them, you gotta download it yourself and
reupload somewhere until this is fixed</p>
</div> </div>
</div> </div>
{{include main/footer}} {{include main/footer}}

View File

@ -1,7 +1,7 @@
{{include main/header}} {{include main/header}}
<div class="container"> <div class="container">
<div class="controls"> <div class="controls">
<a id="rndbtn" href="/random">Random >.<</a> <a id="rndbtn" href="/random">Random</a>
</div> </div>
<div class="content"> <div class="content">
<div class="next-post"> <div class="next-post">
@ -41,7 +41,7 @@
<span class="badge badge-dark"><a href="/{{=item.id}}" class="id-link">{{=item.id}}</a></span> <span class="badge badge-dark"><a href="/{{=item.id}}" class="id-link">{{=item.id}}</a></span>
<span class="badge badge-dark">{{=user.network}} / {{=user.channel}}</span> <span class="badge badge-dark">{{=user.network}} / {{=user.channel}}</span>
<span class="badge badge-dark"><a id="post_source" href="{{=item.src.long}}" target="_blank">{{=item.src.short}}</a></span> <span class="badge badge-dark"><a id="post_source" href="{{=item.src.long}}" target="_blank">{{=item.src.short}}</a></span>
<span class="badge badge-dark">{{=item.size}}</span> <span class="badge badge-dark">{{=item.mime}} / {{=item.size}}</span>
<span class="badge badge-dark"><time class="timeago" title="{{=item.timestamp}}" datetime="{{=item.timestamp}}"></time></span> <span class="badge badge-dark"><time class="timeago" title="{{=item.timestamp}}" datetime="{{=item.timestamp}}"></time></span>
<span class="badge badge-dark" id="themes"></span> <span class="badge badge-dark" id="themes"></span>
</div> </div>