I've been using something similar, it's a chrome extension made to stop you from getting distracted called Motion (
https://inmotion.app). You list websites you find distracting, whenever you open one motion asks you how much time you need and closes the tab after the time's up.