Install & Compatibility
Where this runs
tested against v3.2.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.662s · 27.1MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 4.0s · import 0.626s · 29MB
27MB installed
● package 27MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
YtLoungeApi
✓ from pyytlounge import YtLoungeApi
✗ from pyytlounge.api import YtLoungeApi
Incorrect submodule path; common mistake from older versions.
EventListener
✓ from pyytlounge import EventListener
Listener base class for v3.x event system.
DisconnectedEvent
✓ from pyytlounge import DisconnectedEvent
Event object for disconnected callback.
create_credentials
✓ from pyytlounge import create_credentials
✗ from pyytlounge.api import create_credentials
create_credentials is top-level, not under api.
Basic example of connecting to a YouTube screen and playing a video.
import asyncio
from pyytlounge import YtLoungeApi, create_credentials, EventListener
class MyListener(EventListener):
async def disconnected(self, event):
print(f"Disconnected: {event.reason}")
async def main():
credentials = create_credentials("YOUR_SCREEN_NAME", "YOUR_PAIRING_CODE")
api = YtLoungeApi(credentials)
api.set_event_listener(MyListener())
await api.connect()
await api.play_video("dQw4w9WgXcQ")
await asyncio.sleep(10)
await api.disconnect()
asyncio.run(main())
Errors
Common errors & fixes
AttributeError: 'YtLoungeApi' object has no attribute 'subscribe'
subscribe() removed in v3.0.0 in favor of EventListener.
fixUse api.set_event_listener(YourListener()) instead of api.subscribe(callback).
TypeError: disconnected() takes 1 positional argument but 2 were given
disconnected() signature changed in v3.2.0; now expects a DisconnectedEvent argument.
fixChange method to async def disconnected(self, event: DisconnectedEvent).
ModuleNotFoundError: No module named 'pyytlounge.api'
User tries to import from submodule that doesn't exist at top level.
fixUse from pyytlounge import YtLoungeApi (not pyytlounge.api).
pyytlounge.exceptions.NotSupportedException: YouTube TV Kids not supported
The screen is using YouTube TV Kids, which is not supported.
fixUse a standard YouTube screen (not Kids mode).
Upgrade
Version history
3.2.0latest on PyPI · released Apr 17, 2025
Audit
Dependencies
aiohttprequiredAsync HTTP requests for lounge API