A
A
Alexander2015-08-02 01:04:17
bash
Alexander, 2015-08-02 01:04:17

How to keep original video names in bash parser?

In general, the situation is this, I tried to write a video parser, (I know Bash for just a couple of hours, and I don’t have much knowledge in PL ... But I believe that it’s never too late to learn), but I didn’t master one moment: how to give them the original names when saving files type "name_season_episode.mp4" because There are no direct links on the page, and the output is
"12345-big-mp4" It's
not difficult for anyone, help ...

#!/bin/bash
# reassign-stdout.sh
echo -n "Введите ID сериала : "
read id
echo -n "Введите название сериала : "
read name
wget -N -P $HOME/sys/serials_id/$name http://anwap.mobi/serials/$id;log=$HOME/sys/serials_id/$name/dl.sh
exec 6>&1
exec > $log
echo "#!/bin/bash"
echo "for i in \`grep -r -iA 2 'Сезон' $HOME/sys/serials_id/$name/ | egrep -ioe 'serials/s[0-9]{3}'\`; do wget -N -P $HOME/sys/episod_id/$name http://anwap.mobi/\$i continue; for x in \`curl http://anwap.mobi/\$i | grep -i '<strong>2</strong>' | egrep -ioe 'serials/s[0-9]{3}'\`; do wget -N -P $HOME/sys/episod_id/$name http://anwap.mobi/\$x-2; done; done; for z in \`grep -r -iA 2 'serials/down' $HOME/sys/episod_id/$name | egrep -ioe '/[0-9]{4,5}'\`; do wget -Nc -P $HOME/Видео/Сериалы/$name http://anwap.mobi/serials/load\$z-big-mp4; done"
exec 1>&6 6>&-
chmod 555 $HOME/sys/serials_id/$name/dl.sh
chmod 777 $HOME/sys/dll.sh;runner=$HOME/sys/dll.sh
exec 6>&1
exec >> $runner
echo "cd $HOME/sys/serials_id/$name; ./dl.sh;"
exec 1>&6 6>&-
chmod 555 $HOME/sys/dll.sh

Ps I hope you understand what I've stuck here ... The first pancake, so to speak.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg Kleshchuk, 2015-08-27
@xenozauros

To be honest, I'm too lazy to understand this footcloth, but you have some kind of variable there with the season (let's say $i) and with the series number ($x),
then add an option to wget, like
wget -O ${name}_$ {i}_${x}.mp4 http://.......

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question