Skip to main content

A Python SDK for interacting with the YouTube Music Desktop App.

Project description

Youtube Music Desktop SDK

Simple SDK for controlling Youtube Music Desktop App.

Installation

pip install ytmd-sdk

Example

from YTMDSDK import Events, YTMD, Parser
from time import sleep

ytmd = YTMD("touchportalytmd", "TouchPortalYTMD", "1.0.0")

key = ytmd.authenticate() # get token key and sets it at same time
# ytmd.update_token("token") # if you already have a token key you can set it like this

def on_connect():
    print("Connected to YTMD")

def on_disconnect():
    print("Disconnected from YTMD")

def on_error(data):
    print("Error from YTMD: " + data)

def on_state_update(data):
    parser = Parser(data)
    print("Player: " + str(parser.player_state))
    print("Player State: " + parser.player_state.state)
    print("Player video progress: " + str(parser.player_state.video_progress))
    print("Player volume: " + str(parser.player_state.volume))
    print("Player muted: " + str(parser.player_state.muted))
    print("Player ad playing: " + str(parser.player_state.adPlaying))
    print("Player auto play: " + str(parser.player_state.auto_play))
    print("Player is generating: " + str(parser.player_state.isGenerating))
    print("Player is infinite: " + str(parser.player_state.isInfinite))
    print("Player repeat mode: " + parser.player_state.repeatMode)
    print("Player selected item index: " + str(parser.player_state.selectedItemIndex))
    print("Player queue: " + str(parser.player_state.queue))

ytmd.register_event(Events.connect, on_connect)
ytmd.register_event(Events.disconnect, on_disconnect)
ytmd.register_event(Events.error, on_error)
ytmd.register_event(Events.state_update, on_state_update)

ytmd.connect()
sleep(60)

Change Log

- 1.0.0: Initial release

Bugs and Suggestions

If you have any bugs or suggestions, feel free to open an issue or a pull request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ytmd_sdk-1.0.1.tar.gz (20.8 kB view details)

Uploaded Source

Built Distribution

ytmd_sdk-1.0.1-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

Details for the file ytmd_sdk-1.0.1.tar.gz.

File metadata

  • Download URL: ytmd_sdk-1.0.1.tar.gz
  • Upload date:
  • Size: 20.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for ytmd_sdk-1.0.1.tar.gz
Algorithm Hash digest
SHA256 20f3da034557d12fbf4b789472940ada7c9a04ab6d52dc63f6310c723811370a
MD5 0f9623a5af2fdd7316ce5fe6d7fc7350
BLAKE2b-256 3f9434bacaca669fa96ed2583529fe53c093b2323127e4c1e377dad0a030ef2a

See more details on using hashes here.

File details

Details for the file ytmd_sdk-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: ytmd_sdk-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 20.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for ytmd_sdk-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 26d05544aa0545096bcf80ae2e22c991305de689ca897b6f1615584f46ea88ca
MD5 0a3f1c8e5e86fdcbff606f09ef91c254
BLAKE2b-256 46c0bd44b69903220738d2a010b06760ace05eba66b3bdc4be119e167fd00510

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page