in reply to recursively extracting links from yahoo, when to stop?

There's several options. You can stop after
  • recursing N number of levels
  • N links are extracted
  • N amount of time
  • when you're extracting from a site that's not Yahoo.

    or anything else you can imagine. It's your call, really.