# Storygraph API
A package to interact with and fetch data from the [StoryGraph](https://app.thestorygraph.com/) website.
## Features
- **Book Details**: Fetch detailed information about a book using its unique ID.
- **Search**: Perform a book search on StoryGraph and retrieve the results.
- **Fetch User lists**:
- currently reading
- planning to read
- books read
## Installation
```
pip install storygraph-api
```
## Getting Started
The API is divided into two components, `Books Client` and `User Client`.
### Book Details:
```python
# Books Client
# Fetch details of a book using its ID
from storygraph_api import Book
id = "fbdd6b7c-f512-47f2-aa94-d8bf0d5f5175"
book = Book()
result = book.book_info(id)
print(result)
```
#### Result:
```json
{
"title": "Hagakure: The Book of the Samurai",
"authors": [
"Yamamoto Tsunetomo",
"William Scott Wilson"
],
"pages": "179",
"first_pub": "1716",
"tags": [
"nonfiction",
"history",
"philosophy",
"informative",
"reflective",
"slow-paced"
],
"average_rating": "3.57",
"description": "<div><em>Hagakure<\\/em> (\\\"In the Shadow of Leaves\\\") is a manual for the samurai classes consisting of a series of short anecdotes and reflections that give both insight and instruction-in the philosophy and code of behavior that foster the true spirit of Bushido-the Way of the Warrior. It is not a book of philosophy as most would understand the word: it is a collection of thoughts and sayings recorded over a period of seven years, and as such covers a wide variety of subjects, often in no particular sequence. <br><br>The work represents an attitude far removed from our modern pragmatism and materialism, and possesses an intuitive rather than rational appeal in its assertion that Bushido is a Way of Dying, and that only a samurai retainer prepared and willing to die at any moment can be totally true to his lord. While <em>Hagakure<\\/em> was for many years a secret text known only to the warrior vassals of the Hizen fief to which the author belonged, it later came to be recognized as a classic exposition of samurai thought and came to influence many subsequent generations, including Yukio Mishima. <br><br>This translation offers 300 selections that constitute the core texts of the 1,300 present in the original. <br><em>Hagakure<\\/em> was featured prominently in the film <em>Ghost Dog<\\/em>, by Jim Jarmusch.<\\/div>"
}
```
### User List:
```python
# User Client
# works only for public profiles
# fetch user's currently reading list
from storygraph_api import User
from dotenv import load_dotenv
load_dotenv()
cookie = os.getenv('COOKIE') # retrieve cookie from .env file
uname = 'sampleuname' #some username
user = User()
result = user.currently_reading(uname,cookie=cookie)
print(result)
```
#### Result:
```json
[
{
"title": "The Murder After the Night Before",
"book_id": "38cb5b56-23f1-48fd-b4b3-a80e07a19775"
},
{
"title": "The Graces",
"book_id": "653b54b3-a79d-4c2e-ae40-eae281a91315"
}
]
```
## Further Information
* Refer to [books_client.py](https://github.com/ym496/storygraph-api/tree/main/storygraph_api/books_client.py) and [users_client.py](https://github.com/ym496/storygraph-api/tree/main/storygraph_api/users_client.py) files to know more functionalities.
* All the user related tasks require the `remember_user_token` cookie. It can be found in the `Application` section of your browser’s developer tools for the StoryGraph website.
## Contributing
Contributions are welcome! Fork the repository, make your changes, and submit a pull request.
For bugs or feature requests, please open an issue on [GitHub](https://github.com/ym496/storygraph-api).
## License
This project is licensed under the MIT License.
Raw data
{
"_id": null,
"home_page": "https://github.com/ym496/storygraph-api",
"name": "storygraph-api",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "storygraph, storygraph api, api storygraph, storygraph scraper",
"author": "ym496",
"author_email": "yogendramishra2004@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/48/98/19f48be109e1b7ae44072ec732be15ed9e898c6b2acea8d23cc3b5bbb68c/storygraph-api-0.1.0.tar.gz",
"platform": null,
"description": "# Storygraph API\nA package to interact with and fetch data from the [StoryGraph](https://app.thestorygraph.com/) website.\n\n## Features\n- **Book Details**: Fetch detailed information about a book using its unique ID.\n- **Search**: Perform a book search on StoryGraph and retrieve the results.\n- **Fetch User lists**: \n - currently reading\n - planning to read\n - books read\n\n## Installation\n```\npip install storygraph-api\n```\n\n## Getting Started\n\nThe API is divided into two components, `Books Client` and `User Client`.\n\n### Book Details:\n\n```python\n# Books Client\n# Fetch details of a book using its ID\n\nfrom storygraph_api import Book\nid = \"fbdd6b7c-f512-47f2-aa94-d8bf0d5f5175\"\nbook = Book()\nresult = book.book_info(id)\nprint(result)\n```\n#### Result:\n```json\n{\n \"title\": \"Hagakure: The Book of the Samurai\",\n \"authors\": [\n \"Yamamoto Tsunetomo\",\n \"William Scott Wilson\"\n ],\n \"pages\": \"179\",\n \"first_pub\": \"1716\",\n \"tags\": [\n \"nonfiction\",\n \"history\",\n \"philosophy\",\n \"informative\",\n \"reflective\",\n \"slow-paced\"\n ],\n \"average_rating\": \"3.57\",\n \"description\": \"<div><em>Hagakure<\\\\/em> (\\\\\\\"In the Shadow of Leaves\\\\\\\") is a manual for the samurai classes consisting of a series of short anecdotes and reflections that give both insight and instruction-in the philosophy and code of behavior that foster the true spirit of Bushido-the Way of the Warrior. It is not a book of philosophy as most would understand the word: it is a collection of thoughts and sayings recorded over a period of seven years, and as such covers a wide variety of subjects, often in no particular sequence. <br><br>The work represents an attitude far removed from our modern pragmatism and materialism, and possesses an intuitive rather than rational appeal in its assertion that Bushido is a Way of Dying, and that only a samurai retainer prepared and willing to die at any moment can be totally true to his lord. While <em>Hagakure<\\\\/em> was for many years a secret text known only to the warrior vassals of the Hizen fief to which the author belonged, it later came to be recognized as a classic exposition of samurai thought and came to influence many subsequent generations, including Yukio Mishima. <br><br>This translation offers 300 selections that constitute the core texts of the 1,300 present in the original. <br><em>Hagakure<\\\\/em> was featured prominently in the film <em>Ghost Dog<\\\\/em>, by Jim Jarmusch.<\\\\/div>\"\n}\n\n```\n\n\n### User List:\n\n```python\n# User Client\n# works only for public profiles\n# fetch user's currently reading list\n\nfrom storygraph_api import User\nfrom dotenv import load_dotenv\nload_dotenv()\ncookie = os.getenv('COOKIE') # retrieve cookie from .env file\nuname = 'sampleuname' #some username \nuser = User()\nresult = user.currently_reading(uname,cookie=cookie)\nprint(result)\n\n```\n\n#### Result:\n \n ```json\n [\n {\n \"title\": \"The Murder After the Night Before\",\n \"book_id\": \"38cb5b56-23f1-48fd-b4b3-a80e07a19775\"\n },\n {\n \"title\": \"The Graces\",\n \"book_id\": \"653b54b3-a79d-4c2e-ae40-eae281a91315\"\n }\n]\n\n ```\n\n## Further Information \n* Refer to [books_client.py](https://github.com/ym496/storygraph-api/tree/main/storygraph_api/books_client.py) and [users_client.py](https://github.com/ym496/storygraph-api/tree/main/storygraph_api/users_client.py) files to know more functionalities.\n* All the user related tasks require the `remember_user_token` cookie. It can be found in the `Application` section of your browser\u2019s developer tools for the StoryGraph website.\n\n## Contributing\nContributions are welcome! Fork the repository, make your changes, and submit a pull request.\n\nFor bugs or feature requests, please open an issue on [GitHub](https://github.com/ym496/storygraph-api).\n\n## License\n\nThis project is licensed under the MIT License.\n\n\n",
"bugtrack_url": null,
"license": null,
"summary": "This package allows you to interact and fetch data from the StoryGraph website.",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/ym496/storygraph-api"
},
"split_keywords": [
"storygraph",
" storygraph api",
" api storygraph",
" storygraph scraper"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "88e56c32c77df05877de3c5e28062b9363deb4551c12350daf87cfeb6a01fac8",
"md5": "a65aac374b4728042bfafbed1f30973e",
"sha256": "72e3e05702b612cc2a5d64eeef4542a4bc63facaea18a0729a4d8c4c3ade101c"
},
"downloads": -1,
"filename": "storygraph_api-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a65aac374b4728042bfafbed1f30973e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 9314,
"upload_time": "2024-08-16T16:51:03",
"upload_time_iso_8601": "2024-08-16T16:51:03.116014Z",
"url": "https://files.pythonhosted.org/packages/88/e5/6c32c77df05877de3c5e28062b9363deb4551c12350daf87cfeb6a01fac8/storygraph_api-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "489819f48be109e1b7ae44072ec732be15ed9e898c6b2acea8d23cc3b5bbb68c",
"md5": "51c0025ef64213a0e240735ccfeca1f4",
"sha256": "0aa970ef274546539c223fac7cb8b3492eaaec2287d4e5e4c57e60b9bbd68ab6"
},
"downloads": -1,
"filename": "storygraph-api-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "51c0025ef64213a0e240735ccfeca1f4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 8641,
"upload_time": "2024-08-16T16:51:04",
"upload_time_iso_8601": "2024-08-16T16:51:04.857294Z",
"url": "https://files.pythonhosted.org/packages/48/98/19f48be109e1b7ae44072ec732be15ed9e898c6b2acea8d23cc3b5bbb68c/storygraph-api-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-16 16:51:04",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ym496",
"github_project": "storygraph-api",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "storygraph-api"
}