in reply to Script needs major optimizing.
Have you tried caching the video information from http://www.domain.org/facebookvideos/ instead of re-fetching the information every time?