property username : "blog_username"

property userpass : "blog_password"

property myblogid : "Blog_id"

property user : "delicious_username"

on postToBlog(myTitle, des)

set poststrut to {title:myTitle, |description|:des}

--I can't work out how to put the metaweblog url in a property so hard code it here

tell application ""

return call xmlrpc {method name:"metaWeblog.newPost", parameters:{myblogid, username, userpass, poststrut, true}}

end tell

end postToBlog

set qChar to ASCII character 34

set use_date to (current date) - 8 * days

set html to ""

set turl to "" & user

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

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 pubDate to value of (XML element "pubDate" of idElement)

set dateVar to the current date

set monthList to {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}

set m to word 3 of pubDate

set y to word 4 of pubDate

repeat with i in monthList

if m is equal to i as string then set monthnum to number of i

end repeat

set year of dateVar to y

set the month of dateVar to monthnum

set the day of dateVar to word 2 of pubDate

if dateVar < use_date then exit repeat

set tdes to value of (XML element "description" of idElement)

set turl to value of (XML element "link" of idElement)

set ttitle to value of (XML element "title" of idElement)

set html to html & return & "<li><a href=" & qChar & turl & qChar & ">" & ttitle & "</a> " & tdes & "</li>"

end repeat

end tell

--return html

end tell

set des to "Webpages I've bookmarked on delicious this weeK:<ul>" & html & "</ul>"

set thisdate to get date string of (current date) as string

set myTitle to "This weeks links " & thisdate

postToBlog(myTitle, des)