If you don't need a universal answer that simulates a web browser and runs the JS (you need to do this to get a universal solution), but are fine with just finding the download link from the html you get by yourself, then you can:
wget
the page (wget will follow HTTP redirect so that this will give you the target html with the JS that does the download)- you then need to parse the HTML and find the link you're looking for
- you need to
wget
that link
I wrote some simple scripts to do 2,3 for you at https://github.com/pjump/wgetbyCss In order to use them, you need
- ruby
- the mechanize gem (
gem install mechanize
)
Then you can do:
./wget_by_link_text 'http://www.ofsted.gov.uk/filedownloading/?id=1295389&type=1&refer=1' "Please download the requested file here"
i.e.:
./wget_by_link_text url link_text [save_as]
To get that link by its text. Alternatively, you can use the wget_by_css
script and get the link by its .auto_click
class, or some other css selector.