Skip to content

Commit e4dce5d

Browse files
committed
v0.16.0
1 parent 5488037 commit e4dce5d

File tree

4 files changed

+34
-22
lines changed

4 files changed

+34
-22
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,7 @@ jobs:
4646

4747
- name: Create Github Release
4848
uses: softprops/action-gh-release@v2
49+
with:
50+
generate_release_notes: true
4951
env:
5052
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
"[toml]": {
88
"editor.defaultFormatter": "tamasfe.even-better-toml"
99
},
10+
"[markdown]": {
11+
"editor.wordWrap": "wordWrapColumn",
12+
"editor.wordWrapColumn": 99
13+
},
1014
"files.exclude": {
1115
".ruff_cache": true,
1216
".pytest_cache": true,

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "twscrape"
7-
version = "0.15.0"
7+
version = "0.16.0"
88
authors = [{ name = "vladkens", email = "v.pronsky@gmail.com" }]
99
description = "Twitter GraphQL and Search API implementation with SNScrape data models"
1010
readme = "readme.md"

readme.md

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -36,31 +36,37 @@ pip install git+https://github.com/vladkens/twscrape.git
3636

3737
## Usage
3838

39-
Since this project works through an authorized API, accounts need to be added. You can register and add an account yourself. You can also google sites that provide these things.
39+
This project requires authorized X/Twitter accounts to work with the API. You have two options:
4040

41-
The email password is needed to get the code to log in to the account automatically (via imap protocol).
41+
1. **Create Your Own Account**: While you can register a new account on X/Twitter yourself, it's can be difficult due to strict verification processes and high ban rates.
4242

43-
Data models:
44-
- [User](https://github.com/vladkens/twscrape/blob/main/twscrape/models.py#L87)
45-
- [Tweet](https://github.com/vladkens/twscrape/blob/main/twscrape/models.py#L136)
43+
2. **Use Ready Accounts**: For immediate access, you can get ready-to-use accounts with cookies from [our recommended provider](https://kutt.it/ueeM5f). Cookie-based accounts typically have fewer login issues.
44+
45+
For optimal performance and to avoid IP-based restrictions, we also recommend using proxies from [our provider](https://kutt.it/eb3rXk).
46+
47+
**Disclaimer**: While X/Twitter's Terms of Service discourage using multiple accounts, this is a common practice for data collection and research purposes. Use responsibly and at your own discretion.
4648

4749
```python
4850
import asyncio
4951
from twscrape import API, gather
5052
from twscrape.logger import set_log_level
5153

5254
async def main():
53-
api = API() # or API("path-to.db") - default is `accounts.db`
55+
api = API() # or API("path-to.db") default is `accounts.db`
5456

55-
# ADD ACCOUNTS (for CLI usage see BELOW)
56-
await api.pool.add_account("user1", "pass1", "u1@example.com", "mail_pass1")
57-
await api.pool.add_account("user2", "pass2", "u2@example.com", "mail_pass2")
58-
await api.pool.login_all()
57+
# ADD ACCOUNTS (for CLI usage see next readme section)
5958

60-
# or add account with COOKIES (with cookies login not required)
59+
# Option 1. Adding account with cookies (more stable)
6160
cookies = "abc=12; ct0=xyz" # or '{"abc": "12", "ct0": "xyz"}'
6261
await api.pool.add_account("user3", "pass3", "u3@mail.com", "mail_pass3", cookies=cookies)
6362

63+
# Option2. Adding account with login / password (less stable)
64+
# email login / password required to receive the verification code via IMAP protocol
65+
# (not all email providers are supported, e.g. ProtonMail)
66+
await api.pool.add_account("user1", "pass1", "u1@example.com", "mail_pass1")
67+
await api.pool.add_account("user2", "pass2", "u2@example.com", "mail_pass2")
68+
await api.pool.login_all() # try to login to receive account cookies
69+
6470
# API USAGE
6571

6672
# search (latest tab)
@@ -311,21 +317,21 @@ So if you want to use proxy PER ACCOUNT, do NOT override proxy with env variable
311317

312318
_Note:_ If proxy not working, exception will be raised from API class.
313319

314-
## Environment variables
320+
## Environment Variables
315321

316-
- `TWS_WAIT_EMAIL_CODE` – timeout for email verification code during login (default: `30`, in seconds)
317-
- `TWS_RAISE_WHEN_NO_ACCOUNT` – raise `NoAccountError` exception when no available accounts right now, instead of waiting for availability (default: `false`, possible value: `false` / `0` / `true` / `1`)
322+
- `TWS_PROXY` - global proxy for all accounts (e.g. `socks5://user:pass@127.0.0.1:1080`)
323+
- `TWS_WAIT_EMAIL_CODE` - timeout for email verification code during login (default: `30`, in seconds)
324+
- `TWS_RAISE_WHEN_NO_ACCOUNT` - raise `NoAccountError` exception when no available accounts, instead of waiting (default: `false`, values: `false`/`0`/`true`/`1`)
318325

319326
## Limitations
320327

321-
After 1 July 2023 Twitter [introduced new limits](https://x.com/elonmusk/status/1675187969420828672) and still continue to update it periodically.
322-
323-
The basic behaviour is as follows:
324-
- the request limit is updated every 15 minutes for each endpoint individually
325-
- e.g. each account have 50 search requests / 15 min, 50 profile requests / 15 min, etc.
328+
X/Twitter regularly [updates](https://x.com/elonmusk/status/1675187969420828672) their rate limits. Current basic behavior:
329+
- Request limits reset every 15 minutes for each endpoint individually
330+
- Each account has separate limits for different operations (search, profile views, etc.)
326331

327-
API data limits:
328-
- `user_tweets` & `user_tweets_and_replies` – can return ~3200 tweets maximum
332+
API data limitations:
333+
- `user_tweets` & `user_tweets_and_replies` - can return ~3200 tweets maximum
334+
- Rate limits may vary based on account age and status
329335

330336
## Articles
331337
- [How to still scrape millions of tweets in 2023](https://medium.com/@vladkens/how-to-still-scrape-millions-of-tweets-in-2023-using-twscrape-97f5d3881434)

0 commit comments

Comments
 (0)