_                _   _                 ____            _     _ 	
   / \   _ __   ___ | |_| |__   ___ _ __  |  _ \ _ __ ___ (_) __| |	
  / _ \ | '_ \ / _ \| __| '_ \ / _ \ '__| | | | | '__/ _ \| |/ _\` |	
 / ___ \| | | | (_) | |_| | | |  __/ |    | |_| | | | (_) | | (_| |	
/_/   \_\_| |_|\___/ \__|_| |_|\___|_|    |____/|_|  \___/|_|\__,_|	
                                                                bbs
  XQTRs lair...
Home // Blog // NULL emag. // Files // Docs // Tutors // GitHub repo
                                                                                
                                                                                
                                                                                
   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                                                                              
                                                                                
   \---------------------- ------------------- ------------ ------- -- - - -/