Max Max - 4 months ago 9
Ruby Question

Ruby, Capybara, getting actual file URL from a redirect link?

I'm trying to automate the download of two files from a website, but the link is actually a redirect that goes to the actual URL. But I can't figure out how to catch that URL (so I can then pass it to wget). Any ideas?

Answer

There is no direct way to get the destination of a redirect in Capybara, but you should be able to set the --max-redirect wget option to something more than the default 0 and wget should follow the redirect for you.

Comments