How to use Python to play a Youtube video on Kodi?
Play a Youtube video on Kodi, by sending a JSON-RPC request with Python.
pip install requests jsonrpcclient
import requests
from jsonrpcclient import request
params = {"file": "plugin://plugin.video.youtube/?action=play_video&videoid=QwSazmPRfaI"}
requests.post("http://kodi:8080/jsonrpc", json=request("Player.Open", params=params))
Change the videoid
to your video.