spotapi


Namespotapi JSON
Version 1.1.0 PyPI version JSON
download
home_pageNone
SummaryA sleek API wrapper for Spotify's private API
upload_time2024-09-08 15:43:05
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)
- [**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/da/fc/b1f717a2769aa1b07a138f9b32d7991a2a36019bd0df9b697a5d2a71bde7/spotapi-1.1.0.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- [**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.0",
    "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": "43c95d4d1169db403c5b499181ad45871ad8d40592107d905d17991458b063f4",
                "md5": "03499a0a2cef61777555207655a206ab",
                "sha256": "63fc0b3077ff9235ef6a7545cf73d05eb720ea07fa6fc9c106aeae0952d7ea8a"
            },
            "downloads": -1,
            "filename": "spotapi-1.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "03499a0a2cef61777555207655a206ab",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 60837,
            "upload_time": "2024-09-08T15:43:03",
            "upload_time_iso_8601": "2024-09-08T15:43:03.821071Z",
            "url": "https://files.pythonhosted.org/packages/43/c9/5d4d1169db403c5b499181ad45871ad8d40592107d905d17991458b063f4/spotapi-1.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dafcb1f717a2769aa1b07a138f9b32d7991a2a36019bd0df9b697a5d2a71bde7",
                "md5": "2feed0afeb616299b7a056a6a3e746cb",
                "sha256": "7e154d1c9eb6860b1c992f55e88d267fee3a85d5fad39ec7ea3d608a5f2816cf"
            },
            "downloads": -1,
            "filename": "spotapi-1.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "2feed0afeb616299b7a056a6a3e746cb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 50880,
            "upload_time": "2024-09-08T15:43:05",
            "upload_time_iso_8601": "2024-09-08T15:43:05.063512Z",
            "url": "https://files.pythonhosted.org/packages/da/fc/b1f717a2769aa1b07a138f9b32d7991a2a36019bd0df9b697a5d2a71bde7/spotapi-1.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-08 15:43:05",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "spotapi"
}
        
Elapsed time: 0.34235s