text item delimeters help

I’m using curl to grab some html code and then parsing it using text item delimeters. I’m parsing this line:

<img id="ctl00_mainContent_identityStrip_imgRank" title="Major, Grade 2" src="/images/halo3stats/xp/6fb070f4-7aa1-48dd-8bb2-631a9c4c3af5.gif" alt="Major, Grade 2" style="border-width:0px;" />

to try and get this by itself: /images/halo3stats/xp/6fb070f4-7aa1-48dd-8bb2-631a9c4c3af5.gif
However the thing after title (Major Grade 2) will be different depending on the profile so it cud be commander, or captain grade 3 so I can’t figure out how to parse it to get just that image url by itself :confused:

Hi,

try this


set t to "<img id=\"ctl00_mainContent_identityStrip_imgRank\" title=\"Major, Grade 2\" src=\"/images/halo3stats/xp/6fb070f4-7aa1-48dd-8bb2-631a9c4c3af5.gif\" alt=\"Major, Grade 2\" style=\"border-width:0px;\" />"

set {TID, text item delimiters} to {text item delimiters, "ctl00"}
set t to text item 2 of t
set text item delimiters to "src=\""
set t to text item 2 of t
set text item delimiters to quote
set t to text item 1 of t
set text item delimiters to TID
t

works, thanks :smiley:

I don’t know exactly what you’re doing with this.

Alternatively:

do shell script "curl 'http://www.bungie.net/stats/halo3/CareerStats.aspx?player=AceHENDO13' | grep --only-matching 'src=\"/images/halo3stats/xp/[^\"]\\+\"' | cut -d \\\" -f 2"
--> "/images/halo3stats/xp/548dd583-e0f2-4a7c-a506-e84671b1d4ee.gif"

.or


do shell script "/usr/bin/curl 'http://www.bungie.net/stats/halo3/CareerStats.aspx?player=AceHENDO13' | grep 'identityStrip_hypRank' | cut -d '\"' -f 12"

:wink:

It’s being used to download an image of a website