set turl to "http://feeds.delicious.com/v2/rss/_USERNAME_/%40comment?private=_PRIVACY_KEY_&count=10"


set xmlData to do shell script "curl" & " " & "'" & turl & "'"

set urlList to {}

tell application "System Events"

set xmlDocument to make new XML data with data xmlData

tell contents of xmlDocument

set rootElement to first XML element

set n to name of rootElement

set idElements to XML elements of XML element "channel" of XML element n of xmlDocument whose name is "item"

if ((count of idElements) = 0) then return ""

repeat with idElement in idElements

set the end of urlList to value of (XML element "link" of idElement)

end repeat

end tell

end tell


set numURLs to (count urlList)

tell application "Safari"

activate

-- create all the tabs that are needed

tell application "System Events"

tell process "Safari"

click menu item "New Window" of menu "File" of menu bar 1

end tell

-- enter the url in the open window

keystroke (item 1 of urlList)

key code 36

repeat with i from 2 to (numURLs)

-- for each additional url, first create a tab

tell process "Safari"

click menu item "New Tab" of menu "File" of menu bar 1

end tell

-- now enter the url

keystroke (item i of urlList)

key code 36

end repeat

end tell

end tell