Some help with text

I want to know how to get coloured text from a web page?
I want to get all the blue coloured text from http://www.youtube.com/view_play_list?p=ACB3F68EDDCCE3BA

I tried the red color script from here(http://macscripter.net/viewtopic.php?id=28875), but it did not work for me.

OR

just point me to some simple article which involves extracting text from a web page based on color, font and size

I just found that actually, there was a missing post after post#4 in this thread (which had the solution): http://macscripter.net/viewtopic.php?id=28875

However, with some trial and error, I was able to come up with a solution:

set thelist to {}
set thelist2 to {}
tell application "Safari"
	
	set C to color of paragraph of text of document 1
	set thecount to the count of C
	repeat with i from 1 to thecount
		set aitem to item i of C
		set aitem to aitem as text
		if aitem is "01416852274" then set end of thelist to i
	end repeat
	repeat with aitem in thelist
		set x to paragraph aitem of text of document 1
		set end of thelist2 to x
	end repeat
end tell
thelist2

It took me quite some time to find out that blue color is “01416852274”. Is there a faster way to find the value of a color in the web page?

It looks like you are wanting to get the titles. Is this correct?

If so, using JavaScript is a more accurate way to target items in a webpage.


set js to "var divItems = document.getElementsByClassName('video-long-title');

var titles = new Array();
for (var i=0; i < divItems.length; i++) {
	titles.push(divItems[i].childNodes[3].getAttribute('title'));
};

titles;"

tell application "Safari"
	activate
	set titles to do JavaScript js in document 1
end tell

Thanks, Craig. Thats an elegant solution.

Can javascript also get text based on the background color of text?
For example, I want all the text on this page which is in yellow background. (yes, i want the lyrics :()
http://lyricwiki.org/Backstreet_Boys:Don't_Wanna_Lose_You_Now