{"id":13520204,"url":"https://github.com/SwagLyrics/SwSpotify","last_synced_at":"2025-03-31T16:30:52.403Z","repository":{"id":37381856,"uuid":"184220943","full_name":"SwagLyrics/SwSpotify","owner":"SwagLyrics","description":"Cross-platform library to get the currently playing song and artist from Spotify w/o using the API or the internet. Very fast.","archived":false,"fork":false,"pushed_at":"2023-01-10T11:07:17.000Z","size":335,"stargazers_count":85,"open_issues_count":10,"forks_count":9,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-03-24T02:03:01.631Z","etag":null,"topics":["blazingly-fast","cross-platform","spotify","swaglyrics"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SwagLyrics.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-30T08:17:00.000Z","updated_at":"2024-02-21T13:54:20.000Z","dependencies_parsed_at":"2023-02-08T18:31:31.986Z","dependency_job_id":null,"html_url":"https://github.com/SwagLyrics/SwSpotify","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwagLyrics%2FSwSpotify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwagLyrics%2FSwSpotify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwagLyrics%2FSwSpotify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwagLyrics%2FSwSpotify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SwagLyrics","download_url":"https://codeload.github.com/SwagLyrics/SwSpotify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222670691,"owners_count":17020513,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blazingly-fast","cross-platform","spotify","swaglyrics"],"created_at":"2024-08-01T05:02:13.991Z","updated_at":"2024-11-02T03:30:32.035Z","avatar_url":"https://github.com/SwagLyrics.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# SwSpotify\n\n[![Discord Server](https://badgen.net/badge/discord/join%20chat/7289DA?icon=discord)](https://discord.gg/DSUZGK4)\n[![Test](https://github.com/SwagLyrics/SwSpotify/actions/workflows/tests.yml/badge.svg)](https://github.com/SwagLyrics/SwSpotify/actions/workflows/tests.yml)\n[![codecov](https://codecov.io/gh/SwagLyrics/SwSpotify/branch/master/graph/badge.svg)](https://codecov.io/gh/SwagLyrics/SwSpotify)\n![PyPI](https://img.shields.io/pypi/v/swspotify.svg)\n[![Downloads](https://pepy.tech/badge/swspotify)](https://pepy.tech/project/swspotify)\n\nSwSpotify is a Python library to get the song and artist of the currently playing song from the Spotify application faster and without using the API. It works on Windows, Linux, macOS and even the Spotify Web Player! 🥳\n\nIn order to add support for the Spotify Web Player, the [SwagLyrics Chrome Extension](https://chrome.google.com/webstore/detail/swaglyrics-for-spotify/miopldoofdhmipepmnclnoangcdffmlk) needs to be installed. We have plans to extend this for other browsers as well.\n\nIf you're a developer using SwSpotify, you can direct your end users to install the extension to automatically make your application work with the Spotify Web Player. The source of the Chrome Extension is open sourced at https://github.com/SwagLyrics/SwagLyrics-Chrome-Extension.\n\nThe original repository was [spotilib](https://github.com/XanderMJ/spotilib) which worked just for Windows and hasn't been updated since a long while when it broke on account of Spotify updating their application.\n\nOriginally made for use in [SwagLyrics for Spotify](https://github.com/SwagLyrics/SwagLyrics-For-Spotify).\n\n## Installation\n\nRequires Python3. Use pip or pip3 depending on your installation. You might want to use the `--user` flag on Linux to\navoid using pip as root.\n\n```shell\npip install SwSpotify\n```\n\nFor linux you need `dbus` which is usually pre-installed.\n\n## Usage\n\nUse it in your project by importing it as:\n\n```py\nfrom SwSpotify import spotify\n```\n\nThen you can access the song and artist as:\n\n```py\n\u003e\u003e\u003e spotify.song()\n'Hello'\n\u003e\u003e\u003e spotify.artist()\n'Adele'\n```\n\nSince mostly song and artist are used in conjunction, there is a `current()` method as well.\n\n```py\n\u003e\u003e\u003e spotify.current()\n('Hello', 'Adele')\n```\n\nThis allows you to access song and artist by tuple unpacking as:\n\n```py\n\u003e\u003e\u003e song, artist = spotify.current()\n```\n\nA `SpotifyNotRunning` Exception is raised if Spotify is closed or paused. `SpotifyClosed` and `SpotifyPaused` inherit from `SpotifyNotRunning`, meaning that you can catch both at the same time:\n\n```py\ntry:\n    title, artist = spotify.current()\nexcept SpotifyNotRunning as e:\n    print(e)\nelse:\n    print(f\"{title} - {artist}\")\n```\n\nIn case Spotify is closed or paused, that will automatically be reflected in the value of `e`.\n\nFor finer control you can catch `SpotifyClosed` and `SpotifyPaused` separately.\n\n## Compiling SwSpotify for Development\n\n- Clone the repo by `git clone https://github.com/SwagLyrics/SwSpotify.git` or use ssh.\n- `cd` into the cloned repo.\n- `pip install -e .` the -e flag installs it locally in editable mode.\n\n## Contributing\n\nSure, improvements/fixes/issues everything is welcome :)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSwagLyrics%2FSwSpotify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSwagLyrics%2FSwSpotify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSwagLyrics%2FSwSpotify/lists"}