I managed to turn my kodi box into a DYI chromecast by autoretrieving the m3u8 stream URL from any website and using kodi's jsonrpc interface to play it.
A simple bash script using curl can do this. I even managed to perfect the UX when casting on android by calling a script from termux. That script can be set as launcher shortcut so it's literally 1-click to cast to kodi.