Here is the code you are looking for:
on run {input, parameters}
set dLocation to POSIX path of (path to downloads folder) & "test/"
set fileList to {}
set AppleScript's text item delimiters to {"/"}
repeat with i from 1 to (count of input)
# With the delimeter to '/' last item is the filename!
set urlStr to (get item i of input) as text
set urlFile to last text item of urlStr
set savedFile to (dLocation & urlFile) as POSIX file
log "Saved file is: " & savedFile
try
savedFile as alias
log "File exists: " & savedFile
on error mMsg
set end of fileList to urlStr
log "Adding URL: " & urlStr
end try
# delay 5
end repeat
return fileList
end run
All the above does is to grab the filename at the end of the link. It checks if the file exists and if not adds the link to the list of links to download. It then passes the list of links on.
After the Applescript action add a Download URLs
action and you should be done.
EDIT:
So the Workflow will be like this:
- Define Site URL
- Action: Get URL Links from Webpages
- Action: Run applescript (code above)
- Action: Download URLs
- Action: Pause (optional)
- Action: Loop
Note that the Loop Action limits you to 1000 minutes. So you have two choices, 1) add more loop actions, or 2) launch the workflow from a script with an infinite loop...
The other way is to write the whole thing as a script and have it run continuously.
EDIT2:
Oops just reread your question. It was for 240minutes, so a single loop function will work just fine.