Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
So I was trying to download all the lectures from my concurrent programming class (mpla-server.mpla.com/courses/CE123) with wget and I failed (it only downloaded an index.html)
It's weird cause I managed to do it in an other class page e.x (mpla-server.mpla.com/CE124/lectures). I should point out that the latter had both /lectures.php and lectures/ which gives a dir with all the pdf files . The first page has hrefs with the pdfs pages but when I try wget recursively it doesn't find any pdfs.
it will fetch all the links on the page that have a pdf extension, and put them in a text file
then you can try:
Code:
for i in $( cat output.txt ); do wget $i; done
this will loop through the text file and download the links, I hope it works for you
Thanx man. The first page has href for the PDFs. The second page has both lectures.php and lectures/. The lectures/ gives a page "index of CE124/lectures" and at the bottom says something about apache.
The q is why at the first page wget can't get the PDFs.
Not sure why,
but maybe because the first page has links to the pdfs (not the actual files), and wget is not configured to follow them. the second page has lectures.php which is what you get when you hit it with a browser probably, but it also has the actual pdf files in that directory.
Many sites check your browser's user-agent string and/or use cookies in order to block mass downloading programs, and often return a simple index.html instead of the desired file such cases. It's possible to spoof these things, but it can be more complex and site-specific.
You can start by using the -U option to make wget appear to be another browser, at least.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.