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