Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

derekshull

macrumors newbie
Original poster
May 7, 2012
9
0
I have this script and I want it to read three headlines from the google science and tech rss feed from news.google.com

it reads the titles of the article fine but the description is all messed up with html code all over it and I'm wondering if any of you might be up looking it over and helping me out. Thanks!

Code:
property RSSURL : "http://news.google.com/news?ned=us&topic=t&output=rss"
property RSSFile : POSIX path of ((path to temporary items as Unicode text) & "rss.xml")

tell application "System Events"
	activate
	try
		do shell script "curl -sS " & quoted form of RSSURL & " > " & quoted form of RSSFile
		set rssFeed to XML file RSSFile
		
		set rssItems to XML elements 1 thru 3 of XML element "channel" of XML element "rss" of contents of rssFeed whose name is "item"
		
		get value of XML element "title" of XML element "channel" of XML element "rss" of contents of rssFeed
		display dialog "These are today's top news headlines from " & result
		delay 2
	on error errorMsg number errorNum
		display alert "Error " & errorNum message errorMsg buttons "Cancel" default button 1
		return false
	end try
	
	repeat with thisItem in rssItems
		try
			display dialog (get value of XML element "title" of thisItem)
		on error
			display dialog "No title for this item."
		end try
		delay 1
		
		try
			display dialog (get value of XML element "description" of thisItem)
		on error
			display dialog "No description for this item."
		end try
		delay 2
	end repeat
	display dialog "End of headlines."
end tell
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.