You are not logged in.
Pages: 1
Hey there, i recently got gifted a virtual course on programming, about 20 some odd videos accessible online.
I find it much more convenient to save the vids locally and watch them, but clicking though all the menus was tedious. I managed to dl a few of the vids using wget (all on my own like a big boy!) but couldn't figure out an expression to have it fetch all the vids. It is my understanding that wildcards and wget don't work together and you are stuck with -A for such actions, but I haven't gotten that to work out.
here's the command that works-
me@home$ wget "https://securedownloads.teach12.com/anon.eastbaymedia-drm/courses/2074/m4v/TGC_2074_Lect01_IntroductionCPlusPlus.m4v?userid=A69D0C&orderid=1454726&courseid=2074&FName=TGC_2074_Lect01_IntroductionCPlusPlus"
The key is the two instances of Lect01. If i can change those numbers, I can access the other vids, but I'm not sure how to make that happen without wildcards, or even how to do it with wildcards since I need quotes for the command to work at all
Offline
I managed to dl a few of the vids using wget (all on my own like a big boy!) but couldn't figure out an expression to have it fetch all the vids.
Wget can trawl a site (if you are talking about a website) and download all files of a certain types; if it has permission, that is:
https://dt.iki.fi/download-filetype-wget
The key is the two instances of Lect01. If i can change those numbers, I can access the other vids, but I'm not sure how to make that happen without wildcards, or even how to do it with wildcards since I need quotes for the command to work at all
Not sure what you're alludiong to here. Maybe you need to iterate through a list of numbers, like 01, 02, 03 etc., and are asking for shell scripting fu?
If the above article does not solve your problem, please elaborate.
Please use CODE tags for code.
Search youtube without a browser: repo | thread
BL quote proposals to this thread please.
my repos / my repos
Offline
for n in {1..10}; do
num=$(printf %02d $n)
wget "https://securedownloads.teach12.com/anon.eastbaymedia-drm/courses/2074/m4v/TGC_2074_Lect01_IntroductionCPlusPlus.m4v?userid=A69D0C&orderid=1454726&courseid=2074&FName=TGC_2074_Lect${num}_IntroductionCPlusPlus" done
done
Adjust the range as needed.
Music makes us braver
Offline
Thank you, ohnonot, I'll review the sight.
twoion, would i enter the lines you posted directly into the terminal or would i save this as a script and execute it?
Offline
Thank you, ohnonot, I'll review the sight.
twoion, would i enter the lines you posted directly into the terminal or would i save this as a script and execute it?
You can do either. As long as you adjust the "page range" to what you need.
Music makes us braver
Offline
Yay! I wrote it as a script and it worked flawlessly!
Next question is how to rename them all?
I have
rename.ul
from linux-utls but I get the feeling I'll need more complex bash-fu to make it work. I would like to go from
TGC_2074_Lect01_IntroductionCPlusPlus.m4v?userid=A69D0C&orderid=1454726&courseid=2074&FName=TGC_2074_Lect01_IntroductionCPlusPlus
to
Lect01
The syntax for
rename.ul
is expression replacement target-file so i tried
$ rename.ul -nv *Lect* Lect T*
but that got me nowhere
I'm thinking I need to do something like the wget script
for n in {1..10}; do
num=$(printf %02d $n)
mv "TGC_2074_Lect${num}_IntroductionCPlusPlus.m4v?userid=A69D0C&orderid=1454726&courseid=2074&FName=TGC_2074_Lect${num}_IntroductionCPlusPlus" Lect${num} done
Is that close?
edit: Also in the original command what is the '%02d' for int he printf command?
Last edited by horo (2020-12-13 19:41:35)
Offline
Try
perl-rename -nv 's/^.*(Lect\d+).*$/$1.m4v/' *.m4v*
(replace perl-rename with replace.pl or just replace on Debian).
If it checks out, remove the -n flag to make it execute the renames.
Music makes us braver
Offline
i do not have any replace function, what package would it be in?
Offline
mmv is a great tool for this kind of stuff, also great to mess everything.
Offline
Pages: 1