Copy Link
Add to Bookmark
Report

NULL mag Issue 06 28 Add youtube videos to BBS

eZine's profile picture
Published in 
null magazine
 · 3 years ago

  




now that bbses have 24/7 internet connection and the bandwidth is 
high, why not offer videos to our users? depending your theme on your 
bbs or what do you like, you can offer a plethora of videos for 
downloading. so lets make a script, that will download a video, the 
description and make a nice archive with file_id.diz file, to offer at 
the file section of your bbs.

you'll have to install youtube-dl,iconv,par and zip support to your linux 
machine. then copy paste the script below, make it executable and use 
it like this: ./yt2bbs https://www.youtube.com/watch?v=iEN1KVdslbk

it will: 
+ get the video description
+ download the file, only if it is smaller than 70MB. you can
change that if you want.
+ it will convert the description to cp437 format and make 
the file_id.diz file, with a width of 40chars
+ rename the video file, so it hasn't spaces in the name
+ make a zip file containing the video file and the .diz 
 file.

this way users visiting your bbs, will be able to read a description 
about the video before downloading it.

/- yt2bbs.sh ---------- ------------------- ------------ ------- -- - - -\

#!/bin/bash
youtube-dl -f 'best[filesize<70M]' "$1" --get-description | par 40 >> desc.txt
if [ $? -eq 0 ]; then

#convert text to CP437
iconv desc.txt -f utf8 -t cp437 -c -o file_id.diz
rm desc.txt
#get description, format it to 40 chars wide and save it as file_id.diz
fname="$(youtube-dl -f 'best[filesize<70M]' "$1" --get-filename)"
#remove spaces
fname="$(echo "${fname// /_}")"
#remove single quotes
fname="$(echo "${fname//\'/_}")"
#now download the video and
youtube-dl -f 'best[filesize<70M]' "$1" -o $fname
#zip the files... video+file_id.diz
zip "${fname%.mp4}.zip" file_id.diz "$fname" -0
else
echo "Error geting video information."
fi

\---------------------- ------------------- ------------ ------- -- - - -/


← previous
next →
loading
sending ...
New to Neperos ? Sign Up for free
download Neperos App from Google Play
install Neperos as PWA

Let's discover also

Recent Articles

Recent Comments

Neperos cookies
This website uses cookies to store your preferences and improve the service. Cookies authorization will allow me and / or my partners to process personal data such as browsing behaviour.

By pressing OK you agree to the Terms of Service and acknowledge the Privacy Policy

By pressing REJECT you will be able to continue to use Neperos (like read articles or write comments) but some important cookies will not be set. This may affect certain features and functions of the platform.
OK
REJECT