Get URL Page title with do shell script

Hi everybody,

I have an URL page and i want to get the title of this page.

Is there a way to do that with a do shell script function.

thanks for your help,



if the page contains normal HTML code,
try this

set title to do shell script "/usr/bin/curl '' | /usr/bin/awk '/<title>/' | /usr/bin/cut -d '>' -f 2 | /usr/bin/cut -d '<' -f 1"

Yes it s working with macsripter site but i wanted to do that for youtube movie title.

I tried your other post method and it did not work.

This one too.

What else could i tried?

this works also on
Make sure, that the path is in single quotes

Is there a way to add single quote like i add double quote “"”

quoted form of "" --> ''

Thanks it s working very well

Sorry for the last question it was a bit stupid.

See you later and thanks again for all you do with this forum

So how would i be able to use this with xcode? I’ve tried using it with boxes, or text, but doesn’t want to show the Header. It does work when i do it on the Applescript application…

Barring silly mistakes like not having an Applescript name for the object you want to hold the result, it’s p’bly not working due to the code you’re using…so why not post the code you’re using?

Which one would i be talking about? lame question… Here it is.

set title to do shell script "/usr/bin/curl '' | /usr/bin/awk '/<title>/' | /usr/bin/cut -d '>' -f 2 | /usr/bin/cut -d '<' -f 1"

Well, apologies for the lame question; maybe GIGO strikes again. I took the statement I’ve tried using it with boxes, or text, but doesn’t want to show the Header to indicate that you were getting a result, but couldn’t set the content of some object to its value. Apparently that’s not the case. And since you’re not offering any more details, I’ve got no more lame questions :wink:

FWIW, the awk part will have trouble with case. I know nothing about awk, so I’m using this butt-simple case-insensitive search string: ‘/<[Tt][Ii][Tt][Ll][Ee]>/’ which works fine. Haven’t yet dug into what bothers curl when it tries to fetch sites like

ehh… Ok so you know the script that i use. And in Applescript it shows the URL Header. I want that header in a text box or something.