Refactor YouTube data API v3 handling code.

1. Add some extra asserts checking the content types returned by YouTube.
2. Move XHR handling code into one common function. This should make it
   easier to implement consistent timeout handling

Signed-off-by: Peter Tworek <tworaz666@gmail.com>