yaylib 0.0.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.
- yaylib-0.0.0/LICENSE +21 -0
- yaylib-0.0.0/PKG-INFO +316 -0
- yaylib-0.0.0/README.md +295 -0
- yaylib-0.0.0/pyproject.toml +41 -0
- yaylib-0.0.0/yaylib/__init__.py +39 -0
- yaylib-0.0.0/yaylib/api/__init__.py +37 -0
- yaylib-0.0.0/yaylib/api/auth.py +231 -0
- yaylib-0.0.0/yaylib/api/call.py +360 -0
- yaylib-0.0.0/yaylib/api/chat.py +468 -0
- yaylib-0.0.0/yaylib/api/group.py +792 -0
- yaylib-0.0.0/yaylib/api/misc.py +433 -0
- yaylib-0.0.0/yaylib/api/notification.py +71 -0
- yaylib-0.0.0/yaylib/api/post.py +970 -0
- yaylib-0.0.0/yaylib/api/review.py +137 -0
- yaylib-0.0.0/yaylib/api/thread.py +218 -0
- yaylib-0.0.0/yaylib/api/user.py +762 -0
- yaylib-0.0.0/yaylib/client.py +3120 -0
- yaylib-0.0.0/yaylib/config.py +42 -0
- yaylib-0.0.0/yaylib/constants.py +114 -0
- yaylib-0.0.0/yaylib/device.py +72 -0
- yaylib-0.0.0/yaylib/errors.py +869 -0
- yaylib-0.0.0/yaylib/models.py +2073 -0
- yaylib-0.0.0/yaylib/responses.py +1297 -0
- yaylib-0.0.0/yaylib/state.py +401 -0
- yaylib-0.0.0/yaylib/utils.py +209 -0
- yaylib-0.0.0/yaylib/ws.py +244 -0
yaylib-0.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 ekkx
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
yaylib-0.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: yaylib
|
|
3
|
+
Version: 0.0.0
|
|
4
|
+
Summary: 同世代と趣味の通話コミュニティ - Yay! (イェイ) で投稿やタイムラインの取得、リツイートやいいねの実行、フォローや投稿の検索など様々な機能をPythonプログラムから利用可能なAPIクライアントツールです。
|
|
5
|
+
Home-page: https://github.com/ekkx/yaylib
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: yay,yaylib,api,bot,tool,client,library,wrapper,ボット,ライブラリ,ツール
|
|
8
|
+
Author: ekkx
|
|
9
|
+
Author-email: nikola.desuga@gmail.com
|
|
10
|
+
Requires-Python: >=3.10,<3.12
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Requires-Dist: aiohttp (==3.9.5)
|
|
16
|
+
Requires-Dist: cryptography (==41.0.1)
|
|
17
|
+
Requires-Dist: pillow (==9.3.0)
|
|
18
|
+
Project-URL: Repository, https://github.com/ekkx/yaylib
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
|
|
21
|
+
<div><a id="readme-top"></a></div>
|
|
22
|
+
<div align="center">
|
|
23
|
+
<img src="https://img.shields.io/github/stars/ekkx/yaylib?style=for-the-badge&logo=appveyor&color=blue" />
|
|
24
|
+
<img src="https://img.shields.io/github/forks/ekkx/yaylib?style=for-the-badge&logo=appveyor&color=blue" />
|
|
25
|
+
<img src="https://img.shields.io/github/issues/ekkx/yaylib?style=for-the-badge&logo=appveyor&color=informational" />
|
|
26
|
+
<img src="https://img.shields.io/github/issues-pr/ekkx/yaylib?style=for-the-badge&logo=appveyor&color=informational" />
|
|
27
|
+
</div>
|
|
28
|
+
<br />
|
|
29
|
+
<p align="center">
|
|
30
|
+
<a href="https://github.com/othneildrew/Best-README-Template">
|
|
31
|
+
<img src="https://github.com/ekkx/yaylib/assets/77382767/45c45b21-d812-4cad-8f27-315ffef53201" alt="Logo" height="300px">
|
|
32
|
+
</a>
|
|
33
|
+
<h3 align="center">yaylib</h3>
|
|
34
|
+
<p align="center">
|
|
35
|
+
好きでつながるバーチャルワールド - Yay!(イェイ)の API ライブラリ<br />
|
|
36
|
+
あらゆる操作の自動化や、ボットの開発が可能です。
|
|
37
|
+
<br />
|
|
38
|
+
<br />
|
|
39
|
+
<a href="https://github.com/ekkx/yay.js">
|
|
40
|
+
<strong>Node.js 版はこちらから »</strong>
|
|
41
|
+
</a>
|
|
42
|
+
<br />
|
|
43
|
+
<br />
|
|
44
|
+
<a href="https://github.com/ekkx/yaylib/issues">Report Bug</a>
|
|
45
|
+
·
|
|
46
|
+
<a href="https://github.com/ekkx/yaylib/issues">Request Feature</a>
|
|
47
|
+
·
|
|
48
|
+
<a href="https://discord.gg/MEuBfNtqRN">Join the discord</a>
|
|
49
|
+
</p>
|
|
50
|
+
</p>
|
|
51
|
+
|
|
52
|
+
<!-- TABLE OF CONTENTS -->
|
|
53
|
+
|
|
54
|
+
<details>
|
|
55
|
+
<summary>Table of Contents</summary>
|
|
56
|
+
<ol>
|
|
57
|
+
<li><a href="#buy-me-a-coffee">Buy me a coffee</a></li>
|
|
58
|
+
<li><a href="#-installation">インストール</a></li>
|
|
59
|
+
<li><a href="#-quick-example">使用例</a></li>
|
|
60
|
+
<li><a href="#crown-yaylib-で誕生したロボットたち">yaylib で誕生したロボットたち</a></li>
|
|
61
|
+
<li><a href="#handshake-共同開発について">共同開発について</a></li>
|
|
62
|
+
<li><a href="#免責事項">免責事項</a></li>
|
|
63
|
+
<li><a href="#利用許諾">利用許諾</a></li>
|
|
64
|
+
</ol>
|
|
65
|
+
</details>
|
|
66
|
+
|
|
67
|
+
<!-- Buy me a coffee -->
|
|
68
|
+
|
|
69
|
+
## Buy me a coffee
|
|
70
|
+
|
|
71
|
+
このライブラリが気に入っていただけたら、<a href="https://github.com/ekkx/yaylib/">**リポジトリにスターをお願いします</a>(⭐)**
|
|
72
|
+
また、Buy Me a Coffee からご支援いただけますと幸いです。
|
|
73
|
+
|
|
74
|
+
<a href="https://www.buymeacoffee.com/qvco" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: auto !important;width: auto !important;" ></a>
|
|
75
|
+
|
|
76
|
+
<!-- インストール -->
|
|
77
|
+
|
|
78
|
+
## [<img src="https://github.com/ekkx/yaylib/assets/77382767/2f632349-0cbc-4c81-bc19-11d24c8c142b" width="30" height="30" />](https://github.com/ekkx) Installation
|
|
79
|
+
|
|
80
|
+
**※ Python 3.10 以上のバージョンが必要です。**
|
|
81
|
+
|
|
82
|
+
「yaylib」をインストールするには、以下のコマンドをターミナル上で実行します:
|
|
83
|
+
|
|
84
|
+
```shell
|
|
85
|
+
pip install yaylib
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
<br>
|
|
89
|
+
|
|
90
|
+
> [!TIP]
|
|
91
|
+
> 開発環境をインストールする場合は、以下の手順を実行します:
|
|
92
|
+
|
|
93
|
+
```shell
|
|
94
|
+
git clone https://github.com/ekkx/yaylib.git
|
|
95
|
+
|
|
96
|
+
cd yaylib
|
|
97
|
+
|
|
98
|
+
make up
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
<!-- 使用例 -->
|
|
102
|
+
|
|
103
|
+
## [<img src="https://github.com/ekkx/yaylib/assets/77382767/dc7dcea0-c581-4039-8fc2-3994884d2ba3" width="30" height="30" />](https://github.com/ekkx) Quick Example
|
|
104
|
+
|
|
105
|
+
#### ✨ 投稿を作成する
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
import yaylib
|
|
109
|
+
|
|
110
|
+
client = yaylib.Client()
|
|
111
|
+
client.login(email="your_email", password="your_password")
|
|
112
|
+
|
|
113
|
+
client.create_post("Hello with yaylib!")
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
#### ✨ 埋め込みリンクの投稿を作成する
|
|
117
|
+
|
|
118
|
+
```python
|
|
119
|
+
import yaylib
|
|
120
|
+
|
|
121
|
+
client = yaylib.Client()
|
|
122
|
+
client.login(email="your_email", password="your_password")
|
|
123
|
+
|
|
124
|
+
client.create_post("Hello with yaylib!", shared_url="https://github.com/ekkx/yaylib")
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
#### ✨ 画像と一緒に投稿を作成する
|
|
128
|
+
|
|
129
|
+
```python
|
|
130
|
+
import yaylib
|
|
131
|
+
|
|
132
|
+
client = yaylib.Client()
|
|
133
|
+
client.login(email="your_email", password="your_password")
|
|
134
|
+
|
|
135
|
+
# 画像のパスを指定
|
|
136
|
+
image_paths = [
|
|
137
|
+
"./test1.jpg",
|
|
138
|
+
"./test2.jpg",
|
|
139
|
+
"./test3.jpg",
|
|
140
|
+
]
|
|
141
|
+
|
|
142
|
+
# 画像の使い道を指定
|
|
143
|
+
image_type = yaylib.ImageType.post
|
|
144
|
+
|
|
145
|
+
# サーバー上にアップロード
|
|
146
|
+
attachments = client.upload_image(image_paths, image_type)
|
|
147
|
+
|
|
148
|
+
# サーバー上のファイル名を指定する
|
|
149
|
+
# attachmentsが一つ飛ばしなのはオリジナル品質の画像のみを指定するため
|
|
150
|
+
client.create_post(
|
|
151
|
+
"Hello with yaylib!",
|
|
152
|
+
attachment_filename=attachments[0].filename,
|
|
153
|
+
attachment_2_filename=attachments[2].filename,
|
|
154
|
+
attachment_3_filename=attachments[4].filename,
|
|
155
|
+
)
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
#### ✨ タイムラインを 100 件取得する
|
|
159
|
+
|
|
160
|
+
```python
|
|
161
|
+
import yaylib
|
|
162
|
+
|
|
163
|
+
client = yaylib.Client()
|
|
164
|
+
|
|
165
|
+
timeline = client.get_timeline(number=100)
|
|
166
|
+
|
|
167
|
+
for post in timeline.posts:
|
|
168
|
+
print(post.user.nickname) # 投稿者名
|
|
169
|
+
print(post.text) # 本文
|
|
170
|
+
print(post.likes_count) # いいね数
|
|
171
|
+
print(post.reposts_count) # (´∀`∩)↑age↑の数
|
|
172
|
+
print(post.in_reply_to_post_count) # 返信の数
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
#### ✨ タイムラインをキーワードで検索して「いいね」する
|
|
176
|
+
|
|
177
|
+
```python
|
|
178
|
+
import yaylib
|
|
179
|
+
|
|
180
|
+
client = yaylib.Client()
|
|
181
|
+
client.login(email="your_email", password="your_password")
|
|
182
|
+
|
|
183
|
+
timeline = client.get_timeline_by_keyword(
|
|
184
|
+
keyword="プログラミング",
|
|
185
|
+
number=15
|
|
186
|
+
)
|
|
187
|
+
|
|
188
|
+
for post in timeline.posts:
|
|
189
|
+
client.like(post.id)
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
#### ✨ 新規ユーザーをフォローする
|
|
193
|
+
|
|
194
|
+
```python
|
|
195
|
+
import yaylib
|
|
196
|
+
|
|
197
|
+
client = yaylib.Client()
|
|
198
|
+
client.login(email="your_email", password="your_password")
|
|
199
|
+
|
|
200
|
+
new_users = client.search_users(recently_created=True)
|
|
201
|
+
|
|
202
|
+
for new_user in new_users.users:
|
|
203
|
+
client.follow_user(new_user.id)
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
#### ✨ リアルタイムでチャットを取得する
|
|
207
|
+
|
|
208
|
+
```python
|
|
209
|
+
import yaylib
|
|
210
|
+
from yaylib import Message
|
|
211
|
+
|
|
212
|
+
class MyBot(yaylib.Client):
|
|
213
|
+
def on_ready(self):
|
|
214
|
+
print("ボットがオンラインになりました!")
|
|
215
|
+
|
|
216
|
+
def on_chat_request(self, total_count):
|
|
217
|
+
# チャットリクエストはすべて承認する
|
|
218
|
+
chat_requests = self.get_chat_requests()
|
|
219
|
+
for chat_room in chat_requests.chat_rooms:
|
|
220
|
+
self.accept_chat_requests([chat_room.id])
|
|
221
|
+
|
|
222
|
+
# 最新のメッセージをon_message_create関数に送信
|
|
223
|
+
message = self.get_messages(chat_requests.chat_rooms[0].id)
|
|
224
|
+
self.on_message_create(message[0])
|
|
225
|
+
|
|
226
|
+
def on_message_create(self, message: Message):
|
|
227
|
+
# 「ping」というメッセージに対して「pong」と返信する
|
|
228
|
+
if message.text == "ping":
|
|
229
|
+
self.send_message(message.room_id, text="pong")
|
|
230
|
+
|
|
231
|
+
def on_chat_room_delete(self, room_id):
|
|
232
|
+
print(f"チャットルームが削除されました。ルームID: {room_id}")
|
|
233
|
+
|
|
234
|
+
intents = yaylib.Intents.none()
|
|
235
|
+
intents.chat_message = True
|
|
236
|
+
|
|
237
|
+
bot = MyBot(intents=intents)
|
|
238
|
+
bot.run("your_email", "your_password")
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
より詳しい使用例については、[こちら](https://github.com/ekkx/yaylib/blob/master/examples) を参照してください。
|
|
242
|
+
|
|
243
|
+
<p align="right">(<a href="#readme-top">トップに戻る</a>)</p>
|
|
244
|
+
|
|
245
|
+
<!-- yaylib で誕生したボットの一覧 -->
|
|
246
|
+
|
|
247
|
+
## :crown: yaylib で誕生したロボットたち
|
|
248
|
+
|
|
249
|
+
「yaylib」を用いて開発したロボットがある場合は、ぜひ教えてください!
|
|
250
|
+
|
|
251
|
+
<table align="center">
|
|
252
|
+
<thead>
|
|
253
|
+
<tr>
|
|
254
|
+
<th><a href="https://yay.space/user/5855987">MindReader AI</a></th>
|
|
255
|
+
<th><a href="https://yay.space/user/7874560">☀️気象くん☁️</a></th>
|
|
256
|
+
<th><a href="https://yay.space/user/7406336">GIGAZINE</a></th>
|
|
257
|
+
</tr>
|
|
258
|
+
</thead>
|
|
259
|
+
<tbody>
|
|
260
|
+
<tr>
|
|
261
|
+
<td align="center">
|
|
262
|
+
<img src="https://github.com/ekkx/yaylib/assets/77382767/cc41ce3c-0e11-4ec5-be99-ff7090a95667" width="200px">
|
|
263
|
+
<br />
|
|
264
|
+
<p>開発者: <a href="https://yay.space/user/35152">毛の可能性</a></p>
|
|
265
|
+
</td>
|
|
266
|
+
<td align="center">
|
|
267
|
+
<img src="https://github.com/ekkx/yaylib/assets/77382767/4fd728a0-9b3a-427f-ac1f-70e6d6538564" width="200px">
|
|
268
|
+
<br />
|
|
269
|
+
<p>開発者: <a href="https://yay.space/user/7520368">tori</a></p>
|
|
270
|
+
</td>
|
|
271
|
+
<td align="center">
|
|
272
|
+
<img src="https://github.com/ekkx/yaylib/assets/77382767/65fcb885-4fbe-4170-9378-6f8d9af61ff8" width="200px">
|
|
273
|
+
<br />
|
|
274
|
+
<p>開発者: <a href="https://yay.space/user/1298298">ぺゅー</a></p>
|
|
275
|
+
</td>
|
|
276
|
+
</tr>
|
|
277
|
+
</tbody>
|
|
278
|
+
</table>
|
|
279
|
+
|
|
280
|
+
<!-- 共同開発について -->
|
|
281
|
+
|
|
282
|
+
## :handshake: 共同開発について
|
|
283
|
+
|
|
284
|
+
私たちと開発することに興味を持っていただけているなら、ぜひ参加して頂きたいです!
|
|
285
|
+
|
|
286
|
+
- [プルリクエストを送信する](https://github.com/ekkx/yaylib/pulls)
|
|
287
|
+
- [Discord サーバーに参加する](https://discord.gg/MEuBfNtqRN)
|
|
288
|
+
- [nikola.desuga@gmail.com](mailto:nikola.desuga@gmail.com) にメールを送信する
|
|
289
|
+
|
|
290
|
+
のいずれかの方法で繋がりましょう。詳しくは[こちらから](https://github.com/ekkx/yaylib/blob/master/CONTRIBUTING.md)!
|
|
291
|
+
|
|
292
|
+
<!-- 免責事項 -->
|
|
293
|
+
|
|
294
|
+
## 免責事項
|
|
295
|
+
|
|
296
|
+
yaylib は、API の公式なサポートやメンテナンスを提供するものではありません。このクライアントを使用する場合、**利用者はリスクや責任を自己負担できるもの**とします。このクライアントによって提供される情報やデータの正確性、信頼性、完全性、適時性について、いかなる保証も行いません。また、このクライアントの使用によって生じた損害や不利益について、一切の責任を負いかねます。利用者は自己の責任において、このクライアントを使用し、API にアクセスするものとします。なお、この免責事項は予告なく変更される場合があります。
|
|
297
|
+
|
|
298
|
+
<!-- ライセンス -->
|
|
299
|
+
|
|
300
|
+
## ライセンス
|
|
301
|
+
|
|
302
|
+
<p align="center">
|
|
303
|
+
<a href="https://github.com/ekkx">
|
|
304
|
+
<img src="https://github.com/ekkx/yaylib/assets/77382767/5d6aef18-5d98-4c9b-9f54-791308b393af" width="256" height="256">
|
|
305
|
+
</a>
|
|
306
|
+
</p>
|
|
307
|
+
|
|
308
|
+
<p align="center">
|
|
309
|
+
<strong>MIT © <a href="https://github.com/ekkx">ekkx</a></strong>
|
|
310
|
+
</p>
|
|
311
|
+
|
|
312
|
+
フルライセンスは [こちら](https://github.com/ekkx/yaylib/blob/master/LICENSE) からご確認いただけます。
|
|
313
|
+
このプロジェクトは、 **【MIT ライセンス】** の条件の下でライセンスされています。
|
|
314
|
+
|
|
315
|
+
<p align="right">(<a href="#readme-top">トップに戻る</a>)</p>
|
|
316
|
+
|
yaylib-0.0.0/README.md
ADDED
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
<div><a id="readme-top"></a></div>
|
|
2
|
+
<div align="center">
|
|
3
|
+
<img src="https://img.shields.io/github/stars/ekkx/yaylib?style=for-the-badge&logo=appveyor&color=blue" />
|
|
4
|
+
<img src="https://img.shields.io/github/forks/ekkx/yaylib?style=for-the-badge&logo=appveyor&color=blue" />
|
|
5
|
+
<img src="https://img.shields.io/github/issues/ekkx/yaylib?style=for-the-badge&logo=appveyor&color=informational" />
|
|
6
|
+
<img src="https://img.shields.io/github/issues-pr/ekkx/yaylib?style=for-the-badge&logo=appveyor&color=informational" />
|
|
7
|
+
</div>
|
|
8
|
+
<br />
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="https://github.com/othneildrew/Best-README-Template">
|
|
11
|
+
<img src="https://github.com/ekkx/yaylib/assets/77382767/45c45b21-d812-4cad-8f27-315ffef53201" alt="Logo" height="300px">
|
|
12
|
+
</a>
|
|
13
|
+
<h3 align="center">yaylib</h3>
|
|
14
|
+
<p align="center">
|
|
15
|
+
好きでつながるバーチャルワールド - Yay!(イェイ)の API ライブラリ<br />
|
|
16
|
+
あらゆる操作の自動化や、ボットの開発が可能です。
|
|
17
|
+
<br />
|
|
18
|
+
<br />
|
|
19
|
+
<a href="https://github.com/ekkx/yay.js">
|
|
20
|
+
<strong>Node.js 版はこちらから »</strong>
|
|
21
|
+
</a>
|
|
22
|
+
<br />
|
|
23
|
+
<br />
|
|
24
|
+
<a href="https://github.com/ekkx/yaylib/issues">Report Bug</a>
|
|
25
|
+
·
|
|
26
|
+
<a href="https://github.com/ekkx/yaylib/issues">Request Feature</a>
|
|
27
|
+
·
|
|
28
|
+
<a href="https://discord.gg/MEuBfNtqRN">Join the discord</a>
|
|
29
|
+
</p>
|
|
30
|
+
</p>
|
|
31
|
+
|
|
32
|
+
<!-- TABLE OF CONTENTS -->
|
|
33
|
+
|
|
34
|
+
<details>
|
|
35
|
+
<summary>Table of Contents</summary>
|
|
36
|
+
<ol>
|
|
37
|
+
<li><a href="#buy-me-a-coffee">Buy me a coffee</a></li>
|
|
38
|
+
<li><a href="#-installation">インストール</a></li>
|
|
39
|
+
<li><a href="#-quick-example">使用例</a></li>
|
|
40
|
+
<li><a href="#crown-yaylib-で誕生したロボットたち">yaylib で誕生したロボットたち</a></li>
|
|
41
|
+
<li><a href="#handshake-共同開発について">共同開発について</a></li>
|
|
42
|
+
<li><a href="#免責事項">免責事項</a></li>
|
|
43
|
+
<li><a href="#利用許諾">利用許諾</a></li>
|
|
44
|
+
</ol>
|
|
45
|
+
</details>
|
|
46
|
+
|
|
47
|
+
<!-- Buy me a coffee -->
|
|
48
|
+
|
|
49
|
+
## Buy me a coffee
|
|
50
|
+
|
|
51
|
+
このライブラリが気に入っていただけたら、<a href="https://github.com/ekkx/yaylib/">**リポジトリにスターをお願いします</a>(⭐)**
|
|
52
|
+
また、Buy Me a Coffee からご支援いただけますと幸いです。
|
|
53
|
+
|
|
54
|
+
<a href="https://www.buymeacoffee.com/qvco" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: auto !important;width: auto !important;" ></a>
|
|
55
|
+
|
|
56
|
+
<!-- インストール -->
|
|
57
|
+
|
|
58
|
+
## [<img src="https://github.com/ekkx/yaylib/assets/77382767/2f632349-0cbc-4c81-bc19-11d24c8c142b" width="30" height="30" />](https://github.com/ekkx) Installation
|
|
59
|
+
|
|
60
|
+
**※ Python 3.10 以上のバージョンが必要です。**
|
|
61
|
+
|
|
62
|
+
「yaylib」をインストールするには、以下のコマンドをターミナル上で実行します:
|
|
63
|
+
|
|
64
|
+
```shell
|
|
65
|
+
pip install yaylib
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
<br>
|
|
69
|
+
|
|
70
|
+
> [!TIP]
|
|
71
|
+
> 開発環境をインストールする場合は、以下の手順を実行します:
|
|
72
|
+
|
|
73
|
+
```shell
|
|
74
|
+
git clone https://github.com/ekkx/yaylib.git
|
|
75
|
+
|
|
76
|
+
cd yaylib
|
|
77
|
+
|
|
78
|
+
make up
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
<!-- 使用例 -->
|
|
82
|
+
|
|
83
|
+
## [<img src="https://github.com/ekkx/yaylib/assets/77382767/dc7dcea0-c581-4039-8fc2-3994884d2ba3" width="30" height="30" />](https://github.com/ekkx) Quick Example
|
|
84
|
+
|
|
85
|
+
#### ✨ 投稿を作成する
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
import yaylib
|
|
89
|
+
|
|
90
|
+
client = yaylib.Client()
|
|
91
|
+
client.login(email="your_email", password="your_password")
|
|
92
|
+
|
|
93
|
+
client.create_post("Hello with yaylib!")
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
#### ✨ 埋め込みリンクの投稿を作成する
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
import yaylib
|
|
100
|
+
|
|
101
|
+
client = yaylib.Client()
|
|
102
|
+
client.login(email="your_email", password="your_password")
|
|
103
|
+
|
|
104
|
+
client.create_post("Hello with yaylib!", shared_url="https://github.com/ekkx/yaylib")
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
#### ✨ 画像と一緒に投稿を作成する
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
import yaylib
|
|
111
|
+
|
|
112
|
+
client = yaylib.Client()
|
|
113
|
+
client.login(email="your_email", password="your_password")
|
|
114
|
+
|
|
115
|
+
# 画像のパスを指定
|
|
116
|
+
image_paths = [
|
|
117
|
+
"./test1.jpg",
|
|
118
|
+
"./test2.jpg",
|
|
119
|
+
"./test3.jpg",
|
|
120
|
+
]
|
|
121
|
+
|
|
122
|
+
# 画像の使い道を指定
|
|
123
|
+
image_type = yaylib.ImageType.post
|
|
124
|
+
|
|
125
|
+
# サーバー上にアップロード
|
|
126
|
+
attachments = client.upload_image(image_paths, image_type)
|
|
127
|
+
|
|
128
|
+
# サーバー上のファイル名を指定する
|
|
129
|
+
# attachmentsが一つ飛ばしなのはオリジナル品質の画像のみを指定するため
|
|
130
|
+
client.create_post(
|
|
131
|
+
"Hello with yaylib!",
|
|
132
|
+
attachment_filename=attachments[0].filename,
|
|
133
|
+
attachment_2_filename=attachments[2].filename,
|
|
134
|
+
attachment_3_filename=attachments[4].filename,
|
|
135
|
+
)
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
#### ✨ タイムラインを 100 件取得する
|
|
139
|
+
|
|
140
|
+
```python
|
|
141
|
+
import yaylib
|
|
142
|
+
|
|
143
|
+
client = yaylib.Client()
|
|
144
|
+
|
|
145
|
+
timeline = client.get_timeline(number=100)
|
|
146
|
+
|
|
147
|
+
for post in timeline.posts:
|
|
148
|
+
print(post.user.nickname) # 投稿者名
|
|
149
|
+
print(post.text) # 本文
|
|
150
|
+
print(post.likes_count) # いいね数
|
|
151
|
+
print(post.reposts_count) # (´∀`∩)↑age↑の数
|
|
152
|
+
print(post.in_reply_to_post_count) # 返信の数
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
#### ✨ タイムラインをキーワードで検索して「いいね」する
|
|
156
|
+
|
|
157
|
+
```python
|
|
158
|
+
import yaylib
|
|
159
|
+
|
|
160
|
+
client = yaylib.Client()
|
|
161
|
+
client.login(email="your_email", password="your_password")
|
|
162
|
+
|
|
163
|
+
timeline = client.get_timeline_by_keyword(
|
|
164
|
+
keyword="プログラミング",
|
|
165
|
+
number=15
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
for post in timeline.posts:
|
|
169
|
+
client.like(post.id)
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
#### ✨ 新規ユーザーをフォローする
|
|
173
|
+
|
|
174
|
+
```python
|
|
175
|
+
import yaylib
|
|
176
|
+
|
|
177
|
+
client = yaylib.Client()
|
|
178
|
+
client.login(email="your_email", password="your_password")
|
|
179
|
+
|
|
180
|
+
new_users = client.search_users(recently_created=True)
|
|
181
|
+
|
|
182
|
+
for new_user in new_users.users:
|
|
183
|
+
client.follow_user(new_user.id)
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
#### ✨ リアルタイムでチャットを取得する
|
|
187
|
+
|
|
188
|
+
```python
|
|
189
|
+
import yaylib
|
|
190
|
+
from yaylib import Message
|
|
191
|
+
|
|
192
|
+
class MyBot(yaylib.Client):
|
|
193
|
+
def on_ready(self):
|
|
194
|
+
print("ボットがオンラインになりました!")
|
|
195
|
+
|
|
196
|
+
def on_chat_request(self, total_count):
|
|
197
|
+
# チャットリクエストはすべて承認する
|
|
198
|
+
chat_requests = self.get_chat_requests()
|
|
199
|
+
for chat_room in chat_requests.chat_rooms:
|
|
200
|
+
self.accept_chat_requests([chat_room.id])
|
|
201
|
+
|
|
202
|
+
# 最新のメッセージをon_message_create関数に送信
|
|
203
|
+
message = self.get_messages(chat_requests.chat_rooms[0].id)
|
|
204
|
+
self.on_message_create(message[0])
|
|
205
|
+
|
|
206
|
+
def on_message_create(self, message: Message):
|
|
207
|
+
# 「ping」というメッセージに対して「pong」と返信する
|
|
208
|
+
if message.text == "ping":
|
|
209
|
+
self.send_message(message.room_id, text="pong")
|
|
210
|
+
|
|
211
|
+
def on_chat_room_delete(self, room_id):
|
|
212
|
+
print(f"チャットルームが削除されました。ルームID: {room_id}")
|
|
213
|
+
|
|
214
|
+
intents = yaylib.Intents.none()
|
|
215
|
+
intents.chat_message = True
|
|
216
|
+
|
|
217
|
+
bot = MyBot(intents=intents)
|
|
218
|
+
bot.run("your_email", "your_password")
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
より詳しい使用例については、[こちら](https://github.com/ekkx/yaylib/blob/master/examples) を参照してください。
|
|
222
|
+
|
|
223
|
+
<p align="right">(<a href="#readme-top">トップに戻る</a>)</p>
|
|
224
|
+
|
|
225
|
+
<!-- yaylib で誕生したボットの一覧 -->
|
|
226
|
+
|
|
227
|
+
## :crown: yaylib で誕生したロボットたち
|
|
228
|
+
|
|
229
|
+
「yaylib」を用いて開発したロボットがある場合は、ぜひ教えてください!
|
|
230
|
+
|
|
231
|
+
<table align="center">
|
|
232
|
+
<thead>
|
|
233
|
+
<tr>
|
|
234
|
+
<th><a href="https://yay.space/user/5855987">MindReader AI</a></th>
|
|
235
|
+
<th><a href="https://yay.space/user/7874560">☀️気象くん☁️</a></th>
|
|
236
|
+
<th><a href="https://yay.space/user/7406336">GIGAZINE</a></th>
|
|
237
|
+
</tr>
|
|
238
|
+
</thead>
|
|
239
|
+
<tbody>
|
|
240
|
+
<tr>
|
|
241
|
+
<td align="center">
|
|
242
|
+
<img src="https://github.com/ekkx/yaylib/assets/77382767/cc41ce3c-0e11-4ec5-be99-ff7090a95667" width="200px">
|
|
243
|
+
<br />
|
|
244
|
+
<p>開発者: <a href="https://yay.space/user/35152">毛の可能性</a></p>
|
|
245
|
+
</td>
|
|
246
|
+
<td align="center">
|
|
247
|
+
<img src="https://github.com/ekkx/yaylib/assets/77382767/4fd728a0-9b3a-427f-ac1f-70e6d6538564" width="200px">
|
|
248
|
+
<br />
|
|
249
|
+
<p>開発者: <a href="https://yay.space/user/7520368">tori</a></p>
|
|
250
|
+
</td>
|
|
251
|
+
<td align="center">
|
|
252
|
+
<img src="https://github.com/ekkx/yaylib/assets/77382767/65fcb885-4fbe-4170-9378-6f8d9af61ff8" width="200px">
|
|
253
|
+
<br />
|
|
254
|
+
<p>開発者: <a href="https://yay.space/user/1298298">ぺゅー</a></p>
|
|
255
|
+
</td>
|
|
256
|
+
</tr>
|
|
257
|
+
</tbody>
|
|
258
|
+
</table>
|
|
259
|
+
|
|
260
|
+
<!-- 共同開発について -->
|
|
261
|
+
|
|
262
|
+
## :handshake: 共同開発について
|
|
263
|
+
|
|
264
|
+
私たちと開発することに興味を持っていただけているなら、ぜひ参加して頂きたいです!
|
|
265
|
+
|
|
266
|
+
- [プルリクエストを送信する](https://github.com/ekkx/yaylib/pulls)
|
|
267
|
+
- [Discord サーバーに参加する](https://discord.gg/MEuBfNtqRN)
|
|
268
|
+
- [nikola.desuga@gmail.com](mailto:nikola.desuga@gmail.com) にメールを送信する
|
|
269
|
+
|
|
270
|
+
のいずれかの方法で繋がりましょう。詳しくは[こちらから](https://github.com/ekkx/yaylib/blob/master/CONTRIBUTING.md)!
|
|
271
|
+
|
|
272
|
+
<!-- 免責事項 -->
|
|
273
|
+
|
|
274
|
+
## 免責事項
|
|
275
|
+
|
|
276
|
+
yaylib は、API の公式なサポートやメンテナンスを提供するものではありません。このクライアントを使用する場合、**利用者はリスクや責任を自己負担できるもの**とします。このクライアントによって提供される情報やデータの正確性、信頼性、完全性、適時性について、いかなる保証も行いません。また、このクライアントの使用によって生じた損害や不利益について、一切の責任を負いかねます。利用者は自己の責任において、このクライアントを使用し、API にアクセスするものとします。なお、この免責事項は予告なく変更される場合があります。
|
|
277
|
+
|
|
278
|
+
<!-- ライセンス -->
|
|
279
|
+
|
|
280
|
+
## ライセンス
|
|
281
|
+
|
|
282
|
+
<p align="center">
|
|
283
|
+
<a href="https://github.com/ekkx">
|
|
284
|
+
<img src="https://github.com/ekkx/yaylib/assets/77382767/5d6aef18-5d98-4c9b-9f54-791308b393af" width="256" height="256">
|
|
285
|
+
</a>
|
|
286
|
+
</p>
|
|
287
|
+
|
|
288
|
+
<p align="center">
|
|
289
|
+
<strong>MIT © <a href="https://github.com/ekkx">ekkx</a></strong>
|
|
290
|
+
</p>
|
|
291
|
+
|
|
292
|
+
フルライセンスは [こちら](https://github.com/ekkx/yaylib/blob/master/LICENSE) からご確認いただけます。
|
|
293
|
+
このプロジェクトは、 **【MIT ライセンス】** の条件の下でライセンスされています。
|
|
294
|
+
|
|
295
|
+
<p align="right">(<a href="#readme-top">トップに戻る</a>)</p>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "yaylib"
|
|
3
|
+
version = "0.0.0"
|
|
4
|
+
description = "同世代と趣味の通話コミュニティ - Yay! (イェイ) で投稿やタイムラインの取得、リツイートやいいねの実行、フォローや投稿の検索など様々な機能をPythonプログラムから利用可能なAPIクライアントツールです。"
|
|
5
|
+
authors = ["ekkx <nikola.desuga@gmail.com>"]
|
|
6
|
+
license = "MIT"
|
|
7
|
+
readme = "README.md"
|
|
8
|
+
homepage = "https://github.com/ekkx/yaylib"
|
|
9
|
+
repository = "https://github.com/ekkx/yaylib"
|
|
10
|
+
keywords = [
|
|
11
|
+
"yay",
|
|
12
|
+
"yaylib",
|
|
13
|
+
"api",
|
|
14
|
+
"bot",
|
|
15
|
+
"tool",
|
|
16
|
+
"client",
|
|
17
|
+
"library",
|
|
18
|
+
"wrapper",
|
|
19
|
+
"ボット",
|
|
20
|
+
"ライブラリ",
|
|
21
|
+
"ツール"
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
[tool.poetry.dependencies]
|
|
25
|
+
python = ">=3.10,<3.12"
|
|
26
|
+
aiohttp = "3.9.5"
|
|
27
|
+
pillow = "9.3.0"
|
|
28
|
+
cryptography = "41.0.1"
|
|
29
|
+
|
|
30
|
+
[tool.poetry.group.dev.dependencies]
|
|
31
|
+
sphinx = "*"
|
|
32
|
+
shibuya = "*"
|
|
33
|
+
sphinx_copybutton = "*"
|
|
34
|
+
sphinx-design = "*"
|
|
35
|
+
|
|
36
|
+
[tool.poetry-version-plugin]
|
|
37
|
+
source = "init"
|
|
38
|
+
|
|
39
|
+
[build-system]
|
|
40
|
+
requires = ["poetry-core"]
|
|
41
|
+
build-backend = "poetry.core.masonry.api"
|