{"id":13607542,"url":"https://github.com/BelkaDev/Spotify-Headless","last_synced_at":"2025-04-12T11:32:57.684Z","repository":{"id":55408986,"uuid":"277932485","full_name":"BelkaDev/Spotify-Headless","owner":"BelkaDev","description":"Experimental wrapper for Spotify API to search songs and control the web player using the cli (Feat. Puppeteer)","archived":false,"fork":false,"pushed_at":"2021-07-30T07:09:30.000Z","size":1473,"stargazers_count":100,"open_issues_count":2,"forks_count":7,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-08-01T19:45:07.679Z","etag":null,"topics":["cli","puppeteer","spotify"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BelkaDev.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":"2020-07-07T22:10:47.000Z","updated_at":"2024-07-17T23:35:36.000Z","dependencies_parsed_at":"2022-08-14T23:40:50.020Z","dependency_job_id":null,"html_url":"https://github.com/BelkaDev/Spotify-Headless","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BelkaDev%2FSpotify-Headless","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BelkaDev%2FSpotify-Headless/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BelkaDev%2FSpotify-Headless/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BelkaDev%2FSpotify-Headless/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BelkaDev","download_url":"https://codeload.github.com/BelkaDev/Spotify-Headless/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223514438,"owners_count":17158190,"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":["cli","puppeteer","spotify"],"created_at":"2024-08-01T19:01:19.525Z","updated_at":"2024-11-07T12:32:39.672Z","avatar_url":"https://github.com/BelkaDev.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"## Spotify-Headless\nA CLI tool using [puppeteer](https://github.com/puppeteer/puppeteer) to intercept your own validated spotify OAuth token alongside of the session cookies, then reinject them to mimic an authorized, user-like traffic.\n#### How it works\n1. Establish a session by authenticating to Spotify within a headless browser. (Puppeteer)\n2. Export the session cookies and store them locally, specifically the refresh token that will refresh the JWT every time it expires. (valid for one year)\n3. The access token allows you to perform special actions on behalf of a user.\n\n#### Installation and configuration\n```bash\ngit clone https://github.com/BelkaDev/Spotify-Headless ~/Spotify-Headless\ncd ~/Spotify-Headless \u0026\u0026 npm install\n```\nTo provide your credentials you need to set them as environement variables within your bashrc (or your default shell rc) \u003cbr\u003e\n``` bash\nexport SPOTIFY_USER=\"\"\nexport SPOTIFY_PWD=\"\"\n```\n#### Running\nManually grab your access token: `node token.js` \u003cbr\u003e\nOther commands are found under `/lib` folder, they are examples of commands from the API with extra features (search, play/resume etc..)\n\n#### Use case\nThe sole purpose is to combine aliases into automated and complex tasks, this can offer a lot of flexibility as shown below:\n###### \u003cu\u003e example 1 (Basic):  \u003c/u\u003e: Browse Spotify catalog, filter items, feed STDOUT to queue.\n![example 1](static/basic.png)\n###### \u003cu\u003e example 2 (Advanced) \u003c/u\u003e: Store to a local playlist, shuffle songs, set a timer, transfer ongoing stream to your mobile device.\n![example 2](static/advanced.png)\n###### \u003cu\u003e example 3 (Expert):  \u003c/u\u003e: Convert Youtube playlist to a Spotify playlist.\n![example 1](static/expert.png)\n\n\n#### Notes:\n* `play.js` reads input from stdin only, it works in pair with the search command.\n* `transfer.js` takes `phone/mobile`,`computer/pc`,`browser` as parameters, if the suggested device isn't opened, it sends the signal to the actual active device.\n* `search.js` will lookup for tracks by default, unlike other items (albums,playlists etc..), tracks can be stacked and enqueued at once, more details [here](https://developer.spotify.com/documentation/web-api/reference/player/start-a-users-playback/). It takes `album`,`artist`,`playlist` as arguments.\n* snippets used in the examples can be found [here](https://github.com/BelkaDev/dotfiles/blob/master/.zshrc)\n \n#### Todo:\n* Allow creating online playlists.\n* Refactor/clean code\n* \u003cstrike\u003e Catch random/annoying error messages. \u003c/strike\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBelkaDev%2FSpotify-Headless","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FBelkaDev%2FSpotify-Headless","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBelkaDev%2FSpotify-Headless/lists"}