• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4814
  • Last Modified:

Downloading content using wget

I subscribe to a monthly-pay multimedia content provider.  This site hosts a large collection of content I'd like to download, but tends to be very slow - manually downloading is a poor option.  I have attempted to use wget to download content, but I always get a 302 redirect instead of the content I'm trying to download.

here's the script I'm using -

wget --load-cookies="administrator@site[2].txt" --load-cookies="administrator@www.site[1].txt" --load-cookies="administrator@site.txt" -np -erobots=off -t10 -w2 --random-wait --waitretry=7 -U "Mozilla/4.03 [en] (X11; I; SunOS 5.5.1 sun4u)" -k --http-user=Mylogin --http-passwd=Mypassword --proxy-user=Mylogin --proxy-passwd=Mypassword -nv -A\*\.\* VideoName

The cookies were generated by logging in through IE.
The login and password work fine through IE/Opera.

Any suggestions on how to get this to work ?

Thanks.

- The site does not mind bots downloading content.





0
JaffaKREE
Asked:
JaffaKREE
1 Solution
 
frugleCommented:
looks interesting... I take it you have to login with cookie to get to the content.

are you specifying the full pathname to the cookie or have you copied it into the working directory?

I don't recognise (without the manpage) some of the options, are you -m mirroring the content?

Mike
0
 
JaffaKREEAuthor Commented:
Yes, I have copied the cookies over.  I wasn't using -m, I'm just trying to hit one file right now.

if I log in through IE I can bounce page-to-page until I close the browser.  Then I need to log in again.

I figured logging in to IE, copying the cookie, and using it in the wget script without closing IE would allow me to mimic the IE session.  I'm using the IE user-agent string now, but I'm still getting a 302 redirect.

Ideas ?

0
 
frugleCommented:
Looking a little deeper into it, which you probably have so stop me if I'm giving the old egg-sucking lessons...

--load-cookie seems to work best with netscape cookies - if you've exported your cookie using IE's import/export cookie routine it *may* work, or may not, but copying the cookie file in IE's native format probably won't. Getting the 302 adds weight to this.

What you CAN do as a workaround is manually add the cookie to wget using the following arguments:

wget --cookies=off --header "Cookie: name=value"


If you:

 --save-cookies file

it may give you a better idea of the format your cookie file needs to be in.

good luck,

Mike
0
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 
gnudiffCommented:
1. While you are testing with single file download, perhaps it'd be better to remove -A option.
2. Assuming that authentication works, the 301 response seems to indicate that the video file is accessed differently - perhaps not via its name but via page script that gets passed the name as a parameter.  If you turn off the quiet mode of wget, perhaps you can see where you are being redirected?
0
 
gnudiffCommented:
Oops, misread the code.
302 means that actually the video IS under a different name probably, so you should see the Location: header you are getting?
0
 
eucodersCommented:
There is an issue regarding the referer thing as well.

Usually the easiest and quickest way to block bots is to do a very good referer thing as many browsers today support referer url.

For example, if you are the webmaster, and you know that the videos are available as links on page1 and page2, you can do a filter in apache to allow downloading only from those pages, and not others.

Many bots forget to put the right url as referer, when downloading images, etc.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now