Can power be taken from a socket for a light?

Yes, a light bulb does precisely this.

Also, at one time you could purchase a little device that looked like the bottom part of a light bulb with an electrical socket in the other end so you could screw it into a light socket and then plug some other kind of device into it. I don't know if these are still made or not.