{"id":16572548,"url":"https://github.com/davidski/spotify-lambda","last_synced_at":"2025-03-04T18:31:42.451Z","repository":{"id":23351358,"uuid":"98770352","full_name":"davidski/spotify-lambda","owner":"davidski","description":"λ🎵AWS Lambda functions for Spotify tracking","archived":false,"fork":false,"pushed_at":"2023-07-25T22:07:06.000Z","size":62,"stargazers_count":16,"open_issues_count":2,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-18T02:42:04.247Z","etag":null,"topics":["aws","lambda","spotify"],"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/davidski.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-30T02:31:44.000Z","updated_at":"2024-03-05T09:45:32.000Z","dependencies_parsed_at":"2023-02-17T03:16:10.776Z","dependency_job_id":null,"html_url":"https://github.com/davidski/spotify-lambda","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/davidski%2Fspotify-lambda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidski%2Fspotify-lambda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidski%2Fspotify-lambda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidski%2Fspotify-lambda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidski","download_url":"https://codeload.github.com/davidski/spotify-lambda/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241899470,"owners_count":20039303,"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":["aws","lambda","spotify"],"created_at":"2024-10-11T21:27:55.257Z","updated_at":"2025-03-04T18:31:42.105Z","avatar_url":"https://github.com/davidski.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Spotify-History\n================\n\n**NOTE**\n\u003e I no longer use Spotify due to their support for [blatant, socially-harmfull, misinformation](https://www.nytimes.com/2022/01/31/technology/joe-rogan-spotify-controversy.html). \n\u003e This project is in hibernation mode as of February 2022 and is not likely to receive further updates.\n\nPython based AWS Lambda function for building an offline list of played \ntracks from Spotify.\n\nWhen triggered, this function polls the Spotify API for all tracks played \non the current date. As the Spotify API returns no more than 50 tracks, \nthis function is intended to be ran several times a day. It first looks for an \nexisting day's history file in S3. Any found history file is merged with the \nresults from the API, using the `played_at` key to deduplicate.\n\nExpected Environment Variables\n------------------------------\n\n+ SPOTIFY_BUCKET_NAME - Name of S3 bucket to store data and token files.\n+ SPOTIFY_BUCKET_KEY - Optional key under which to store data and token files. Must not have a leading slash.\n+ SPOTIFY_CLIENT_ID - Application OAuth client ID.\n+ SPOTIFY_CLIENT_NAME - Application OAuth client secret.\n\nDeployment\n----------\n\nThe included [Makefile](./Makefile) will build a ZIP file which can be \ndeployed to AWS Lambda. This ZIP file will include all dependencies.\n\nThe Spotify API uses OAuth authentication. The initial setup of tokens \nrequires user interaction to authorize this application. To carry out first \ntime setup, run the `authorize.py` script in an interactive window. This will \nprompt the user to visit a Spotify URL and authorize the application. Upon \nauthorization, the user's browser will be redirected to a non-resolving URL. \nCopy that full URL and paste into the python console. The `authorize.py` script \nwill take that response URL, obtain a OAuth token from Spotify, and save it in a \n`token.json` file in the S3 bucket configured in the environment variables. Future \nruns of the `main.py` process do not require authorization as long as the function \ncan auto-renew the token. If this function is run at least every 12 hours, that \nshould not be a problem (renew token lengths are approximately 15 hours).\n\nContributing\n============\n\nThis project is governed by a [Code of Conduct](./CODE_OF_CONDUCT.md). By \nparticipating in this project you agree to abide by these terms.\n\nLicense\n=======\n\nThe [MIT License](LICENSE) applies.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidski%2Fspotify-lambda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidski%2Fspotify-lambda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidski%2Fspotify-lambda/lists"}