removed duplication of code

created a function that handles fetching of thumbnail and iframe for
sites