You usually need to use tokens to handle text from sites. Use $gettok to get what you're trying to out of a line of text.