if the cooling is fine when it starts working than its not a compressor issue.
When A/C stops working open the mouth of car and see if the the condensor fan is running or not.
2- When A/C stops working try to touch the condensor or return pipe see how hot it is. Normaly its not too hot to touch.
3 - When A/C isnt working see the little glass on Filter bottle do u see any bubles or clear gas.
4 - Check if the wire goin into compressor is properly installed.
If none of above i feel this can be chocked filter/ expansion valve or whole system needs to be flush and serviced 