ckeyes888 wrote:Can't get it to compile.
Ugh. Yea. When put in a "do shell script" AppleScript statement, quotes have to be escaped, and the backslashes have to be double-escaped. Also, while trying it myself I discovered that curl starts a new thread and doesn't actually send what it gets to standard output (i.e. it won't work directly with sed). So, it'll first have to save the output to a temporary text file which sed can then read. (If you save the file in /tmp, your system will automatically clean out the text file each night). Try this...
- Code: Select all
set xxx to do shell script "curl -o /tmp/rssfeed.txt -s http://query.yahooapis.com/v1/public/yql?q=select%20title%20from%20rss%20where%20url%3D%22http%3A%2F%2Fwww.npr.org%2Frss%2Frss.php%3Fid%3D1001%22&diagnostics=true; sleep 3; cat /tmp/rssfeed.txt | sed -E \"s/<\\?xml.*\\?>//\" | sed -E \"s/<.?query.*\\\">//\" | sed -E \"s/<\\/title>/. /g\" | sed -E \"s/<.?(results|title|item)>//g\" | sed -E \"s/<.?query>.*//\" | sed -E \"s/<.*//\""
It's super ugly because it pipes data through multiple instances of sed, but it worked for me when I tested it.