download a zipfile from a webpage

hello, first of all: sorry for my bad english!

i want to scan a particular webpage for a a particular link…
its everytime the same page and the link is also everytime on the same position on the webpage! only the file, which the link refers to, is each day a diffrent one!

fe:
www.test.de/test.php

so im looking for a script whitch runs every day, at 0am, without a browser, and download the file, contained in the link on the webpage!

i tried some stuff, im tired of searching forum by forum… and im really new to applescript… so i hope someone can help me!

thanks
stefnw

What have you tried? Let us know where you’ve been so we can guide you to where you want to be.

ok, maybe thats the best way :wink:

i found a script that fits pasably…
its from an other post here of this site, i modiefied it a little bit (the downloadpart) and edited the image-placeholder to links-placeholder!

the problem with this script is, that it needs safari! otherwise it works fine!
so i dont know how to set the “linksURLtext” to a correct url like “www.test.de” to get the javascript started!
i tried it with tell application “URL Access Scripting”, but i dont get it to work!

and i also have no idea to get the script started once every day on a specific time!

i hope u can help me, to get it work!
thanks ahead!
stefnw

on getlinksURLs()
	set js to "var linksURLtext = \"\";
var linksCount = document.links.length;
var lastLinksIndex = (linksCount - 1);

linksURLtext = document.links[1].href;
return linksURLtext;"
	
	tell application "Safari" to set linksURLtext to (do JavaScript js in front document)
	set linksURLs to {}
	if ((count linksURLtext) > 0) then
		set alllinksURLs to paragraphs of linksURLtext
		considering case
			repeat with i from 1 to (count alllinksURLs)
				set thisURL to item i of alllinksURLs
				if (thisURL is in linksURLs) then
				else
					set end of linksURLs to thisURL
				end if
			end repeat
		end considering
	end if
	set the destination_file to ((path to desktop as string) & "bnn.zip")
	tell application "URL Access Scripting"
		download linksURLtext to destination_file replacing yes with progress
	end tell
	return linksURLtext
end getlinksURLs

getlinksURLs()