The power of modern Bash
I wondered why you used:

seq 1 ${maxtodownload} | while read videopage;
do

as opposed to:

for (( videopage=1; videopage&amp;lt;=${maxtodownload}; videopage++ ))
do

or (if you don't like repeating 'videopage' three times):

for videopage in {1..10}
do

You can even do more fancy stuff like:

for i in {001..0010}; do

for i in {0010..001}; do

for c in {a..h}; do

I find I almost never use the 'seq' command in today's version of Bash.