Registry / http-networking / pyytlounge

pyytlounge

JSON →
library3.2.0pypypi✓ verified 86d ago

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.

pip install pyytlounge
INSTALL
IMPORT
SIG · PYYTLOUNGE
P
pyytlounge
http-networkingpythonv3.2.0
Install
4.0s avg
Import
644ms
Disk
27MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
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
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.662s · 27.1MB
glibc
py 3.103.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())
Debug
Known issues
breakingIn v3.0.0, the event system changed from subscribe(callback) to EventListener class. Old subscribe() no longer works.
fix
Subclass EventListener and pass instance to set_event_listener(). See migration guide.
affects: <3.0.0
breakingIn v3.2.0, EventListener.disconnected() signature changed: now takes DisconnectedEvent instead of plain self.
fix
Update method signature: async def disconnected(self, event: DisconnectedEvent)
affects: <3.2.0
gotchaPairing code is required; screen device name alone will not work. Use create_credentials(screen_name, code).
fix
Ensure you have a valid pairing code from the YouTube screen (Settings -> Link with TV code).
affects: all
gotchaConnecting to a screen without any video playing may raise an exception or hang. v3.0.1 fixed some cases.
fix
Upgrade to >=3.0.1 and ensure screen has content playing.
affects: <=3.0.0
gotchaPython 3.9+ required. v2.2.1 added 3.9 support, but newer versions require >=3.9.
fix
Upgrade Python to 3.9+ or use pyytlounge 2.2.1.
affects: <2.2.1
Errors
Common errors & fixes
AttributeError: 'YtLoungeApi' object has no attribute 'subscribe'
subscribe() removed in v3.0.0 in favor of EventListener.
fix
Use 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.
fix
Change 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.
fix
Use 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.
fix
Use 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
Agent activity
23 hits · last 30 days
node
20
OpenAI (training)
1
Resources
pyytlounge — pip install pyytlounge · libregistry