chzzk-python 0.1.0__tar.gz → 0.6.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/.github/workflows/ci.yml +1 -0
  2. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/.github/workflows/publish.yml +10 -24
  3. chzzk_python-0.6.0/.github/workflows/release-please.yml +18 -0
  4. chzzk_python-0.6.0/CHANGELOG.md +154 -0
  5. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/PKG-INFO +161 -1
  6. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/README.md +156 -0
  7. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/README_KO.md +156 -0
  8. chzzk_python-0.6.0/docs/unofficial-chat-websocket-protocol.md +272 -0
  9. chzzk_python-0.6.0/examples/.env.example +20 -0
  10. chzzk_python-0.6.0/examples/unofficial_chat.py +151 -0
  11. chzzk_python-0.6.0/examples/unofficial_chat_async.py +146 -0
  12. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/pyproject.toml +10 -0
  13. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/src/chzzk/__init__.py +42 -0
  14. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/src/chzzk/_version.py +2 -2
  15. chzzk_python-0.6.0/src/chzzk/cli/__init__.py +1 -0
  16. chzzk_python-0.6.0/src/chzzk/cli/commands/__init__.py +1 -0
  17. chzzk_python-0.6.0/src/chzzk/cli/commands/auth.py +135 -0
  18. chzzk_python-0.6.0/src/chzzk/cli/commands/chat.py +471 -0
  19. chzzk_python-0.6.0/src/chzzk/cli/commands/live.py +116 -0
  20. chzzk_python-0.6.0/src/chzzk/cli/config.py +157 -0
  21. chzzk_python-0.6.0/src/chzzk/cli/logging.py +24 -0
  22. chzzk_python-0.6.0/src/chzzk/cli/main.py +77 -0
  23. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/src/chzzk/exceptions/__init__.py +10 -0
  24. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/src/chzzk/exceptions/errors.py +49 -0
  25. chzzk_python-0.6.0/src/chzzk/unofficial/__init__.py +99 -0
  26. chzzk_python-0.6.0/src/chzzk/unofficial/api/__init__.py +24 -0
  27. chzzk_python-0.6.0/src/chzzk/unofficial/api/base.py +32 -0
  28. chzzk_python-0.6.0/src/chzzk/unofficial/api/chat.py +47 -0
  29. chzzk_python-0.6.0/src/chzzk/unofficial/api/live.py +83 -0
  30. chzzk_python-0.6.0/src/chzzk/unofficial/api/user.py +39 -0
  31. chzzk_python-0.6.0/src/chzzk/unofficial/auth/__init__.py +9 -0
  32. chzzk_python-0.6.0/src/chzzk/unofficial/auth/cookie.py +155 -0
  33. chzzk_python-0.6.0/src/chzzk/unofficial/chat/__init__.py +10 -0
  34. chzzk_python-0.6.0/src/chzzk/unofficial/chat/client.py +1173 -0
  35. chzzk_python-0.6.0/src/chzzk/unofficial/chat/connection.py +43 -0
  36. chzzk_python-0.6.0/src/chzzk/unofficial/chat/handler.py +252 -0
  37. chzzk_python-0.6.0/src/chzzk/unofficial/chat/monitor.py +418 -0
  38. chzzk_python-0.6.0/src/chzzk/unofficial/client.py +217 -0
  39. chzzk_python-0.6.0/src/chzzk/unofficial/http/__init__.py +20 -0
  40. chzzk_python-0.6.0/src/chzzk/unofficial/http/client.py +257 -0
  41. chzzk_python-0.6.0/src/chzzk/unofficial/http/endpoints.py +78 -0
  42. chzzk_python-0.6.0/src/chzzk/unofficial/models/__init__.py +33 -0
  43. chzzk_python-0.6.0/src/chzzk/unofficial/models/chat.py +128 -0
  44. chzzk_python-0.6.0/src/chzzk/unofficial/models/live.py +80 -0
  45. chzzk_python-0.6.0/src/chzzk/unofficial/models/reconnect.py +51 -0
  46. chzzk_python-0.6.0/src/chzzk/unofficial/models/user.py +18 -0
  47. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/uv.lock +69 -0
  48. chzzk_python-0.1.0/.github/workflows/release.yml +0 -32
  49. chzzk_python-0.1.0/CHANGELOG.md +0 -62
  50. chzzk_python-0.1.0/cliff.toml +0 -49
  51. chzzk_python-0.1.0/examples/.env.example +0 -8
  52. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/.gitignore +0 -0
  53. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/.python-version +0 -0
  54. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/LICENSE +0 -0
  55. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/examples/oauth_server.py +0 -0
  56. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/examples/realtime_chat.py +0 -0
  57. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/examples/realtime_chat_async.py +0 -0
  58. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/examples/session_management.py +0 -0
  59. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/main.py +0 -0
  60. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/src/chzzk/api/__init__.py +0 -0
  61. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/src/chzzk/api/base.py +0 -0
  62. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/src/chzzk/api/category.py +0 -0
  63. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/src/chzzk/api/channel.py +0 -0
  64. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/src/chzzk/api/chat.py +0 -0
  65. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/src/chzzk/api/live.py +0 -0
  66. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/src/chzzk/api/restriction.py +0 -0
  67. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/src/chzzk/api/session.py +0 -0
  68. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/src/chzzk/api/user.py +0 -0
  69. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/src/chzzk/auth/__init__.py +0 -0
  70. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/src/chzzk/auth/models.py +0 -0
  71. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/src/chzzk/auth/oauth.py +0 -0
  72. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/src/chzzk/auth/token.py +0 -0
  73. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/src/chzzk/client.py +0 -0
  74. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/src/chzzk/http/__init__.py +0 -0
  75. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/src/chzzk/http/client.py +0 -0
  76. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/src/chzzk/http/endpoints.py +0 -0
  77. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/src/chzzk/models/__init__.py +0 -0
  78. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/src/chzzk/models/category.py +0 -0
  79. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/src/chzzk/models/channel.py +0 -0
  80. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/src/chzzk/models/chat.py +0 -0
  81. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/src/chzzk/models/common.py +0 -0
  82. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/src/chzzk/models/live.py +0 -0
  83. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/src/chzzk/models/restriction.py +0 -0
  84. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/src/chzzk/models/session.py +0 -0
  85. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/src/chzzk/models/user.py +0 -0
  86. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/src/chzzk/py.typed +0 -0
  87. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/src/chzzk/realtime/__init__.py +0 -0
  88. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/src/chzzk/realtime/client.py +0 -0
  89. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/tests/__init__.py +0 -0
  90. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/tests/api/__init__.py +0 -0
  91. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/tests/api/test_category.py +0 -0
  92. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/tests/api/test_channel.py +0 -0
  93. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/tests/api/test_chat.py +0 -0
  94. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/tests/api/test_live.py +0 -0
  95. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/tests/api/test_restriction.py +0 -0
  96. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/tests/api/test_session.py +0 -0
  97. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/tests/api/test_user.py +0 -0
  98. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/tests/auth/__init__.py +0 -0
  99. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/tests/auth/test_oauth.py +0 -0
  100. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/tests/realtime/__init__.py +0 -0
  101. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/tests/realtime/test_client.py +0 -0
  102. {chzzk_python-0.1.0 → chzzk_python-0.6.0}/tests/test_client.py +0 -0
@@ -5,6 +5,7 @@ on:
5
5
  branches: [main]
6
6
  pull_request:
7
7
  branches: [main]
8
+ workflow_call:
8
9
 
9
10
  jobs:
10
11
  lint:
@@ -1,15 +1,21 @@
1
1
  name: Publish to PyPI
2
2
 
3
3
  on:
4
- push:
5
- tags:
6
- - 'v*'
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
7
 
8
8
  jobs:
9
+ ci:
10
+ uses: ./.github/workflows/ci.yml
11
+
9
12
  build:
13
+ needs: ci
10
14
  runs-on: ubuntu-latest
11
15
  steps:
12
16
  - uses: actions/checkout@v6
17
+ with:
18
+ fetch-depth: 0
13
19
 
14
20
  - name: Install uv
15
21
  uses: astral-sh/setup-uv@v7
@@ -30,28 +36,8 @@ jobs:
30
36
  name: dist
31
37
  path: dist/
32
38
 
33
- publish-testpypi:
34
- needs: build
35
- runs-on: ubuntu-latest
36
- environment:
37
- name: testpypi
38
- url: https://test.pypi.org/p/chzzk-python
39
- permissions:
40
- id-token: write
41
- steps:
42
- - name: Download artifacts
43
- uses: actions/download-artifact@v4
44
- with:
45
- name: dist
46
- path: dist/
47
-
48
- - name: Publish to TestPyPI
49
- uses: pypa/gh-action-pypi-publish@release/v1
50
- with:
51
- repository-url: https://test.pypi.org/legacy/
52
-
53
39
  publish-pypi:
54
- needs: publish-testpypi
40
+ needs: build
55
41
  runs-on: ubuntu-latest
56
42
  environment:
57
43
  name: pypi
@@ -0,0 +1,18 @@
1
+ name: Release Please
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ permissions:
9
+ contents: write
10
+ pull-requests: write
11
+
12
+ jobs:
13
+ release-please:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: googleapis/release-please-action@v4
17
+ with:
18
+ release-type: python
@@ -0,0 +1,154 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.6.0](https://github.com/hypn4/chzzk-python/compare/v0.5.0...v0.6.0) (2026-01-23)
9
+
10
+
11
+ ### Features
12
+
13
+ * **ci:** add workflow_dispatch trigger for manual publish ([db81d8a](https://github.com/hypn4/chzzk-python/commit/db81d8a8451dea15cd3e09eb658020f1ebb32f66))
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * **ci:** change publish trigger to release event ([984df49](https://github.com/hypn4/chzzk-python/commit/984df49fdd67c52096c74ddcc140eacdfc8148bf))
19
+
20
+ ## [0.5.0](https://github.com/hypn4/chzzk-python/compare/v0.4.2...v0.5.0) (2026-01-23)
21
+
22
+
23
+ ### Features
24
+
25
+ * **ci:** add workflow_call trigger to CI workflow ([c7d016e](https://github.com/hypn4/chzzk-python/commit/c7d016e69a3af6cb79daf9fb1c528fd68c340861))
26
+ * **ci:** improve publish workflow reliability and trigger mechanism ([640b857](https://github.com/hypn4/chzzk-python/commit/640b857ac0033211bbf6bd3f35d82c242d0b8050))
27
+
28
+ ## [0.4.2](https://github.com/hypn4/chzzk-python/compare/v0.4.1...v0.4.2) (2026-01-23)
29
+
30
+
31
+ ### Bug Fixes
32
+
33
+ * **ci:** fetch all tags in publish workflow for hatch-vcs ([2b27204](https://github.com/hypn4/chzzk-python/commit/2b2720487a74d59ce563c1663f42520489f5d3cd))
34
+
35
+ ## [0.4.1](https://github.com/hypn4/chzzk-python/compare/v0.4.0...v0.4.1) (2026-01-23)
36
+
37
+
38
+ ### Bug Fixes
39
+
40
+ * **ci:** remove workflow_dispatch from publish workflow ([878def8](https://github.com/hypn4/chzzk-python/commit/878def8daa0aa582c0abe2b17d4d9408c5471ac5))
41
+
42
+ ## [0.4.0](https://github.com/hypn4/chzzk-python/compare/v0.3.1...v0.4.0) (2026-01-23)
43
+
44
+
45
+ ### Features
46
+
47
+ * **api:** add live status polling service ([5cede05](https://github.com/hypn4/chzzk-python/commit/5cede05360d4eb7b0c82d3939cf9577648307692))
48
+ * **chat:** add offline channel connection support ([5d63c34](https://github.com/hypn4/chzzk-python/commit/5d63c343786ce8d56be1676d298e5c9f3d4bc244))
49
+ * **chat:** add status monitoring and auto-reconnection ([6a77361](https://github.com/hypn4/chzzk-python/commit/6a77361f964015612266e3662c422904a8c9b16a))
50
+ * **cli:** add CLI module with auth, live, and chat commands ([98e3741](https://github.com/hypn4/chzzk-python/commit/98e37417a2bc9cb353d772037f73c81c3907e01b))
51
+ * **cli:** add CLI optional dependencies ([4cd1ca0](https://github.com/hypn4/chzzk-python/commit/4cd1ca0ccffd3b7dcc31984e0a17aceb3afc6480))
52
+ * **cli:** add interactive chat mode and offline support ([f6e173b](https://github.com/hypn4/chzzk-python/commit/f6e173b9f4abbcc4e8d2bcf3233ac126c20ccb7f))
53
+ * **exceptions:** add ChatReconnectError for reconnection failures ([a83a21d](https://github.com/hypn4/chzzk-python/commit/a83a21dd2a3b6a9e3ef274a8d98908e6dcfaaf35))
54
+ * **models:** add reconnection event models ([3d98b38](https://github.com/hypn4/chzzk-python/commit/3d98b387bdc1d09556d8eaee28277c7a6cf5b5f0))
55
+
56
+
57
+ ### Bug Fixes
58
+
59
+ * **api:** update live detail endpoint to v3.3 ([0fc935b](https://github.com/hypn4/chzzk-python/commit/0fc935bc718124775ba6cc6198279d9909ba25aa))
60
+
61
+
62
+ ### Documentation
63
+
64
+ * add CLI documentation to README ([348a2b7](https://github.com/hypn4/chzzk-python/commit/348a2b76ab47a79018010064db66fbd73c6347f1))
65
+ * **cli:** document interactive and offline chat flags ([b50f7a1](https://github.com/hypn4/chzzk-python/commit/b50f7a19fcad39ed110f963cab29300773b1ee01))
66
+
67
+ ## [0.3.1](https://github.com/hypn4/chzzk-python/compare/v0.3.0...v0.3.1) (2026-01-23)
68
+
69
+
70
+ ### Bug Fixes
71
+
72
+ * **ci:** add skip-existing to PyPI publish workflow ([84cce48](https://github.com/hypn4/chzzk-python/commit/84cce48))
73
+
74
+ ## [0.3.0](https://github.com/hypn4/chzzk-python/compare/v0.2.0...v0.3.0) (2026-01-23)
75
+
76
+
77
+ ### Features
78
+
79
+ * add unofficial API with Naver cookie authentication ([2481223](https://github.com/hypn4/chzzk-python/commit/2481223672b56c2de102d42fc4f17e7420e9df7a))
80
+
81
+
82
+ ### Bug Fixes
83
+
84
+ * **ci:** trigger publish workflow from release-please ([d63302a](https://github.com/hypn4/chzzk-python/commit/d63302a61e683c73246e5fbd62b7e55cd7bfdd02))
85
+
86
+
87
+ ### Documentation
88
+
89
+ * add unofficial API documentation to README ([0c7d575](https://github.com/hypn4/chzzk-python/commit/0c7d5756c6905ec9c4fa2715ffc3655516f9c1e3))
90
+ * add unofficial chat WebSocket protocol documentation ([bb2d4d3](https://github.com/hypn4/chzzk-python/commit/bb2d4d3d6fd058d365d8051169ba3318bdbc5c64))
91
+ * **examples:** add unofficial chat client examples ([8b68a41](https://github.com/hypn4/chzzk-python/commit/8b68a41964588ef40d4a5ce9cdd9bc4080cd5c09))
92
+
93
+ ## [0.2.0](https://github.com/hypn4/chzzk-python/compare/v0.1.0...v0.2.0) (2026-01-23)
94
+
95
+
96
+ ### Features
97
+
98
+ * **ci:** add Release Please workflow for automated releases ([34be227](https://github.com/hypn4/chzzk-python/commit/34be227f6f75fe769f0a3760673520487b7dd004))
99
+
100
+ ## [Unreleased]
101
+
102
+ ### Added
103
+
104
+ - **exceptions**: Add custom exception classes for Chzzk SDK
105
+ - **http**: Add HTTP client wrapper for Chzzk API
106
+ - **auth**: Add OAuth authentication models
107
+ - **auth**: Add token storage implementations
108
+ - **auth**: Add OAuth client implementations
109
+ - **examples**: Add OAuth authorization code flow example
110
+ - **examples**: Enhance OAuth server with ChzzkClient and API demos
111
+ - **http**: Add PUT, PATCH, and DELETE methods to HTTP clients
112
+ - **http**: Add Open API endpoint constants
113
+ - **models**: Add Pydantic models for Chzzk API responses
114
+ - **api**: Implement service layer for Chzzk Open API
115
+ - **client**: Add unified Chzzk API client
116
+ - Export client, services, and models from package root
117
+ - **http**: Add params support to POST methods
118
+ - **models**: Add session and realtime event models
119
+ - **http**: Add session API endpoints
120
+ - **exceptions**: Add session-related exceptions
121
+ - **api**: Implement session service for WebSocket management
122
+ - **realtime**: Add Socket.IO client for realtime events
123
+ - **client**: Integrate session service and event client
124
+ - Export session, realtime, and related components
125
+ - **examples**: Add session list endpoint to OAuth server
126
+ - **examples**: Add realtime and session management examples
127
+
128
+ ### Build
129
+
130
+ - Add python-socketio dependency for realtime events
131
+ - Add websocket-client dependency
132
+ - Exclude AI tooling files from git and distribution
133
+
134
+ ### Changed
135
+
136
+ - **auth**: Remove get_access_token method from OAuth classes
137
+
138
+ ### Documentation
139
+
140
+ - Add comprehensive SDK documentation
141
+
142
+ ### Fixed
143
+
144
+ - **http**: Extract content field from Chzzk API response wrapper
145
+ - **realtime**: Handle string and dict event data from Socket.IO
146
+ - **models**: Make user_role_code optional in ChatEvent
147
+
148
+ ### Testing
149
+
150
+ - **auth**: Add comprehensive OAuth test suite
151
+ - Add comprehensive test suite for API services and client
152
+ - Add tests for session service and realtime client
153
+
154
+ [Unreleased]: https://github.com/hypn4/chzzk-python/compare/...HEAD
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: chzzk-python
3
- Version: 0.1.0
3
+ Version: 0.6.0
4
4
  Summary: Unofficial Python SDK for Chzzk (NAVER Live Streaming Platform) API
5
5
  Project-URL: Homepage, https://github.com/hypn4/chzzk-python
6
6
  Project-URL: Repository, https://github.com/hypn4/chzzk-python
@@ -26,6 +26,10 @@ Requires-Dist: httpx>=0.28.0
26
26
  Requires-Dist: pydantic>=2.10.0
27
27
  Requires-Dist: python-socketio[asyncio-client]<5.0.0,>=4.6.0
28
28
  Requires-Dist: websocket-client>=1.9.0
29
+ Requires-Dist: websockets>=12.0
30
+ Provides-Extra: cli
31
+ Requires-Dist: rich>=13.0.0; extra == 'cli'
32
+ Requires-Dist: typer>=0.15.0; extra == 'cli'
29
33
  Description-Content-Type: text/markdown
30
34
 
31
35
  # chzzk-python
@@ -47,6 +51,16 @@ uv add chzzk-python
47
51
  pip install chzzk-python
48
52
  ```
49
53
 
54
+ ### CLI Installation
55
+
56
+ ```bash
57
+ # Using uv (recommended)
58
+ uv add "chzzk-python[cli]"
59
+
60
+ # Using pip
61
+ pip install "chzzk-python[cli]"
62
+ ```
63
+
50
64
  ## Quick Start
51
65
 
52
66
  ```python
@@ -87,6 +101,8 @@ print(f"Channel: {user.channel_name}")
87
101
  | **Drops** | ❌ Not Implemented | - |
88
102
  | **Webhook Event** | ❌ Not Implemented | - |
89
103
 
104
+ > A [CLI](#command-line-interface) is also available for quick terminal access.
105
+
90
106
  ## Features
91
107
 
92
108
  ### Sync/Async Support
@@ -288,6 +304,148 @@ except ChzzkAPIError as e:
288
304
  print(f"API Error: [{e.status_code}] {e.error_code}: {e.message}")
289
305
  ```
290
306
 
307
+ ## Unofficial API
308
+
309
+ In addition to the official API, we provide an unofficial API using Naver cookie authentication.
310
+ This enables real-time chat receiving/sending functionality.
311
+
312
+ > ⚠️ The unofficial API may change at any time and is not officially supported.
313
+
314
+ ### Unofficial Chat Client
315
+
316
+ **Synchronous version:**
317
+
318
+ ```python
319
+ from chzzk.unofficial import UnofficialChatClient, ChatMessage
320
+
321
+ chat = UnofficialChatClient(
322
+ nid_aut="your-nid-aut-cookie",
323
+ nid_ses="your-nid-ses-cookie",
324
+ )
325
+
326
+ @chat.on_chat
327
+ def on_chat(msg: ChatMessage):
328
+ print(f"{msg.nickname}: {msg.content}")
329
+
330
+ @chat.on_donation
331
+ def on_donation(msg):
332
+ print(f"{msg.nickname} donated {msg.pay_amount}won")
333
+
334
+ chat.connect("channel-id")
335
+ chat.send_message("Hello!")
336
+ chat.run_forever()
337
+ ```
338
+
339
+ **Asynchronous version:**
340
+
341
+ ```python
342
+ from chzzk.unofficial import AsyncUnofficialChatClient, ChatMessage
343
+
344
+ async with AsyncUnofficialChatClient(
345
+ nid_aut="your-nid-aut-cookie",
346
+ nid_ses="your-nid-ses-cookie",
347
+ ) as chat:
348
+ @chat.on_chat
349
+ async def on_chat(msg: ChatMessage):
350
+ print(f"{msg.nickname}: {msg.content}")
351
+
352
+ await chat.connect("channel-id")
353
+ await chat.send_message("Hello!")
354
+ await chat.run_forever()
355
+ ```
356
+
357
+ ### How to Get Naver Cookies
358
+
359
+ 1. Log in to Naver
360
+ 2. Browser Developer Tools (F12) → Application → Cookies
361
+ 3. Copy `NID_AUT` and `NID_SES` cookie values
362
+
363
+ ### Unofficial API Exception Handling
364
+
365
+ ```python
366
+ from chzzk import ChatConnectionError, ChatNotLiveError
367
+
368
+ try:
369
+ chat.connect("channel-id")
370
+ except ChatNotLiveError:
371
+ print("Channel is not currently live")
372
+ except ChatConnectionError as e:
373
+ print(f"Connection failed: {e}")
374
+ ```
375
+
376
+ ## Command Line Interface
377
+
378
+ A CLI is available for quick access to the unofficial API features.
379
+
380
+ ### Authentication
381
+
382
+ ```bash
383
+ # Save your Naver cookies (interactive)
384
+ chzzk auth login
385
+
386
+ # Check authentication status
387
+ chzzk auth status
388
+
389
+ # Remove stored cookies
390
+ chzzk auth logout
391
+ ```
392
+
393
+ Cookies are stored in `~/.chzzk/cookies.json`.
394
+
395
+ ### Live Status
396
+
397
+ ```bash
398
+ # Get detailed live information
399
+ chzzk live info CHANNEL_ID
400
+
401
+ # Get simple LIVE/OFFLINE status
402
+ chzzk live status CHANNEL_ID
403
+
404
+ # JSON output
405
+ chzzk --json live info CHANNEL_ID
406
+ ```
407
+
408
+ ### Chat
409
+
410
+ ```bash
411
+ # Watch real-time chat
412
+ chzzk chat watch CHANNEL_ID
413
+
414
+ # Watch chat even when offline
415
+ chzzk chat watch CHANNEL_ID --offline
416
+
417
+ # Send a single message (requires authentication)
418
+ chzzk chat send CHANNEL_ID "Hello!"
419
+
420
+ # Send to offline channel
421
+ chzzk chat send CHANNEL_ID "Hello!" --offline
422
+
423
+ # Interactive mode: send and receive messages
424
+ chzzk chat send CHANNEL_ID --interactive
425
+ # or
426
+ chzzk chat send CHANNEL_ID -i
427
+
428
+ # Interactive mode with offline channel
429
+ chzzk chat send CHANNEL_ID -i --offline
430
+ ```
431
+
432
+ ### Global Options
433
+
434
+ ```bash
435
+ --nid-aut TEXT # Override NID_AUT cookie (env: CHZZK_NID_AUT)
436
+ --nid-ses TEXT # Override NID_SES cookie (env: CHZZK_NID_SES)
437
+ --json # Output in JSON format
438
+ --log-level LEVEL # Set log level (DEBUG, INFO, WARNING, ERROR)
439
+ ```
440
+
441
+ ### Environment Variables
442
+
443
+ | Variable | Description |
444
+ |----------|-------------|
445
+ | `CHZZK_NID_AUT` | NID_AUT cookie value |
446
+ | `CHZZK_NID_SES` | NID_SES cookie value |
447
+ | `CHZZK_LOG_LEVEL` | Default log level |
448
+
291
449
  ## Examples
292
450
 
293
451
  See the [examples](examples/) directory for complete working examples:
@@ -296,6 +454,8 @@ See the [examples](examples/) directory for complete working examples:
296
454
  - `realtime_chat.py` - Realtime chat/donation/subscription events (sync)
297
455
  - `realtime_chat_async.py` - Realtime events (async)
298
456
  - `session_management.py` - Session management example
457
+ - `unofficial_chat.py` - Unofficial chat client (sync)
458
+ - `unofficial_chat_async.py` - Unofficial chat client (async)
299
459
 
300
460
  ## API Reference
301
461
 
@@ -17,6 +17,16 @@ uv add chzzk-python
17
17
  pip install chzzk-python
18
18
  ```
19
19
 
20
+ ### CLI Installation
21
+
22
+ ```bash
23
+ # Using uv (recommended)
24
+ uv add "chzzk-python[cli]"
25
+
26
+ # Using pip
27
+ pip install "chzzk-python[cli]"
28
+ ```
29
+
20
30
  ## Quick Start
21
31
 
22
32
  ```python
@@ -57,6 +67,8 @@ print(f"Channel: {user.channel_name}")
57
67
  | **Drops** | ❌ Not Implemented | - |
58
68
  | **Webhook Event** | ❌ Not Implemented | - |
59
69
 
70
+ > A [CLI](#command-line-interface) is also available for quick terminal access.
71
+
60
72
  ## Features
61
73
 
62
74
  ### Sync/Async Support
@@ -258,6 +270,148 @@ except ChzzkAPIError as e:
258
270
  print(f"API Error: [{e.status_code}] {e.error_code}: {e.message}")
259
271
  ```
260
272
 
273
+ ## Unofficial API
274
+
275
+ In addition to the official API, we provide an unofficial API using Naver cookie authentication.
276
+ This enables real-time chat receiving/sending functionality.
277
+
278
+ > ⚠️ The unofficial API may change at any time and is not officially supported.
279
+
280
+ ### Unofficial Chat Client
281
+
282
+ **Synchronous version:**
283
+
284
+ ```python
285
+ from chzzk.unofficial import UnofficialChatClient, ChatMessage
286
+
287
+ chat = UnofficialChatClient(
288
+ nid_aut="your-nid-aut-cookie",
289
+ nid_ses="your-nid-ses-cookie",
290
+ )
291
+
292
+ @chat.on_chat
293
+ def on_chat(msg: ChatMessage):
294
+ print(f"{msg.nickname}: {msg.content}")
295
+
296
+ @chat.on_donation
297
+ def on_donation(msg):
298
+ print(f"{msg.nickname} donated {msg.pay_amount}won")
299
+
300
+ chat.connect("channel-id")
301
+ chat.send_message("Hello!")
302
+ chat.run_forever()
303
+ ```
304
+
305
+ **Asynchronous version:**
306
+
307
+ ```python
308
+ from chzzk.unofficial import AsyncUnofficialChatClient, ChatMessage
309
+
310
+ async with AsyncUnofficialChatClient(
311
+ nid_aut="your-nid-aut-cookie",
312
+ nid_ses="your-nid-ses-cookie",
313
+ ) as chat:
314
+ @chat.on_chat
315
+ async def on_chat(msg: ChatMessage):
316
+ print(f"{msg.nickname}: {msg.content}")
317
+
318
+ await chat.connect("channel-id")
319
+ await chat.send_message("Hello!")
320
+ await chat.run_forever()
321
+ ```
322
+
323
+ ### How to Get Naver Cookies
324
+
325
+ 1. Log in to Naver
326
+ 2. Browser Developer Tools (F12) → Application → Cookies
327
+ 3. Copy `NID_AUT` and `NID_SES` cookie values
328
+
329
+ ### Unofficial API Exception Handling
330
+
331
+ ```python
332
+ from chzzk import ChatConnectionError, ChatNotLiveError
333
+
334
+ try:
335
+ chat.connect("channel-id")
336
+ except ChatNotLiveError:
337
+ print("Channel is not currently live")
338
+ except ChatConnectionError as e:
339
+ print(f"Connection failed: {e}")
340
+ ```
341
+
342
+ ## Command Line Interface
343
+
344
+ A CLI is available for quick access to the unofficial API features.
345
+
346
+ ### Authentication
347
+
348
+ ```bash
349
+ # Save your Naver cookies (interactive)
350
+ chzzk auth login
351
+
352
+ # Check authentication status
353
+ chzzk auth status
354
+
355
+ # Remove stored cookies
356
+ chzzk auth logout
357
+ ```
358
+
359
+ Cookies are stored in `~/.chzzk/cookies.json`.
360
+
361
+ ### Live Status
362
+
363
+ ```bash
364
+ # Get detailed live information
365
+ chzzk live info CHANNEL_ID
366
+
367
+ # Get simple LIVE/OFFLINE status
368
+ chzzk live status CHANNEL_ID
369
+
370
+ # JSON output
371
+ chzzk --json live info CHANNEL_ID
372
+ ```
373
+
374
+ ### Chat
375
+
376
+ ```bash
377
+ # Watch real-time chat
378
+ chzzk chat watch CHANNEL_ID
379
+
380
+ # Watch chat even when offline
381
+ chzzk chat watch CHANNEL_ID --offline
382
+
383
+ # Send a single message (requires authentication)
384
+ chzzk chat send CHANNEL_ID "Hello!"
385
+
386
+ # Send to offline channel
387
+ chzzk chat send CHANNEL_ID "Hello!" --offline
388
+
389
+ # Interactive mode: send and receive messages
390
+ chzzk chat send CHANNEL_ID --interactive
391
+ # or
392
+ chzzk chat send CHANNEL_ID -i
393
+
394
+ # Interactive mode with offline channel
395
+ chzzk chat send CHANNEL_ID -i --offline
396
+ ```
397
+
398
+ ### Global Options
399
+
400
+ ```bash
401
+ --nid-aut TEXT # Override NID_AUT cookie (env: CHZZK_NID_AUT)
402
+ --nid-ses TEXT # Override NID_SES cookie (env: CHZZK_NID_SES)
403
+ --json # Output in JSON format
404
+ --log-level LEVEL # Set log level (DEBUG, INFO, WARNING, ERROR)
405
+ ```
406
+
407
+ ### Environment Variables
408
+
409
+ | Variable | Description |
410
+ |----------|-------------|
411
+ | `CHZZK_NID_AUT` | NID_AUT cookie value |
412
+ | `CHZZK_NID_SES` | NID_SES cookie value |
413
+ | `CHZZK_LOG_LEVEL` | Default log level |
414
+
261
415
  ## Examples
262
416
 
263
417
  See the [examples](examples/) directory for complete working examples:
@@ -266,6 +420,8 @@ See the [examples](examples/) directory for complete working examples:
266
420
  - `realtime_chat.py` - Realtime chat/donation/subscription events (sync)
267
421
  - `realtime_chat_async.py` - Realtime events (async)
268
422
  - `session_management.py` - Session management example
423
+ - `unofficial_chat.py` - Unofficial chat client (sync)
424
+ - `unofficial_chat_async.py` - Unofficial chat client (async)
269
425
 
270
426
  ## API Reference
271
427