Removing <br> from curled result

I made a lyric finder app and I want to remove the
tag that azlyrics puts after every line. For example:



		set songname to "Somebody Someone"
		set artistname to "Korn"
		set songname to every text item of songname
		set artistname to every text item of artistname
		repeat with x from 1 to count songname
			
			if item x of songname contains " " then
				set item x of songname to ""
			end if
			if item x of songname contains "'" then
				set item x of songname to ""
			end if
			if item x of songname contains "/" then
				set item x of songname to ""
			end if
			if item x of songname contains "." then
				set item x of songname to ""
			end if
			if item x of songname contains "(" then
				set item x of songname to ""
			end if
			if item x of songname contains ")" then
				set item x of songname to ""
			end if
			if item x of songname is "&" then
				set item x of songname to ""
			end if
			if item x of songname is "-" then
				set item x of songname to ""
			end if
		end repeat
		repeat with x from 1 to count artistname
			
			if item x of artistname contains "'" then
				set item x of artistname to ""
			end if
			if item x of artistname contains " " then
				set item x of artistname to ""
			end if
			if item x of artistname contains "/" then
				set item x of artistname to ""
			end if
			if item x of artistname is "." then
				set item x of artistname to ""
			end if
			if item x of artistname is "(" then
				set item x of artistname to ""
			end if
			if item x of artistname is ")" then
				set item x of artistname to ""
			end if
			if item x of artistname is "&" then
				set item x of artistname to ""
			end if
			if item x of artistname is "-" then
				set item x of artistname to ""
			end if
		end repeat
		
		set artistname to artistname as string
		set songname to songname as string
		set new_string to ""
		repeat with i in characters of artistname
			set ascii_num to the ASCII number of i
			if ascii_num is greater than 64 and ascii_num is less than 91 then
				set new_string to new_string & (ASCII character (ascii_num + 32))
			else
				set new_string to new_string & i
			end if
		end repeat
		set artistname to new_string
		set new_string to ""
		repeat with i in characters of songname
			set ascii_num to the ASCII number of i
			if ascii_num is greater than 64 and ascii_num is less than 91 then
				set new_string to new_string & (ASCII character (ascii_num + 32))
			else
				set new_string to new_string & i
			end if
		end repeat
		set songname to new_string
		
		--curl page, set search url
		
		set azurl to "azlyrics.com/lyrics/" & artistname & "/" & songname & ".html"
		set curled to every paragraph of (do shell script "curl " & azurl)
		set searchurl1 to "http://search.azlyrics.com/cgi-bin/azseek.cgi?q=" & songname
		set searchurl2 to "http://search.azlyrics.com/cgi-bin/azseek.cgi?q=" & artistname
		
		--end curl page, set search url
		
		--find lyrics
		
		if item 3 of curled contains "robots" then
			return "Sorry that song wasn't found. Try searching for the song:" & return & return & searchurl1 & return & searchurl2
		else
			repeat until item 1 of curled contains "<font size=2>"
				set curled to rest of curled
			end repeat
			set curled to rest of rest of curled
			set curled to reverse of curled
			repeat until item 1 of curled contains "<a href=\"http://www.azlyrics.com\">www.azlyrics.com</a>"
				set curled to rest of curled
			end repeat
			set curled to reverse of rest of rest of curled
			
			
			--end find lyrics
			
			--process lyrics
			
			set x to 0
			repeat with a from 1 to (count curled)
				set x to x + 1
				set item x of curled to {item x of curled & return}
			end repeat
			
			--end process lyrics
			
			--return lyrics
			
			set lyrics to curled as string
			return lyrics
			
			--end return lyrics
		end if

Here’s a link to the app: http://returnlyrics.netfirms.com

Model: Powerbook G4 Aluminum
AppleScript: ?
Browser: Safari 312
Operating System: Mac OS X (10.3.9)

Also, how do I add a scrollbar? I know how to with textview but if I use that, then how do I edit the contents (ex: set the contents of text field “field1” to “contents”) ?

This can be reduced to:

on clicked the_object
	set object_name to name of the_object as unicode text
	if object_name = "get_lyrics" then
		set songname to (string value of text field "songname" of window "main")
		set artistname to (string value of text field "artistname" of window "main")
		set contents of text view 1 of scroll view 1 of window "main" to my get_lyrics(songname, artistname)
	end
end

on get_lyrics(songname, artistname)
	set songname to my clean_string(songname)
	set artistname to my clean_string(artistname)
	set curled to (do shell script "curl azlyrics.com/lyrics/" & artistname & "/" & songname & ".html")'s paragraphs
	set searchurl1 to "http://search.azlyrics.com/cgi-bin/azseek.cgi?q=" & songname
	set searchurl2 to "http://search.azlyrics.com/cgi-bin/azseek.cgi?q=" & artistname
	if item 3 of curled contains "robots" then
		return "Sorry that song wasn't found. Try searching for the song:" & return & return & searchurl1 & return & searchurl2
	else
		repeat with i from 1 to (count curled)
			if item i of curled contains "<font size=2>" then exit repeat
		end repeat
		set curled to reverse of (curled's items (i + 1) thru -1)
		repeat with i from 1 to (count curled)
			if item i of curled contains "<a href=\"http://www.azlyrics.com\">www.azlyrics.com</a>" then exit repeat
		end repeat
		set curled to reverse of (curled's items (i + 2) thru -1)
	end if
	set curled to my list_to_string(curled, return)
	set curled to my snr(curled, "<BR>", "")
	set curled to my snr(curled, "<br>", "")
	return curled
end get_lyrics

on clean_string(the_string)
	set search_strings to (" '/.()&-")'s characters
	repeat with i from 1 to (count search_strings)
		set the_string to my snr(the_string, item i of search_strings, "")
	end repeat
	return my convert_to_lower(the_string)
end clean_string

on snr(the_string, search_string, replace_string)
	tell (a reference to my text item delimiters)
		set {old_tid, contents} to {contents, search_string}
		set {the_string, contents} to {the_string's text items, replace_string}
		set {the_string, contents} to {"" & the_string, old_tid}
	end tell
	return the_string as Unicode text
end snr

on convert_to_lower(the_string)
	set the_string to the_string's characters
	repeat with i from 1 to (count the_string)
		set ASCII_num to ASCII number (item i of the_string)
		if ASCII_num > 64 and ASCII_num < 91 then set item i of the_string to (ASCII character (ASCII_num + 32))
	end repeat
	return the_string as Unicode text
end convert_to_lower

on list_to_string(the_list, the_delim)
	tell (a reference to my text item delimiters)
		set {old_tid, contents} to {contents, the_delim}
		set {the_list, contents} to {"" & the_list, old_tid}
	end tell
	return l as Unicode text
end list_to_string

Jon

Thanks i’m gonna try it now! :smiley:

theres one problem - you combined the azlyrics and seeklyrics scripts
but i think i can fix that

ok you just didnt include seeklyrics

it said:
NSReceiverEvaluationScriptError: 4 (1)