Xbox turns on then off immediately

So I had got this Xbox one s from a friend which I got a large discount off because he told me it had some power problems but it was still working. I got it and everything was going good until I went over a cousin house and I brought my Xbox, when I tried plugging it in and turning it on it was turning on then off instantly and I could hear like a little noise when I turned it on which was odd because I never heard it. It was like a little pop noise. But then like I waited for a few hours and it turned on! So this was almost two months ago now a few weeks ago I tried turning on my Xbox to listen to music and it was doing the same thing so I thought since my Xbox turned on after a few hours over my cousin house it was going to do the same but it did not, and it’s been weeks since my Xbox has been able to turn on. I tried going in it and just cleaning it and maybe that was the reason but it wasn’t and I hear this like vibrating noise in the power supply i don’t know if that’s a common occurrence or not but I just really don’t know what’s wrong with it, anyone have any idea what could be happening because I don’t know. Everytime I try turning on the light comes on for probably two seconds and turns off . I been looking everywhere for help. Any type of advice would be helpful!

Mate, did you get it fixed? My xbox one s is doing exactly the same as your description. Sometimes it turns on and I could play for many hours with no issues… I could also hear a noise from where the power supply is located whenever i turn on the console.