Skip to content

Commit 2346c22

Browse files
committed
FIxed
0 parents  commit 2346c22

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+11442
-0
lines changed

.github/FUNDING.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github: d60
2+
buy_me_a_coffee: d60py

.readthedocs.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: 2
2+
3+
build:
4+
os: ubuntu-22.04
5+
tools:
6+
python: "3.12"
7+
8+
sphinx:
9+
configuration: docs/conf.py
10+
11+
python:
12+
install:
13+
- requirements: "docs/requirements.txt"

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 d60
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.

README-ja.md

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
<img src="https://i.imgur.com/iJe6rsZ.png" width="500">
2+
3+
4+
5+
![Number of GitHub stars](https://img.shields.io/github/stars/d60/twikit)
6+
![GitHub commit activity](https://img.shields.io/github/commit-activity/m/d60/twikit)
7+
![Version](https://img.shields.io/pypi/v/twikit?label=PyPI)
8+
[![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=Create%20your%20own%20Twitter%20bot%20for%20free%20with%20%22Twikit%22!%20%23python%20%23twitter%20%23twikit%20%23programming%20%23github%20%23bot&url=https%3A%2F%2Fgithub.com%2Fd60%2Ftwikit)
9+
[![Discord](https://img.shields.io/badge/Discord-%235865F2.svg?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/nCrByrr8cX)
10+
[![BuyMeACoffee](https://img.shields.io/badge/-buy_me_a%C2%A0coffee-gray?logo=buy-me-a-coffee)](https://www.buymeacoffee.com/d60py)
11+
12+
[[English](https://github.com/d60/twikit/blob/main/README.md)]
13+
[[中文](https://github.com/d60/twikit/blob/main/README-zh.md)]
14+
15+
# Twikit <img height="35" src="https://i.imgur.com/9HSdIl4.png" valign="bottom">
16+
17+
このライブラリを使用することで、APIキーなしで、ツイートの投稿や検索などの機能を使用することができます。
18+
19+
- [ドキュメント](https://twikit.readthedocs.io/en/latest/twikit.html)
20+
21+
[Discord](https://discord.gg/nCrByrr8cX)
22+
23+
24+
25+
## 特徴
26+
27+
### APIキー不要
28+
29+
このライブラリは、ツイッターの非公式APIを使用しているため、APIキーは必要ありません。
30+
31+
### 無料
32+
33+
このライブラリは、無料で使用することができます。
34+
35+
36+
## 機能
37+
38+
このライブラリを使用することで、
39+
40+
- ツイートの投稿
41+
42+
- ツイートの検索
43+
44+
- トレンドの取得
45+
46+
などのさまざまな機能を使用することができます。
47+
48+
49+
50+
## インストール
51+
52+
```bash
53+
54+
pip install twikit
55+
56+
```
57+
58+
59+
## 使用例
60+
61+
**クライアントを定義し、アカウントにログインする。**
62+
63+
```python
64+
import asyncio
65+
from twikit import Client
66+
67+
USERNAME = 'example_user'
68+
EMAIL = 'email@example.com'
69+
PASSWORD = 'password0000'
70+
71+
# Initialize client
72+
client = Client('en-US')
73+
74+
async def main():
75+
# アカウントにログイン
76+
client.login(
77+
auth_info_1=USERNAME ,
78+
auth_info_2=EMAIL,
79+
password=PASSWORD
80+
)
81+
82+
asyncio.run(main())
83+
```
84+
85+
**メディア付きツイートを作成する。**
86+
87+
```python
88+
# メディアをアップロードし、メディアIDを取得する。
89+
media_ids = [
90+
await client.upload_media('media1.jpg'),
91+
await client.upload_media('media2.jpg')
92+
]
93+
94+
# ツイートを投稿する
95+
await client.create_tweet(
96+
text='Example Tweet',
97+
media_ids=media_ids
98+
)
99+
100+
```
101+
102+
**ツイートを検索する**
103+
```python
104+
tweets = await client.search_tweet('python', 'Latest')
105+
106+
for tweet in tweets:
107+
print(
108+
tweet.user.name,
109+
tweet.text,
110+
tweet.created_at
111+
)
112+
```
113+
114+
**ユーザーのツイートを取得する**
115+
```python
116+
tweets = await client.get_user_tweets('123456', 'Tweet')
117+
118+
for tweet in tweets:
119+
print(tweet.text)
120+
```
121+
122+
**トレンドを取得する**
123+
```python
124+
await client.get_trends('trending')
125+
```
126+
127+
[examples](https://github.com/d60/twikit/tree/main/examples)<br>

README-zh.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
<img src="https://i.imgur.com/iJe6rsZ.png" width="500">
2+
3+
4+
5+
![Number of GitHub stars](https://img.shields.io/github/stars/d60/twikit)
6+
![GitHub commit activity](https://img.shields.io/github/commit-activity/m/d60/twikit)
7+
![Version](https://img.shields.io/pypi/v/twikit?label=PyPI)
8+
[![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=Create%20your%20own%20Twitter%20bot%20for%20free%20with%20%22Twikit%22!%20%23python%20%23twitter%20%23twikit%20%23programming%20%23github%20%23bot&url=https%3A%2F%2Fgithub.com%2Fd60%2Ftwikit)
9+
[![Discord](https://img.shields.io/badge/Discord-%235865F2.svg?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/nCrByrr8cX)
10+
[![BuyMeACoffee](https://img.shields.io/badge/-buy_me_a%C2%A0coffee-gray?logo=buy-me-a-coffee)](https://www.buymeacoffee.com/d60py)
11+
12+
[[English](https://github.com/d60/twikit/blob/main/README.md)]
13+
[[日本語](https://github.com/d60/twikit/blob/main/README-ja.md)]
14+
15+
# Twikit <img height="35" src="https://i.imgur.com/9HSdIl4.png" valign="bottom">
16+
17+
一个简单的爬取 Twitter API 的客户端。
18+
19+
本库提供的函数允许你进行对推特的操作,如发布或搜索推文,并且无需开发者 API 密钥。
20+
21+
- [文档(英文)](https://twikit.readthedocs.io/en/latest/twikit.html)
22+
23+
[Discord 服务器](https://discord.gg/nCrByrr8cX)
24+
25+
26+
27+
## 特性
28+
29+
### 无需开发者 API 密钥
30+
31+
本库直接爬取推特的公共 API 进行请求,无需申请官方开发者密钥。
32+
33+
### 免费
34+
35+
本库无需付费。
36+
37+
38+
## 功能
39+
40+
使用 Twikit,你可以:
41+
42+
- 创建推文
43+
44+
- 搜索推文
45+
46+
- 检索热门话题
47+
48+
- 等等...
49+
50+
51+
52+
## 安装
53+
54+
```bash
55+
56+
pip install twikit
57+
58+
```
59+
60+
61+
## 使用样例
62+
63+
**定义一个客户端并登录**
64+
65+
```python
66+
import asyncio
67+
from twikit import Client
68+
69+
USERNAME = 'example_user'
70+
EMAIL = 'email@example.com'
71+
PASSWORD = 'password0000'
72+
73+
# 初始化客户端
74+
client = Client('en-US')
75+
76+
async def main():
77+
await client.login(
78+
auth_info_1=USERNAME ,
79+
auth_info_2=EMAIL,
80+
password=PASSWORD
81+
)
82+
83+
asyncio.run(main())
84+
```
85+
86+
**创建一条附带媒体的推文**
87+
88+
```python
89+
# 上传媒体文件并获取媒体ID
90+
media_ids = [
91+
await client.upload_media('media1.jpg'),
92+
await client.upload_media('media2.jpg')
93+
]
94+
95+
# 创建一条带有提供的文本和附加媒体的推文
96+
await client.create_tweet(
97+
text='Example Tweet',
98+
media_ids=media_ids
99+
)
100+
101+
```
102+
103+
**搜索推文**
104+
```python
105+
tweets = await client.search_tweet('python', 'Latest')
106+
107+
for tweet in tweets:
108+
print(
109+
tweet.user.name,
110+
tweet.text,
111+
tweet.created_at
112+
)
113+
```
114+
115+
**检索用户的推文**
116+
```python
117+
tweets = await client.get_user_tweets('123456', 'Tweet')
118+
119+
for tweet in tweets:
120+
print(tweet.text)
121+
```
122+
123+
**获取趋势**
124+
```python
125+
await client.get_trends('trending')
126+
```
127+
128+
[更多样例...](https://github.com/d60/twikit/tree/main/examples)<br>

0 commit comments

Comments
 (0)