divnostyle := pos('
',s); divstyle := pos('
'); URL := Trim(Str_CIGetBetween(s, 'href="', '"')); end else if ((divstyle > -1) AND ((divstyle < divnostyle) OR (divnostyle = 0))) then begin s :=Str_CIGetAfter(s,'
'); URL := Trim(Str_CIGetBetween(s, 'href="', '"')); end; This is your code with one change: The OR statements had to be = 0 rather than = -1 which your original code had. I was getting 5-6 results but it seemed to STOP after the final divstyle was found. When setting to = 0, it found them all. That was frustrating the heck out of me since we originally worked on it.