Automator for searching url's

Hi there,

I’m looking to have automator help me search urls for items. I want to set up automator to search for key words in a specific url and email me the paragraph. For example, I want to search craigslist for 1 GB of RAM, but I don’t want to log onto craigslist everyday to do it…I might forget :)…so, if I could get automator to do a search then email me the results, this would be ideal.

I remember reading about a guy who had automator search for whether a Nintendo Wii was available on a certain web site, just by searching for a specific word. Once it became available he would get an email telling him it was ‘in stock’.

Now I can’t find that article, and I was hoping I could get some help.

Thanks in advance,

Hi happyworker,

the shell command curl in conjunction with grep is a powerful tool to parse URL’s without any browser
Here a little example for the “Run AppleScript” action

on run {input, parameters}
	set keyword to "Dell"
	set found to paragraphs of (do shell script "curl | grep " & keyword & " | cut -f 2 -d '=' | cut -f 1 -d '<'")
	return found
end run

notes: grep filters the paragraphs containing the keyword, the following cut trims the lines.
For example

<a href="\”>Dell Inspiron Parts, From a 5100 Series - Screen, Battery, CPU, RAM - $10<font size="-1"> (Daly City/Pacifica)<span style="color:orange;"> pic


will be cut to

“"\”>Dell Inspiron Parts, From a 5100 Series - Screen, Battery, CPU, RAM - $10"

This sounds fantastic. I just can’t get it to show up.

I put this into automator through the ‘run applescript’, but it doesn’t show up anywhere.

Let’s say I just want to view the links in a webpage, what should I put after this script in automator?

Thanks again, this rocks!


Have you tried to append the “View results” action?

Use the Get Link URL from Webpages Safari action, or
do it directly in AppleScript with javascript
Here are some javascript examples from Apple

Thanks for your help Stefan.

Yes I have tried the ‘Get Link URL from Webpages’ but I’m getting an error:

Applescript Error
curl: (1) Unsupported protocol: 2tp (1)