spotapi


Namespotapi JSON
Version 1.1.3 PyPI version JSON
download
home_pageNone
SummaryA sleek API wrapper for Spotify's private API
upload_time2024-12-15 17:58:57
maintainerNone
docs_urlNone
authorAran
requires_pythonNone
licenseNone
keywords spotify api spotify api spotify private api follow like creator music music api streaming music data track playlist album artist music search music metadata spotapi python spotify wrapper music automation web scraping python music api spotify integration spotify playlist spotify tracks
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Legal Notice

> **Disclaimer**: This repository and any associated code are provided "as is" without warranty of any kind, either expressed or implied. The author of this repository does not accept any responsibility for the use or misuse of this repository or its contents. The author does not endorse any actions or consequences arising from the use of this repository. Any copies, forks, or re-uploads made by other users are not the responsibility of the author. The repository is solely intended as a Proof Of Concept for educational purposes regarding the use of a service's private API. By using this repository, you acknowledge that the author makes no claims about the accuracy, legality, or safety of the code and accepts no liability for any issues that may arise. More information can be found [HERE](./LEGAL_NOTICE.md).

# SpotAPI

Welcome to SpotAPI! This Python library is designed to interact with the private and public Spotify APIs, emulating the requests typically made through a web browser. This wrapper provides a convenient way to access Spotify’s rich set of features programmatically.

**Note**: This project is intended solely for educational purposes and should be used responsibly. Accessing private endpoints and scraping data without proper authorization may violate Spotify's terms of service.

## Table of Contents

1. [Introduction](#spotapi)
2. [Features](#features)
3. [Docs](#docs)
4. [Installation](#installation)
5. [Quick Examples](#quick-examples)
6. [Import Cookies](#import-cookies)
7. [Contributing](#contributing)
8. [Roadmap](#roadmap)
9. [License](#license)


## Features
- **No Premium Required**: Unlike the Web API which requires Spotify Premium, **SpotAPI** requires no Spotify Premium at all!
- **Public API Access**: Retrieve and manipulate public Spotify data such as playlists, albums, and tracks with ease.
- **Private API Access**: Explore private Spotify endpoints to tailor your application to your needs.
- **Ready to Use**: **SpotAPI** is designed for immediate integration, allowing you to accomplish tasks with just a few lines of code.
- **No API Key Required**: Seamlessly use **SpotAPI** without needing a Spotify API key. It’s straightforward and hassle free!
- **Browser-like Requests**: Accurately replicate the HTTP requests Spotify makes in the browser, providing a true to web experience while remaining undetected.

Everything you can do with Spotify, **SpotAPI** can do with just a user’s login credentials.


## Docs
- [**Artist.py**](./docs/artist.md)
- [**Album.py**](./docs/album.md)
- [**Creator.py**](./docs/creator.md)
- [**Family.py**](./docs/family.md)
- [**Login.py**](./docs/login.md)
- [**Password.py**](./docs/password.md)
- [**Player.py**](./docs/player.md)
- [**Song.py**](./docs/song.md)
- [**Playlist.py**](./docs/playlist.md)
- [**Status.py**](./docs/status.md)
- [**User.py**](./docs/user.md)


## Installation
```
pip install spotapi
```

## Quick Examples

### With User Authentication
```py
from spotapi import (
    Login, 
    Config, 
    NoopLogger, 
    solver_clients, 
    PrivatePlaylist, 
    MongoSaver
)

cfg = Config(
    solver=solver_clients.Capsolver("YOUR_API_KEY", proxy="YOUR_PROXY"), # Proxy is optional
    logger=NoopLogger(),
    # You can add a proxy by passing a custom TLSClient
)

instance = Login(cfg, "YOUR_PASSWORD", email="YOUR_EMAIL")
# Now we have a valid Login instance to pass around
instance.login()

# Do whatever you want now
playlist = PrivatePlaylist(instance)
playlist.create_playlist("SpotAPI Showcase!")

# Save the session
instance.save(MongoSaver())
```

### Without User Authentication
```py
"""Here's the example from spotipy https://github.com/spotipy-dev/spotipy?tab=readme-ov-file#quick-start"""
from spotapi import Song

song = Song()
gen = song.paginate_songs("weezer")

# Paginates 100 songs at a time till there's no more
for batch in gen:
    for idx, item in enumerate(batch):
        print(idx, item['item']['data']['name'])
    
# ^ ONLY 6 LINES OF CODE

# Alternatively, you can query a specfic amount
songs = song.query_songs("weezer", limit=20)
data = songs["data"]["searchV2"]["tracksV2"]["items"]
for idx, item in enumerate(data):
    print(idx, item['item']['data']['name'])
```
### Results
```
0 Island In The Sun
1 Say It Ain't So
2 Buddy Holly
.
.
.
18 Holiday
19 We Are All On d***s
```

## Import Cookies
If you prefer not to use a third party CAPTCHA solver, you can import cookies to manage your session.

### Steps to Import Cookies:

1. **Choose a Session Saver**:
   - Select a session saver for storing your session data. 
   - For simplicity, you should use `JSONSaver`, especially if performance or quantity of sessions is not a big concern.

2. **Prepare Session Data**:
   - Create an object with the following keys:
     - **`identifier`**: This should be your email address or username.
     - **`cookies`**: These are the cookies you obtain when logged in. To get these cookies, visit [Spotify](https://open.spotify.com/), log in, and copy the cookies from your browser.
       - It can be a dict[str, str] or a string representation

3. **Load the Session**:
   - Use `Login.from_saver` (or your own implementation) to load the session from cache. This will enable you to use Spotify with a fully functional session without needing additional **CAPTCHA solving**.

## Contributing
Contributions are welcome! If you find any issues or have suggestions, please open an issue or submit a pull request.

## Roadmap
> I'll most likely do these if the project gains some traction

- [ ] No Captcha For Login (**100 Stars**)
- [x] In Depth Documentation
- [x] Websocket Listener
- [x] Player
- [ ] More wrappers around this project

## License
This project is licensed under the **GPL 3.0** License. See [LICENSE](https://choosealicense.com/licenses/gpl-3.0/) for details.




            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "spotapi",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "Spotify, API, Spotify API, Spotify Private API, Follow, Like, Creator, Music, Music API, Streaming, Music Data, Track, Playlist, Album, Artist, Music Search, Music Metadata, SpotAPI, Python Spotify Wrapper, Music Automation, Web Scraping, Python Music API, Spotify Integration, Spotify Playlist, Spotify Tracks",
    "author": "Aran",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/b2/0d/d1f70a2b17b90bff95f295b0ff154cf14c08571141ceffdc8dcb8003ad2f/spotapi-1.1.3.tar.gz",
    "platform": null,
    "description": "# Legal Notice\n\n> **Disclaimer**: This repository and any associated code are provided \"as is\" without warranty of any kind, either expressed or implied. The author of this repository does not accept any responsibility for the use or misuse of this repository or its contents. The author does not endorse any actions or consequences arising from the use of this repository. Any copies, forks, or re-uploads made by other users are not the responsibility of the author. The repository is solely intended as a Proof Of Concept for educational purposes regarding the use of a service's private API. By using this repository, you acknowledge that the author makes no claims about the accuracy, legality, or safety of the code and accepts no liability for any issues that may arise. More information can be found [HERE](./LEGAL_NOTICE.md).\n\n# SpotAPI\n\nWelcome to SpotAPI! This Python library is designed to interact with the private and public Spotify APIs, emulating the requests typically made through a web browser. This wrapper provides a convenient way to access Spotify\u00e2\u20ac\u2122s rich set of features programmatically.\n\n**Note**: This project is intended solely for educational purposes and should be used responsibly. Accessing private endpoints and scraping data without proper authorization may violate Spotify's terms of service.\n\n## Table of Contents\n\n1. [Introduction](#spotapi)\n2. [Features](#features)\n3. [Docs](#docs)\n4. [Installation](#installation)\n5. [Quick Examples](#quick-examples)\n6. [Import Cookies](#import-cookies)\n7. [Contributing](#contributing)\n8. [Roadmap](#roadmap)\n9. [License](#license)\n\n\n## Features\n- **No Premium Required**: Unlike the Web API which requires Spotify Premium, **SpotAPI** requires no Spotify Premium at all!\n- **Public API Access**: Retrieve and manipulate public Spotify data such as playlists, albums, and tracks with ease.\n- **Private API Access**: Explore private Spotify endpoints to tailor your application to your needs.\n- **Ready to Use**: **SpotAPI** is designed for immediate integration, allowing you to accomplish tasks with just a few lines of code.\n- **No API Key Required**: Seamlessly use **SpotAPI** without needing a Spotify API key. It\u00e2\u20ac\u2122s straightforward and hassle free!\n- **Browser-like Requests**: Accurately replicate the HTTP requests Spotify makes in the browser, providing a true to web experience while remaining undetected.\n\nEverything you can do with Spotify, **SpotAPI** can do with just a user\u00e2\u20ac\u2122s login credentials.\n\n\n## Docs\n- [**Artist.py**](./docs/artist.md)\n- [**Album.py**](./docs/album.md)\n- [**Creator.py**](./docs/creator.md)\n- [**Family.py**](./docs/family.md)\n- [**Login.py**](./docs/login.md)\n- [**Password.py**](./docs/password.md)\n- [**Player.py**](./docs/player.md)\n- [**Song.py**](./docs/song.md)\n- [**Playlist.py**](./docs/playlist.md)\n- [**Status.py**](./docs/status.md)\n- [**User.py**](./docs/user.md)\n\n\n## Installation\n```\npip install spotapi\n```\n\n## Quick Examples\n\n### With User Authentication\n```py\nfrom spotapi import (\n    Login, \n    Config, \n    NoopLogger, \n    solver_clients, \n    PrivatePlaylist, \n    MongoSaver\n)\n\ncfg = Config(\n    solver=solver_clients.Capsolver(\"YOUR_API_KEY\", proxy=\"YOUR_PROXY\"), # Proxy is optional\n    logger=NoopLogger(),\n    # You can add a proxy by passing a custom TLSClient\n)\n\ninstance = Login(cfg, \"YOUR_PASSWORD\", email=\"YOUR_EMAIL\")\n# Now we have a valid Login instance to pass around\ninstance.login()\n\n# Do whatever you want now\nplaylist = PrivatePlaylist(instance)\nplaylist.create_playlist(\"SpotAPI Showcase!\")\n\n# Save the session\ninstance.save(MongoSaver())\n```\n\n### Without User Authentication\n```py\n\"\"\"Here's the example from spotipy https://github.com/spotipy-dev/spotipy?tab=readme-ov-file#quick-start\"\"\"\nfrom spotapi import Song\n\nsong = Song()\ngen = song.paginate_songs(\"weezer\")\n\n# Paginates 100 songs at a time till there's no more\nfor batch in gen:\n    for idx, item in enumerate(batch):\n        print(idx, item['item']['data']['name'])\n    \n# ^ ONLY 6 LINES OF CODE\n\n# Alternatively, you can query a specfic amount\nsongs = song.query_songs(\"weezer\", limit=20)\ndata = songs[\"data\"][\"searchV2\"][\"tracksV2\"][\"items\"]\nfor idx, item in enumerate(data):\n    print(idx, item['item']['data']['name'])\n```\n### Results\n```\n0 Island In The Sun\n1 Say It Ain't So\n2 Buddy Holly\n.\n.\n.\n18 Holiday\n19 We Are All On d***s\n```\n\n## Import Cookies\nIf you prefer not to use a third party CAPTCHA solver, you can import cookies to manage your session.\n\n### Steps to Import Cookies:\n\n1. **Choose a Session Saver**:\n   - Select a session saver for storing your session data. \n   - For simplicity, you should use `JSONSaver`, especially if performance or quantity of sessions is not a big concern.\n\n2. **Prepare Session Data**:\n   - Create an object with the following keys:\n     - **`identifier`**: This should be your email address or username.\n     - **`cookies`**: These are the cookies you obtain when logged in. To get these cookies, visit [Spotify](https://open.spotify.com/), log in, and copy the cookies from your browser.\n       - It can be a dict[str, str] or a string representation\n\n3. **Load the Session**:\n   - Use `Login.from_saver` (or your own implementation) to load the session from cache. This will enable you to use Spotify with a fully functional session without needing additional **CAPTCHA solving**.\n\n## Contributing\nContributions are welcome! If you find any issues or have suggestions, please open an issue or submit a pull request.\n\n## Roadmap\n> I'll most likely do these if the project gains some traction\n\n- [ ] No Captcha For Login (**100 Stars**)\n- [x] In Depth Documentation\n- [x] Websocket Listener\n- [x] Player\n- [ ] More wrappers around this project\n\n## License\nThis project is licensed under the **GPL 3.0** License. See [LICENSE](https://choosealicense.com/licenses/gpl-3.0/) for details.\n\n\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A sleek API wrapper for Spotify's private API",
    "version": "1.1.3",
    "project_urls": null,
    "split_keywords": [
        "spotify",
        " api",
        " spotify api",
        " spotify private api",
        " follow",
        " like",
        " creator",
        " music",
        " music api",
        " streaming",
        " music data",
        " track",
        " playlist",
        " album",
        " artist",
        " music search",
        " music metadata",
        " spotapi",
        " python spotify wrapper",
        " music automation",
        " web scraping",
        " python music api",
        " spotify integration",
        " spotify playlist",
        " spotify tracks"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2f3f17103c90f44cae3777a90c602dab6f36e285b11b42b13e368e6295d470be",
                "md5": "fa25d13d064fe2b0cc2062efa3987cd6",
                "sha256": "74e267c1e3e26eb5bfbc78c089045c9be4742ce56c36b868710fc9a93d2ac1dc"
            },
            "downloads": -1,
            "filename": "spotapi-1.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fa25d13d064fe2b0cc2062efa3987cd6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 64916,
            "upload_time": "2024-12-15T17:58:54",
            "upload_time_iso_8601": "2024-12-15T17:58:54.980038Z",
            "url": "https://files.pythonhosted.org/packages/2f/3f/17103c90f44cae3777a90c602dab6f36e285b11b42b13e368e6295d470be/spotapi-1.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b20dd1f70a2b17b90bff95f295b0ff154cf14c08571141ceffdc8dcb8003ad2f",
                "md5": "ecbdda62a277fa4c07f23a8a5411883d",
                "sha256": "1ecbf0d11dd3cc0385d730a51ee84492de4f4641aa9c74b01d1439364a77bd61"
            },
            "downloads": -1,
            "filename": "spotapi-1.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "ecbdda62a277fa4c07f23a8a5411883d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 52827,
            "upload_time": "2024-12-15T17:58:57",
            "upload_time_iso_8601": "2024-12-15T17:58:57.140774Z",
            "url": "https://files.pythonhosted.org/packages/b2/0d/d1f70a2b17b90bff95f295b0ff154cf14c08571141ceffdc8dcb8003ad2f/spotapi-1.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-15 17:58:57",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "spotapi"
}
        
Elapsed time: 0.37795s