Automator > modifying an URL before downloading it

automator

I'm trying to automate a download process for images on multiple webpages.

So far, my actions are :

  1. "Ask for text" > i paste multiple URLs
  2. "Extract URLs from Text"
  3. "Get Image URLs from Webpage" (I get all images)
  4. "Filter URLs" (I filter the one i want, for instance the ones ending with "_small.jpg")
  5. "Download URLs".

It works fine, but I'd like to download the images ending with "_large.jpg", which are not present on the webpages I submit in 1).

So how would I go from 4) to 5) while changing the URL, i.e. replacing "_small.jpg" by "_large.jpg" ?

Thank you

Best Answer

Using shell scripting, you could do something like this:

wget $(curl $(<urls.txt) | grep -o 'http[^"]*_small.jpg' | sed 's/_small/_large/')