{"id":24487,"library":"pyytlounge","title":"PyYTLounge","description":"A Python wrapper for the YouTube Lounge API, enabling remote control of YouTube on connected screens (e.g., TV, Chromecast). Current version 3.2.0, requires Python >=3.9. Released on GitHub with active maintenance, roughly monthly release cadence.","status":"active","version":"3.2.0","language":"python","source_language":"en","source_url":"https://github.com/FabioGNR/pyytlounge","tags":["youtube","lounge","api","remote-control","async"],"install":[{"cmd":"pip install pyytlounge","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Async HTTP requests for lounge API","package":"aiohttp","optional":false}],"imports":[{"note":"Incorrect submodule path; common mistake from older versions.","wrong":"from pyytlounge.api import YtLoungeApi","symbol":"YtLoungeApi","correct":"from pyytlounge import YtLoungeApi"},{"note":"Listener base class for v3.x event system.","symbol":"EventListener","correct":"from pyytlounge import EventListener"},{"note":"Event object for disconnected callback.","symbol":"DisconnectedEvent","correct":"from pyytlounge import DisconnectedEvent"},{"note":"create_credentials is top-level, not under api.","wrong":"from pyytlounge.api import create_credentials","symbol":"create_credentials","correct":"from pyytlounge import create_credentials"}],"quickstart":{"code":"import asyncio\nfrom pyytlounge import YtLoungeApi, create_credentials, EventListener\n\nclass MyListener(EventListener):\n    async def disconnected(self, event):\n        print(f\"Disconnected: {event.reason}\")\n\nasync def main():\n    credentials = create_credentials(\"YOUR_SCREEN_NAME\", \"YOUR_PAIRING_CODE\")\n    api = YtLoungeApi(credentials)\n    api.set_event_listener(MyListener())\n    await api.connect()\n    await api.play_video(\"dQw4w9WgXcQ\")\n    await asyncio.sleep(10)\n    await api.disconnect()\n\nasyncio.run(main())","lang":"python","description":"Basic example of connecting to a YouTube screen and playing a video."},"warnings":[{"fix":"Subclass EventListener and pass instance to set_event_listener(). See migration guide.","message":"In v3.0.0, the event system changed from subscribe(callback) to EventListener class. Old subscribe() no longer works.","severity":"breaking","affected_versions":"<3.0.0"},{"fix":"Update method signature: async def disconnected(self, event: DisconnectedEvent)","message":"In v3.2.0, EventListener.disconnected() signature changed: now takes DisconnectedEvent instead of plain self.","severity":"breaking","affected_versions":"<3.2.0"},{"fix":"Ensure you have a valid pairing code from the YouTube screen (Settings -> Link with TV code).","message":"Pairing code is required; screen device name alone will not work. Use create_credentials(screen_name, code).","severity":"gotcha","affected_versions":"all"},{"fix":"Upgrade to >=3.0.1 and ensure screen has content playing.","message":"Connecting to a screen without any video playing may raise an exception or hang. v3.0.1 fixed some cases.","severity":"gotcha","affected_versions":"<=3.0.0"},{"fix":"Upgrade Python to 3.9+ or use pyytlounge 2.2.1.","message":"Python 3.9+ required. v2.2.1 added 3.9 support, but newer versions require >=3.9.","severity":"gotcha","affected_versions":"<2.2.1"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use api.set_event_listener(YourListener()) instead of api.subscribe(callback).","cause":"subscribe() removed in v3.0.0 in favor of EventListener.","error":"AttributeError: 'YtLoungeApi' object has no attribute 'subscribe'"},{"fix":"Change method to async def disconnected(self, event: DisconnectedEvent).","cause":"disconnected() signature changed in v3.2.0; now expects a DisconnectedEvent argument.","error":"TypeError: disconnected() takes 1 positional argument but 2 were given"},{"fix":"Use from pyytlounge import YtLoungeApi (not pyytlounge.api).","cause":"User tries to import from submodule that doesn't exist at top level.","error":"ModuleNotFoundError: No module named 'pyytlounge.api'"},{"fix":"Use a standard YouTube screen (not Kids mode).","cause":"The screen is using YouTube TV Kids, which is not supported.","error":"pyytlounge.exceptions.NotSupportedException: YouTube TV Kids not supported"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}