Jump to content

Script To Download Revision3 Videos


Jamo

Recommended Posts

Hi Im trying to make a script that would help me to download revision3 videos. This same file that Ill post here can be found from episodes section. Now you can download only newest hak5 episode with this. I would add a couple things to my script, I will add option for downloading tekzilla, tbhs or hak5.

Script downloads feed, extracts newest episode, tells its name, and lets you choose if you want to download it. I would like it script could also tell if you have already downloaded that episode. and maybe it would automatically download newest episode, if you havent already downloaded it.

As a starter shell scripter I really have no clue how this should be done. So it would be nice if you could help me to make this thing working better.

hak5.sh 
#!/bin/bash
echo "Welcome to Hak5 Downloader v0.1"
echo "Thanks to theSuperman and Jarmo "
echo "Do you want to download feed?"
echo "(y/n):"
read input 

if [ "$input" = "y" ]
then
echo "Downloading Feed"
wget -O feed "http://revision3.com/hak5/feed/MP4-Large"
filename=`cat feed | egrep "mp4" | cut -d '"' -f 2 | grep "http" | head -n1`
#else 
#	filename=`cat feed |egrep "mp4" | cut -d '"' -f 2 | grep "http" | head -n1`
fi


echo "Download file?"
echo $filename
echo "(y/n):"
read input

if [ "$input" = "y" ]
then
echo "\n\n"
#wget -c $filename
axel -a $filename
fi

echo "Do you want to remove feed?"
echo "(y/n)"
read input

if [ "$input" = "y" ]
then 
rm feed
echo "Feed removed"
else
	echo "Feed not removed"
	exit
fi

Link to comment
Share on other sites

Nice Job you guys! Just threw together one that asks you what you want to download:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->#!/bin/bash

echo "Welcome to Hak5 Downloader v0.1"

echo "Thanks to theSuperman and Jarmo "

echo "For Comming up with the original scripts"

choice=4

echo "1. MP4 Large"

echo "2. MP4 Small"

echo "3. Xvid Large"

echo -n "Please choose the video type to be downloaded (1,2, or 3,)"

while [ $choice -eq 4 ]; do

read choice

if [ $choice -eq 1 ]; then

wget -O feed "http://revision3.com/hak5/feed/MP4-Large"

filename=`cat feed | egrep "mp4" | cut -d '"' -f 2 | grep "http" | head -n1`

wget -c $filename

else

if [ $choice -eq 2 ]; then

wget -O feed "http://revision3.com/hak5/feed/MP4-Small"

filename=`cat feed | egrep "mp4" | cut -d '"' -f 2 | grep "http" | head -n1`

wget -c $filename

else

if [ $choice -eq 3 ]; then

wget -O feed "http://revision3.com/hak5/feed/Xvid-Large"

filename=`cat feed | egrep "xvid" | cut -d '"' -f 2 | grep "http" | head -n1`

wget -c $filename

else

echo "Please make a choice between 1,2, and 3!!"

echo "1. MP4 Large"

echo "2. MP4 Small"

echo "3. Xvid Large"

echo -n "Please choose the video type to be downloaded (1,2, or 3,)"

choice=4

fi

fi

fi

done<!--c2--></div><!--ec2-->

The last part won't work for some reason so entering anything but 1,2, or 3 will cause and error but the script will just re-loop to the beginning. Feel free to fix it if you know what I did wrong <img src="http://www.hak5.org/forums/public/style_emoticons/<#EMO_DIR#>/tongue.gif" style="vertical-align:middle" emoid=":P" border="0" alt="tongue.gif" /> lol Also didn't add the "rm feed" in there because I am too tired right now <img src="style_emoticons/<#EMO_DIR#>/tongue.gif" style="vertical-align:middle" emoid=":P" border="0" alt="tongue.gif" />

EDIT: Fixed a typo that threw off options 2 and 3 (Missing spaces).

S I just checked original topic. So if anyone have any ideas to make this work.

Link to comment
Share on other sites

The reason I created the original script was to quickly download the latest episode. If you wish to add more complexity to it, be my guest. However, a shell script might not be the best way of doing all this logic. You might be better off with an actual programming language, or more robust scripting language (ruby, perl, python, php)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...