| Name | spotify-playlist-exporter JSON |
| Version |
0.0.3
JSON |
| download |
| home_page | |
| Summary | A small example package |
| upload_time | 2023-05-13 05:52:28 |
| maintainer | |
| docs_url | None |
| author | |
| requires_python | >=3.7 |
| license | |
| keywords |
|
| VCS |
 |
| bugtrack_url |
|
| requirements |
No requirements were recorded.
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
No coveralls.
|
# Spotify Playlist Exporter
This Python package allows you to export your Spotify playlists and recently played tracks as an Excel file. It uses the Spotipy library to interact with the Spotify Web API.
## Prerequisites
Before you can use the package, you'll need to install the following Python packages:
- Spotipy
- pandas
You can install them with the following command:
```bash
pip install spotipy pandas openpyxl
```
## Setting up Spotify API credentials
To access the Spotify API, you need to have API credentials in the form of a `client_id`, `client_secret`, and a `redirect_uri`. Here's how you can get your credentials:
1. Go to the Spotify Developer Dashboard: https://developer.spotify.com/dashboard/
2. Log in with your Spotify account or create a new one if you don't have one yet.
3. Click on "Create an App" and fill in the required information.
4. After creating the app, you will see your `client_id` and `client_secret` in the app's Dashboard.
5. Set the `redirect_uri` for your app by clicking "Edit Settings" and adding a redirect URI, such as "http://localhost:9000".
Now that you have your credentials, you can store them in a `cred.py` file in the same directory as the main script. The `cred.py` file should look like this:
```python
client_id = "your_client_id"
client_secret = "your_client_secret"
redirect_uri = "your_redirect_uri"
username = "your_spotify_username"
```
Replace the placeholder values with your actual credentials and Spotify username.
## Package usage
The package contains several functions to interact with your Spotify playlists and recently played tracks. You can use it as a standalone script or import the functions in your own Python project.
### Main function
The `main` function is the entry point of the script. It takes three optional arguments:
- `playlists_file`: The filename prefix for the exported playlists Excel file (default: 'playlists').
- `recently_file`: The filename prefix for the exported recently played tracks Excel file (default: 'recently_played').
- `date_string`: The date string in 'yyyy-mm-dd' format from which to fetch recently played tracks (default: '2023-01-01').
To run the script, you can use the following command:
```bash
python script_name.py --playlistsfile playlists_xx --recentlyfile recently_played_xy --datestring 2023-01-01
```
Replace `script_name.py` with the name of the main script file.
### Exporting playlists
The `export_spotify_playlists` function fetches your playlists and their tracks. It returns a dictionary containing the playlist titles and their respective track lists.
### Exporting recently played tracks
The `recently_played` function fetches the tracks you've recently played, limited to the last 50 tracks. You can pass a Unix timestamp to filter the tracks played after a certain date.
### Saving playlists and recently played tracks as Excel files
The `playlists_to_dataframe` and `recently_played_to_dataframe` functions convert the fetched data into pandas DataFrames, which can be saved as Excel files. By default, the script will save the Excel files with a timestamp in the format "yymmdd_HHMMSS" as a prefix.
## Example usage
Here's an example of how to run the script:
```bash
python script_name.py --playlistsfile my_playlists --recentlyfile my_recently_played --datestring 2023-01-01
```
This command will generate two Excel files with names like "220101_122345_my_playlists.xlsx
Raw data
{
"_id": null,
"home_page": "",
"name": "spotify-playlist-exporter",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "",
"author": "",
"author_email": "Example Author <bebissig@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/3a/35/3c25924f3572f757e8a52ad9f5060e6fd3b7873035deeece72d716b3514a/spotify-playlist-exporter-0.0.3.tar.gz",
"platform": null,
"description": "# Spotify Playlist Exporter\r\n\r\nThis Python package allows you to export your Spotify playlists and recently played tracks as an Excel file. It uses the Spotipy library to interact with the Spotify Web API.\r\n\r\n## Prerequisites\r\n\r\nBefore you can use the package, you'll need to install the following Python packages:\r\n\r\n- Spotipy\r\n- pandas\r\n\r\nYou can install them with the following command:\r\n\r\n```bash\r\npip install spotipy pandas openpyxl\r\n```\r\n\r\n## Setting up Spotify API credentials\r\n\r\nTo access the Spotify API, you need to have API credentials in the form of a `client_id`, `client_secret`, and a `redirect_uri`. Here's how you can get your credentials:\r\n\r\n1. Go to the Spotify Developer Dashboard: https://developer.spotify.com/dashboard/\r\n2. Log in with your Spotify account or create a new one if you don't have one yet.\r\n3. Click on \"Create an App\" and fill in the required information.\r\n4. After creating the app, you will see your `client_id` and `client_secret` in the app's Dashboard.\r\n5. Set the `redirect_uri` for your app by clicking \"Edit Settings\" and adding a redirect URI, such as \"http://localhost:9000\".\r\n\r\nNow that you have your credentials, you can store them in a `cred.py` file in the same directory as the main script. The `cred.py` file should look like this:\r\n\r\n```python\r\nclient_id = \"your_client_id\"\r\nclient_secret = \"your_client_secret\"\r\nredirect_uri = \"your_redirect_uri\"\r\nusername = \"your_spotify_username\"\r\n```\r\n\r\nReplace the placeholder values with your actual credentials and Spotify username.\r\n\r\n## Package usage\r\n\r\nThe package contains several functions to interact with your Spotify playlists and recently played tracks. You can use it as a standalone script or import the functions in your own Python project.\r\n\r\n### Main function\r\n\r\nThe `main` function is the entry point of the script. It takes three optional arguments:\r\n\r\n- `playlists_file`: The filename prefix for the exported playlists Excel file (default: 'playlists').\r\n- `recently_file`: The filename prefix for the exported recently played tracks Excel file (default: 'recently_played').\r\n- `date_string`: The date string in 'yyyy-mm-dd' format from which to fetch recently played tracks (default: '2023-01-01').\r\n\r\nTo run the script, you can use the following command:\r\n\r\n```bash\r\npython script_name.py --playlistsfile playlists_xx --recentlyfile recently_played_xy --datestring 2023-01-01\r\n```\r\n\r\nReplace `script_name.py` with the name of the main script file.\r\n\r\n### Exporting playlists\r\n\r\nThe `export_spotify_playlists` function fetches your playlists and their tracks. It returns a dictionary containing the playlist titles and their respective track lists.\r\n\r\n### Exporting recently played tracks\r\n\r\nThe `recently_played` function fetches the tracks you've recently played, limited to the last 50 tracks. You can pass a Unix timestamp to filter the tracks played after a certain date.\r\n\r\n### Saving playlists and recently played tracks as Excel files\r\n\r\nThe `playlists_to_dataframe` and `recently_played_to_dataframe` functions convert the fetched data into pandas DataFrames, which can be saved as Excel files. By default, the script will save the Excel files with a timestamp in the format \"yymmdd_HHMMSS\" as a prefix.\r\n\r\n## Example usage\r\n\r\nHere's an example of how to run the script:\r\n\r\n```bash\r\npython script_name.py --playlistsfile my_playlists --recentlyfile my_recently_played --datestring 2023-01-01\r\n```\r\n\r\nThis command will generate two Excel files with names like \"220101_122345_my_playlists.xlsx\r\n",
"bugtrack_url": null,
"license": "",
"summary": "A small example package",
"version": "0.0.3",
"project_urls": {
"Homepage": "https://github.com/bebissig/spotify_grab_current_playlists"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a779d8a7e092c6634f190b0a51307566099a1e4a511ef776465ddeff71e14766",
"md5": "6e653f35c8317bbe9c1a5d3a34fe072b",
"sha256": "aace1c0514150a6971089fefdd20b98edad5acd22ad76f24368e692e38e6adc5"
},
"downloads": -1,
"filename": "spotify_playlist_exporter-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6e653f35c8317bbe9c1a5d3a34fe072b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 7480,
"upload_time": "2023-05-13T05:52:23",
"upload_time_iso_8601": "2023-05-13T05:52:23.511502Z",
"url": "https://files.pythonhosted.org/packages/a7/79/d8a7e092c6634f190b0a51307566099a1e4a511ef776465ddeff71e14766/spotify_playlist_exporter-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3a353c25924f3572f757e8a52ad9f5060e6fd3b7873035deeece72d716b3514a",
"md5": "be60d4acf8441a9661258a8020d7a389",
"sha256": "1bce66557c9bbafdc1865fc2c20e208ec143722fa41252019d2b84e4a3d32c1b"
},
"downloads": -1,
"filename": "spotify-playlist-exporter-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "be60d4acf8441a9661258a8020d7a389",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 6286,
"upload_time": "2023-05-13T05:52:28",
"upload_time_iso_8601": "2023-05-13T05:52:28.558175Z",
"url": "https://files.pythonhosted.org/packages/3a/35/3c25924f3572f757e8a52ad9f5060e6fd3b7873035deeece72d716b3514a/spotify-playlist-exporter-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-13 05:52:28",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "bebissig",
"github_project": "spotify_grab_current_playlists",
"github_not_found": true,
"lcname": "spotify-playlist-exporter"
}