twifork 2.3.3__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 (41) hide show
  1. twifork-2.3.3/LICENSE +21 -0
  2. twifork-2.3.3/PKG-INFO +168 -0
  3. twifork-2.3.3/README.md +137 -0
  4. twifork-2.3.3/setup.cfg +4 -0
  5. twifork-2.3.3/setup.py +37 -0
  6. twifork-2.3.3/twifork.egg-info/PKG-INFO +168 -0
  7. twifork-2.3.3/twifork.egg-info/SOURCES.txt +39 -0
  8. twifork-2.3.3/twifork.egg-info/dependency_links.txt +1 -0
  9. twifork-2.3.3/twifork.egg-info/requires.txt +11 -0
  10. twifork-2.3.3/twifork.egg-info/top_level.txt +1 -0
  11. twifork-2.3.3/twikit/__init__.py +31 -0
  12. twifork-2.3.3/twikit/_captcha/__init__.py +2 -0
  13. twifork-2.3.3/twikit/_captcha/base.py +114 -0
  14. twifork-2.3.3/twikit/_captcha/capsolver.py +95 -0
  15. twifork-2.3.3/twikit/bookmark.py +64 -0
  16. twifork-2.3.3/twikit/community.py +282 -0
  17. twifork-2.3.3/twikit/constants.py +382 -0
  18. twifork-2.3.3/twikit/errors.py +110 -0
  19. twifork-2.3.3/twikit/geo.py +82 -0
  20. twifork-2.3.3/twikit/group.py +259 -0
  21. twifork-2.3.3/twikit/guest/__init__.py +3 -0
  22. twifork-2.3.3/twikit/guest/client.py +412 -0
  23. twifork-2.3.3/twikit/guest/tweet.py +235 -0
  24. twifork-2.3.3/twikit/guest/user.py +202 -0
  25. twifork-2.3.3/twikit/list.py +255 -0
  26. twifork-2.3.3/twikit/media.py +357 -0
  27. twifork-2.3.3/twikit/message.py +143 -0
  28. twifork-2.3.3/twikit/notification.py +47 -0
  29. twifork-2.3.3/twikit/streaming.py +266 -0
  30. twifork-2.3.3/twikit/trend.py +94 -0
  31. twifork-2.3.3/twikit/tweet.py +789 -0
  32. twifork-2.3.3/twikit/ui_metrics/__init__.py +22 -0
  33. twifork-2.3.3/twikit/ui_metrics/dom.py +52 -0
  34. twifork-2.3.3/twikit/user.py +531 -0
  35. twifork-2.3.3/twikit/utils.py +394 -0
  36. twifork-2.3.3/twikit/x_client_transaction/__init__.py +8 -0
  37. twifork-2.3.3/twikit/x_client_transaction/cubic_curve.py +48 -0
  38. twifork-2.3.3/twikit/x_client_transaction/interpolate.py +23 -0
  39. twifork-2.3.3/twikit/x_client_transaction/rotation.py +27 -0
  40. twifork-2.3.3/twikit/x_client_transaction/transaction.py +165 -0
  41. twifork-2.3.3/twikit/x_client_transaction/utils.py +84 -0
twifork-2.3.3/LICENSE ADDED
@@ -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.
twifork-2.3.3/PKG-INFO ADDED
@@ -0,0 +1,168 @@
1
+ Metadata-Version: 2.4
2
+ Name: twifork
3
+ Version: 2.3.3
4
+ Summary: A maintained fork of twikit — Twitter/X API scraper for Python, no API key required.
5
+ Home-page: https://github.com/PawiX25/twifork
6
+ Author: PawiX25
7
+ License: MIT
8
+ Requires-Python: >=3.8
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ Requires-Dist: httpx[socks]
12
+ Requires-Dist: filetype
13
+ Requires-Dist: beautifulsoup4
14
+ Requires-Dist: pyotp
15
+ Requires-Dist: lxml
16
+ Requires-Dist: webvtt-py
17
+ Requires-Dist: m3u8
18
+ Requires-Dist: Js2Py-3.13
19
+ Provides-Extra: impersonate
20
+ Requires-Dist: curl_cffi<0.8,>=0.7; extra == "impersonate"
21
+ Dynamic: author
22
+ Dynamic: description
23
+ Dynamic: description-content-type
24
+ Dynamic: home-page
25
+ Dynamic: license
26
+ Dynamic: license-file
27
+ Dynamic: provides-extra
28
+ Dynamic: requires-dist
29
+ Dynamic: requires-python
30
+ Dynamic: summary
31
+
32
+ <p align="center">
33
+ <img src="https://raw.githubusercontent.com/PawiX25/twifork/main/assets/banner.png" width="640" alt="twifork">
34
+ </p>
35
+
36
+ <p align="center">
37
+ A <b>Twitter / X</b> API scraper for Python — <b>no API key required</b>.<br>
38
+ A maintained fork of <a href="https://github.com/d60/twikit">d60/twikit</a>, fixed for the 2026 breakages that make the upstream release unusable.
39
+ </p>
40
+
41
+ <p align="center">
42
+ <img src="https://img.shields.io/badge/python-3.8%2B-blue" alt="Python 3.8+">
43
+ <img src="https://img.shields.io/badge/license-MIT-green" alt="MIT License">
44
+ <img src="https://img.shields.io/github/stars/PawiX25/twifork?style=flat&color=yellow" alt="Stars">
45
+ </p>
46
+
47
+ > **Drop-in replacement** — the package still imports as `twikit`, so existing code (`from twikit import Client`) keeps working unchanged.
48
+
49
+ ---
50
+
51
+ ## Install
52
+
53
+ ```bash
54
+ pip install git+https://github.com/PawiX25/twifork.git
55
+ ```
56
+
57
+ Optional browser-TLS impersonation (gets past some `403` walls):
58
+
59
+ ```bash
60
+ pip install "twikit[impersonate] @ git+https://github.com/PawiX25/twifork.git"
61
+ ```
62
+
63
+ ## Why this fork?
64
+
65
+ The upstream PyPI release (`twikit==2.3.3`) is broken in several ways as of 2026. **twifork** fixes them — each item links to the upstream issue it resolves:
66
+
67
+ - **ClientTransaction / `Couldn't get KEY_BYTE indices`** — updated `ondemand.s.js` parsing for the new X webpack bundle, so GraphQL requests work again. ([#408](https://github.com/d60/twikit/issues/408), [#409](https://github.com/d60/twikit/issues/409), [#304](https://github.com/d60/twikit/issues/304))
68
+ - **Intermittent / sticky `404` on `SearchTimeline` and `friends/list`** — the `x-client-transaction-id` animation key was missing X's `frame_time` rounding step, so on some `Client` sessions every strict request 404'd until the client was recreated. Restored, so the semi-random 404s are gone. ([#357](https://github.com/d60/twikit/issues/357), [#397](https://github.com/d60/twikit/issues/397))
69
+ - **`KeyError` on missing optional fields** in `User.__init__` and `Client.request` — defensive `.get()` parsing. ([#417](https://github.com/d60/twikit/issues/417))
70
+ - **Empty user `name` / `screen_name`** (e.g. in search results) — X moved `name`, `screen_name`, `created_at`, avatar, location, and more out of `legacy` into new sub-objects; these are now read with a legacy fallback.
71
+ - **`get_tweet_by_id` `KeyError: 'itemContent'`** — handles both the legacy and the new trailing-cursor shapes. ([#332](https://github.com/d60/twikit/issues/332), [#363](https://github.com/d60/twikit/issues/363))
72
+ - **`KeyError: 'entries'` / `IndexError` on `get_user_tweets`** for accounts with no visible tweets — empty / cursor-less timelines return an empty result instead of crashing. ([#361](https://github.com/d60/twikit/issues/361), [#216](https://github.com/d60/twikit/issues/216))
73
+ - **`get_trends` deprecated / returns nothing** — rebuilt on top of `GenericTimelineById`; also adds `get_explore_page()`. ([#389](https://github.com/d60/twikit/issues/389))
74
+ - **`RecursionError` on rate-limit** — the 429 recovery path no longer recurses.
75
+ - **`GuestClient.activate()` 404** — the guest client now sends a `User-Agent` header and parses user fields defensively. ([#402](https://github.com/d60/twikit/issues/402), [#385](https://github.com/d60/twikit/issues/385))
76
+ - **`get_latest_friends` 404** — routed through the GraphQL `Following` endpoint after the v1.1 endpoint was retired. ([#397](https://github.com/d60/twikit/issues/397))
77
+ - **`'Client' object has no attribute '_ui_metrix'`** — fixed the captcha unlock path. ([#333](https://github.com/d60/twikit/issues/333))
78
+ - **`get_bookmark_folders().next()` infinite loop** — fixed malformed pagination variables. ([#334](https://github.com/d60/twikit/issues/334), [#335](https://github.com/d60/twikit/issues/335))
79
+ - **`get_latest_timeline` / `get_list_tweets` dropping conversation entries** — home- and list-conversation entries are now unpacked. ([#336](https://github.com/d60/twikit/issues/336), [#337](https://github.com/d60/twikit/issues/337), [#340](https://github.com/d60/twikit/issues/340))
80
+ - **`Media.source_url`** for the full-resolution image ([#376](https://github.com/d60/twikit/issues/376)), and **`Tweet.quoted_status_id`** for the quoted tweet id ([#222](https://github.com/d60/twikit/issues/222)).
81
+
82
+ Issues that stem from X-side restrictions (account suspension, Cloudflare/IP blocks, captcha, automation limits) aren't fixable in the library and are out of scope.
83
+
84
+ ### Browser TLS impersonation (optional)
85
+
86
+ Some X endpoints reject the default `httpx` TLS fingerprint with a `403` (HTML) response even when the request is valid. Installing the optional `curl_cffi` backend and passing `impersonate=` routes requests through a real browser TLS fingerprint, which avoids those 403s:
87
+
88
+ ```python
89
+ client = Client('en-US', impersonate='chrome124')
90
+ ```
91
+
92
+ ## Quick start
93
+
94
+ **Define a client and log in.**
95
+
96
+ ```python
97
+ import asyncio
98
+ from twikit import Client
99
+
100
+ client = Client('en-US')
101
+
102
+ async def main():
103
+ await client.login(
104
+ auth_info_1='example_user',
105
+ auth_info_2='email@example.com',
106
+ password='password0000',
107
+ cookies_file='cookies.json'
108
+ )
109
+
110
+ asyncio.run(main())
111
+ ```
112
+
113
+ **Post a tweet with media attached.**
114
+
115
+ ```python
116
+ media_ids = [
117
+ await client.upload_media('media1.jpg'),
118
+ await client.upload_media('media2.jpg'),
119
+ ]
120
+ await client.create_tweet(text='Example Tweet', media_ids=media_ids)
121
+ ```
122
+
123
+ **Search the latest tweets for a keyword.**
124
+
125
+ ```python
126
+ tweets = await client.search_tweet('python', 'Latest')
127
+ for tweet in tweets:
128
+ print(tweet.user.name, tweet.text, tweet.created_at)
129
+ ```
130
+
131
+ **A few more common calls.**
132
+
133
+ ```python
134
+ await client.get_user_tweets('123456', 'Tweets') # a user's tweets
135
+ await client.send_dm('123456789', 'Hello') # send a DM
136
+ await client.get_trends('trending') # trending topics
137
+ ```
138
+
139
+ More examples (upstream, still apply): https://github.com/d60/twikit/tree/main/examples
140
+
141
+ ## Features
142
+
143
+ - **No API key** — works by scraping the web client.
144
+ - **Free & open source** (MIT).
145
+ - **Drop-in `twikit` replacement** — same import, your code doesn't change.
146
+ - Tweets, search, timelines, trends, users, DMs, media, bookmarks, and more.
147
+
148
+ ## Documentation
149
+
150
+ Full API reference (upstream — the package surface is the same): https://twikit.readthedocs.io/en/latest/twikit.html
151
+
152
+ ## Community
153
+
154
+ [![Discord](https://img.shields.io/badge/Discord-%235865F2.svg?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/nCrByrr8cX)
155
+
156
+ ## Contributing
157
+
158
+ Found a bug or have a fix? Open an issue or PR on **[twifork issues](https://github.com/PawiX25/twifork/issues)**.
159
+
160
+ If twifork saved you a headache, consider leaving a ⭐.
161
+
162
+ ## Credits
163
+
164
+ twifork is a fork of **[d60/twikit](https://github.com/d60/twikit)** by [@d60](https://github.com/d60) — all upstream credit goes to the original authors. Licensed under the **MIT License**.
165
+
166
+ ## Disclaimer
167
+
168
+ twifork is an independent, unofficial project. It is **not affiliated with, endorsed by, or sponsored by X Corp.** "X" and "Twitter" are trademarks of X Corp. Use it in accordance with applicable terms and laws.
@@ -0,0 +1,137 @@
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/PawiX25/twifork/main/assets/banner.png" width="640" alt="twifork">
3
+ </p>
4
+
5
+ <p align="center">
6
+ A <b>Twitter / X</b> API scraper for Python — <b>no API key required</b>.<br>
7
+ A maintained fork of <a href="https://github.com/d60/twikit">d60/twikit</a>, fixed for the 2026 breakages that make the upstream release unusable.
8
+ </p>
9
+
10
+ <p align="center">
11
+ <img src="https://img.shields.io/badge/python-3.8%2B-blue" alt="Python 3.8+">
12
+ <img src="https://img.shields.io/badge/license-MIT-green" alt="MIT License">
13
+ <img src="https://img.shields.io/github/stars/PawiX25/twifork?style=flat&color=yellow" alt="Stars">
14
+ </p>
15
+
16
+ > **Drop-in replacement** — the package still imports as `twikit`, so existing code (`from twikit import Client`) keeps working unchanged.
17
+
18
+ ---
19
+
20
+ ## Install
21
+
22
+ ```bash
23
+ pip install git+https://github.com/PawiX25/twifork.git
24
+ ```
25
+
26
+ Optional browser-TLS impersonation (gets past some `403` walls):
27
+
28
+ ```bash
29
+ pip install "twikit[impersonate] @ git+https://github.com/PawiX25/twifork.git"
30
+ ```
31
+
32
+ ## Why this fork?
33
+
34
+ The upstream PyPI release (`twikit==2.3.3`) is broken in several ways as of 2026. **twifork** fixes them — each item links to the upstream issue it resolves:
35
+
36
+ - **ClientTransaction / `Couldn't get KEY_BYTE indices`** — updated `ondemand.s.js` parsing for the new X webpack bundle, so GraphQL requests work again. ([#408](https://github.com/d60/twikit/issues/408), [#409](https://github.com/d60/twikit/issues/409), [#304](https://github.com/d60/twikit/issues/304))
37
+ - **Intermittent / sticky `404` on `SearchTimeline` and `friends/list`** — the `x-client-transaction-id` animation key was missing X's `frame_time` rounding step, so on some `Client` sessions every strict request 404'd until the client was recreated. Restored, so the semi-random 404s are gone. ([#357](https://github.com/d60/twikit/issues/357), [#397](https://github.com/d60/twikit/issues/397))
38
+ - **`KeyError` on missing optional fields** in `User.__init__` and `Client.request` — defensive `.get()` parsing. ([#417](https://github.com/d60/twikit/issues/417))
39
+ - **Empty user `name` / `screen_name`** (e.g. in search results) — X moved `name`, `screen_name`, `created_at`, avatar, location, and more out of `legacy` into new sub-objects; these are now read with a legacy fallback.
40
+ - **`get_tweet_by_id` `KeyError: 'itemContent'`** — handles both the legacy and the new trailing-cursor shapes. ([#332](https://github.com/d60/twikit/issues/332), [#363](https://github.com/d60/twikit/issues/363))
41
+ - **`KeyError: 'entries'` / `IndexError` on `get_user_tweets`** for accounts with no visible tweets — empty / cursor-less timelines return an empty result instead of crashing. ([#361](https://github.com/d60/twikit/issues/361), [#216](https://github.com/d60/twikit/issues/216))
42
+ - **`get_trends` deprecated / returns nothing** — rebuilt on top of `GenericTimelineById`; also adds `get_explore_page()`. ([#389](https://github.com/d60/twikit/issues/389))
43
+ - **`RecursionError` on rate-limit** — the 429 recovery path no longer recurses.
44
+ - **`GuestClient.activate()` 404** — the guest client now sends a `User-Agent` header and parses user fields defensively. ([#402](https://github.com/d60/twikit/issues/402), [#385](https://github.com/d60/twikit/issues/385))
45
+ - **`get_latest_friends` 404** — routed through the GraphQL `Following` endpoint after the v1.1 endpoint was retired. ([#397](https://github.com/d60/twikit/issues/397))
46
+ - **`'Client' object has no attribute '_ui_metrix'`** — fixed the captcha unlock path. ([#333](https://github.com/d60/twikit/issues/333))
47
+ - **`get_bookmark_folders().next()` infinite loop** — fixed malformed pagination variables. ([#334](https://github.com/d60/twikit/issues/334), [#335](https://github.com/d60/twikit/issues/335))
48
+ - **`get_latest_timeline` / `get_list_tweets` dropping conversation entries** — home- and list-conversation entries are now unpacked. ([#336](https://github.com/d60/twikit/issues/336), [#337](https://github.com/d60/twikit/issues/337), [#340](https://github.com/d60/twikit/issues/340))
49
+ - **`Media.source_url`** for the full-resolution image ([#376](https://github.com/d60/twikit/issues/376)), and **`Tweet.quoted_status_id`** for the quoted tweet id ([#222](https://github.com/d60/twikit/issues/222)).
50
+
51
+ Issues that stem from X-side restrictions (account suspension, Cloudflare/IP blocks, captcha, automation limits) aren't fixable in the library and are out of scope.
52
+
53
+ ### Browser TLS impersonation (optional)
54
+
55
+ Some X endpoints reject the default `httpx` TLS fingerprint with a `403` (HTML) response even when the request is valid. Installing the optional `curl_cffi` backend and passing `impersonate=` routes requests through a real browser TLS fingerprint, which avoids those 403s:
56
+
57
+ ```python
58
+ client = Client('en-US', impersonate='chrome124')
59
+ ```
60
+
61
+ ## Quick start
62
+
63
+ **Define a client and log in.**
64
+
65
+ ```python
66
+ import asyncio
67
+ from twikit import Client
68
+
69
+ client = Client('en-US')
70
+
71
+ async def main():
72
+ await client.login(
73
+ auth_info_1='example_user',
74
+ auth_info_2='email@example.com',
75
+ password='password0000',
76
+ cookies_file='cookies.json'
77
+ )
78
+
79
+ asyncio.run(main())
80
+ ```
81
+
82
+ **Post a tweet with media attached.**
83
+
84
+ ```python
85
+ media_ids = [
86
+ await client.upload_media('media1.jpg'),
87
+ await client.upload_media('media2.jpg'),
88
+ ]
89
+ await client.create_tweet(text='Example Tweet', media_ids=media_ids)
90
+ ```
91
+
92
+ **Search the latest tweets for a keyword.**
93
+
94
+ ```python
95
+ tweets = await client.search_tweet('python', 'Latest')
96
+ for tweet in tweets:
97
+ print(tweet.user.name, tweet.text, tweet.created_at)
98
+ ```
99
+
100
+ **A few more common calls.**
101
+
102
+ ```python
103
+ await client.get_user_tweets('123456', 'Tweets') # a user's tweets
104
+ await client.send_dm('123456789', 'Hello') # send a DM
105
+ await client.get_trends('trending') # trending topics
106
+ ```
107
+
108
+ More examples (upstream, still apply): https://github.com/d60/twikit/tree/main/examples
109
+
110
+ ## Features
111
+
112
+ - **No API key** — works by scraping the web client.
113
+ - **Free & open source** (MIT).
114
+ - **Drop-in `twikit` replacement** — same import, your code doesn't change.
115
+ - Tweets, search, timelines, trends, users, DMs, media, bookmarks, and more.
116
+
117
+ ## Documentation
118
+
119
+ Full API reference (upstream — the package surface is the same): https://twikit.readthedocs.io/en/latest/twikit.html
120
+
121
+ ## Community
122
+
123
+ [![Discord](https://img.shields.io/badge/Discord-%235865F2.svg?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/nCrByrr8cX)
124
+
125
+ ## Contributing
126
+
127
+ Found a bug or have a fix? Open an issue or PR on **[twifork issues](https://github.com/PawiX25/twifork/issues)**.
128
+
129
+ If twifork saved you a headache, consider leaving a ⭐.
130
+
131
+ ## Credits
132
+
133
+ twifork is a fork of **[d60/twikit](https://github.com/d60/twikit)** by [@d60](https://github.com/d60) — all upstream credit goes to the original authors. Licensed under the **MIT License**.
134
+
135
+ ## Disclaimer
136
+
137
+ twifork is an independent, unofficial project. It is **not affiliated with, endorsed by, or sponsored by X Corp.** "X" and "Twitter" are trademarks of X Corp. Use it in accordance with applicable terms and laws.
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
twifork-2.3.3/setup.py ADDED
@@ -0,0 +1,37 @@
1
+ import re
2
+
3
+ from setuptools import setup, find_packages
4
+
5
+ with open('README.md', encoding='utf-8') as f:
6
+ long_description = f.read()
7
+
8
+ with open('./twikit/__init__.py') as f:
9
+ version = re.findall(r"__version__ = '(.+)'", f.read())[0]
10
+
11
+
12
+ setup(
13
+ name='twifork',
14
+ version=version,
15
+ author='PawiX25',
16
+ packages=find_packages(include=['twikit', 'twikit.*']),
17
+ install_requires=[
18
+ 'httpx[socks]',
19
+ 'filetype',
20
+ 'beautifulsoup4',
21
+ 'pyotp',
22
+ 'lxml',
23
+ 'webvtt-py',
24
+ 'm3u8',
25
+ 'Js2Py-3.13'
26
+ ],
27
+ extras_require={
28
+ 'impersonate': ['curl_cffi>=0.7,<0.8'],
29
+ },
30
+ python_requires='>=3.8',
31
+ description='A maintained fork of twikit — Twitter/X API scraper for Python, no API key required.',
32
+ long_description=long_description,
33
+ long_description_content_type='text/markdown',
34
+ license='MIT',
35
+ url='https://github.com/PawiX25/twifork',
36
+ package_data={'twikit': ['py.typed']}
37
+ )
@@ -0,0 +1,168 @@
1
+ Metadata-Version: 2.4
2
+ Name: twifork
3
+ Version: 2.3.3
4
+ Summary: A maintained fork of twikit — Twitter/X API scraper for Python, no API key required.
5
+ Home-page: https://github.com/PawiX25/twifork
6
+ Author: PawiX25
7
+ License: MIT
8
+ Requires-Python: >=3.8
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ Requires-Dist: httpx[socks]
12
+ Requires-Dist: filetype
13
+ Requires-Dist: beautifulsoup4
14
+ Requires-Dist: pyotp
15
+ Requires-Dist: lxml
16
+ Requires-Dist: webvtt-py
17
+ Requires-Dist: m3u8
18
+ Requires-Dist: Js2Py-3.13
19
+ Provides-Extra: impersonate
20
+ Requires-Dist: curl_cffi<0.8,>=0.7; extra == "impersonate"
21
+ Dynamic: author
22
+ Dynamic: description
23
+ Dynamic: description-content-type
24
+ Dynamic: home-page
25
+ Dynamic: license
26
+ Dynamic: license-file
27
+ Dynamic: provides-extra
28
+ Dynamic: requires-dist
29
+ Dynamic: requires-python
30
+ Dynamic: summary
31
+
32
+ <p align="center">
33
+ <img src="https://raw.githubusercontent.com/PawiX25/twifork/main/assets/banner.png" width="640" alt="twifork">
34
+ </p>
35
+
36
+ <p align="center">
37
+ A <b>Twitter / X</b> API scraper for Python — <b>no API key required</b>.<br>
38
+ A maintained fork of <a href="https://github.com/d60/twikit">d60/twikit</a>, fixed for the 2026 breakages that make the upstream release unusable.
39
+ </p>
40
+
41
+ <p align="center">
42
+ <img src="https://img.shields.io/badge/python-3.8%2B-blue" alt="Python 3.8+">
43
+ <img src="https://img.shields.io/badge/license-MIT-green" alt="MIT License">
44
+ <img src="https://img.shields.io/github/stars/PawiX25/twifork?style=flat&color=yellow" alt="Stars">
45
+ </p>
46
+
47
+ > **Drop-in replacement** — the package still imports as `twikit`, so existing code (`from twikit import Client`) keeps working unchanged.
48
+
49
+ ---
50
+
51
+ ## Install
52
+
53
+ ```bash
54
+ pip install git+https://github.com/PawiX25/twifork.git
55
+ ```
56
+
57
+ Optional browser-TLS impersonation (gets past some `403` walls):
58
+
59
+ ```bash
60
+ pip install "twikit[impersonate] @ git+https://github.com/PawiX25/twifork.git"
61
+ ```
62
+
63
+ ## Why this fork?
64
+
65
+ The upstream PyPI release (`twikit==2.3.3`) is broken in several ways as of 2026. **twifork** fixes them — each item links to the upstream issue it resolves:
66
+
67
+ - **ClientTransaction / `Couldn't get KEY_BYTE indices`** — updated `ondemand.s.js` parsing for the new X webpack bundle, so GraphQL requests work again. ([#408](https://github.com/d60/twikit/issues/408), [#409](https://github.com/d60/twikit/issues/409), [#304](https://github.com/d60/twikit/issues/304))
68
+ - **Intermittent / sticky `404` on `SearchTimeline` and `friends/list`** — the `x-client-transaction-id` animation key was missing X's `frame_time` rounding step, so on some `Client` sessions every strict request 404'd until the client was recreated. Restored, so the semi-random 404s are gone. ([#357](https://github.com/d60/twikit/issues/357), [#397](https://github.com/d60/twikit/issues/397))
69
+ - **`KeyError` on missing optional fields** in `User.__init__` and `Client.request` — defensive `.get()` parsing. ([#417](https://github.com/d60/twikit/issues/417))
70
+ - **Empty user `name` / `screen_name`** (e.g. in search results) — X moved `name`, `screen_name`, `created_at`, avatar, location, and more out of `legacy` into new sub-objects; these are now read with a legacy fallback.
71
+ - **`get_tweet_by_id` `KeyError: 'itemContent'`** — handles both the legacy and the new trailing-cursor shapes. ([#332](https://github.com/d60/twikit/issues/332), [#363](https://github.com/d60/twikit/issues/363))
72
+ - **`KeyError: 'entries'` / `IndexError` on `get_user_tweets`** for accounts with no visible tweets — empty / cursor-less timelines return an empty result instead of crashing. ([#361](https://github.com/d60/twikit/issues/361), [#216](https://github.com/d60/twikit/issues/216))
73
+ - **`get_trends` deprecated / returns nothing** — rebuilt on top of `GenericTimelineById`; also adds `get_explore_page()`. ([#389](https://github.com/d60/twikit/issues/389))
74
+ - **`RecursionError` on rate-limit** — the 429 recovery path no longer recurses.
75
+ - **`GuestClient.activate()` 404** — the guest client now sends a `User-Agent` header and parses user fields defensively. ([#402](https://github.com/d60/twikit/issues/402), [#385](https://github.com/d60/twikit/issues/385))
76
+ - **`get_latest_friends` 404** — routed through the GraphQL `Following` endpoint after the v1.1 endpoint was retired. ([#397](https://github.com/d60/twikit/issues/397))
77
+ - **`'Client' object has no attribute '_ui_metrix'`** — fixed the captcha unlock path. ([#333](https://github.com/d60/twikit/issues/333))
78
+ - **`get_bookmark_folders().next()` infinite loop** — fixed malformed pagination variables. ([#334](https://github.com/d60/twikit/issues/334), [#335](https://github.com/d60/twikit/issues/335))
79
+ - **`get_latest_timeline` / `get_list_tweets` dropping conversation entries** — home- and list-conversation entries are now unpacked. ([#336](https://github.com/d60/twikit/issues/336), [#337](https://github.com/d60/twikit/issues/337), [#340](https://github.com/d60/twikit/issues/340))
80
+ - **`Media.source_url`** for the full-resolution image ([#376](https://github.com/d60/twikit/issues/376)), and **`Tweet.quoted_status_id`** for the quoted tweet id ([#222](https://github.com/d60/twikit/issues/222)).
81
+
82
+ Issues that stem from X-side restrictions (account suspension, Cloudflare/IP blocks, captcha, automation limits) aren't fixable in the library and are out of scope.
83
+
84
+ ### Browser TLS impersonation (optional)
85
+
86
+ Some X endpoints reject the default `httpx` TLS fingerprint with a `403` (HTML) response even when the request is valid. Installing the optional `curl_cffi` backend and passing `impersonate=` routes requests through a real browser TLS fingerprint, which avoids those 403s:
87
+
88
+ ```python
89
+ client = Client('en-US', impersonate='chrome124')
90
+ ```
91
+
92
+ ## Quick start
93
+
94
+ **Define a client and log in.**
95
+
96
+ ```python
97
+ import asyncio
98
+ from twikit import Client
99
+
100
+ client = Client('en-US')
101
+
102
+ async def main():
103
+ await client.login(
104
+ auth_info_1='example_user',
105
+ auth_info_2='email@example.com',
106
+ password='password0000',
107
+ cookies_file='cookies.json'
108
+ )
109
+
110
+ asyncio.run(main())
111
+ ```
112
+
113
+ **Post a tweet with media attached.**
114
+
115
+ ```python
116
+ media_ids = [
117
+ await client.upload_media('media1.jpg'),
118
+ await client.upload_media('media2.jpg'),
119
+ ]
120
+ await client.create_tweet(text='Example Tweet', media_ids=media_ids)
121
+ ```
122
+
123
+ **Search the latest tweets for a keyword.**
124
+
125
+ ```python
126
+ tweets = await client.search_tweet('python', 'Latest')
127
+ for tweet in tweets:
128
+ print(tweet.user.name, tweet.text, tweet.created_at)
129
+ ```
130
+
131
+ **A few more common calls.**
132
+
133
+ ```python
134
+ await client.get_user_tweets('123456', 'Tweets') # a user's tweets
135
+ await client.send_dm('123456789', 'Hello') # send a DM
136
+ await client.get_trends('trending') # trending topics
137
+ ```
138
+
139
+ More examples (upstream, still apply): https://github.com/d60/twikit/tree/main/examples
140
+
141
+ ## Features
142
+
143
+ - **No API key** — works by scraping the web client.
144
+ - **Free & open source** (MIT).
145
+ - **Drop-in `twikit` replacement** — same import, your code doesn't change.
146
+ - Tweets, search, timelines, trends, users, DMs, media, bookmarks, and more.
147
+
148
+ ## Documentation
149
+
150
+ Full API reference (upstream — the package surface is the same): https://twikit.readthedocs.io/en/latest/twikit.html
151
+
152
+ ## Community
153
+
154
+ [![Discord](https://img.shields.io/badge/Discord-%235865F2.svg?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/nCrByrr8cX)
155
+
156
+ ## Contributing
157
+
158
+ Found a bug or have a fix? Open an issue or PR on **[twifork issues](https://github.com/PawiX25/twifork/issues)**.
159
+
160
+ If twifork saved you a headache, consider leaving a ⭐.
161
+
162
+ ## Credits
163
+
164
+ twifork is a fork of **[d60/twikit](https://github.com/d60/twikit)** by [@d60](https://github.com/d60) — all upstream credit goes to the original authors. Licensed under the **MIT License**.
165
+
166
+ ## Disclaimer
167
+
168
+ twifork is an independent, unofficial project. It is **not affiliated with, endorsed by, or sponsored by X Corp.** "X" and "Twitter" are trademarks of X Corp. Use it in accordance with applicable terms and laws.
@@ -0,0 +1,39 @@
1
+ LICENSE
2
+ README.md
3
+ setup.py
4
+ twifork.egg-info/PKG-INFO
5
+ twifork.egg-info/SOURCES.txt
6
+ twifork.egg-info/dependency_links.txt
7
+ twifork.egg-info/requires.txt
8
+ twifork.egg-info/top_level.txt
9
+ twikit/__init__.py
10
+ twikit/bookmark.py
11
+ twikit/community.py
12
+ twikit/constants.py
13
+ twikit/errors.py
14
+ twikit/geo.py
15
+ twikit/group.py
16
+ twikit/list.py
17
+ twikit/media.py
18
+ twikit/message.py
19
+ twikit/notification.py
20
+ twikit/streaming.py
21
+ twikit/trend.py
22
+ twikit/tweet.py
23
+ twikit/user.py
24
+ twikit/utils.py
25
+ twikit/_captcha/__init__.py
26
+ twikit/_captcha/base.py
27
+ twikit/_captcha/capsolver.py
28
+ twikit/guest/__init__.py
29
+ twikit/guest/client.py
30
+ twikit/guest/tweet.py
31
+ twikit/guest/user.py
32
+ twikit/ui_metrics/__init__.py
33
+ twikit/ui_metrics/dom.py
34
+ twikit/x_client_transaction/__init__.py
35
+ twikit/x_client_transaction/cubic_curve.py
36
+ twikit/x_client_transaction/interpolate.py
37
+ twikit/x_client_transaction/rotation.py
38
+ twikit/x_client_transaction/transaction.py
39
+ twikit/x_client_transaction/utils.py
@@ -0,0 +1,11 @@
1
+ httpx[socks]
2
+ filetype
3
+ beautifulsoup4
4
+ pyotp
5
+ lxml
6
+ webvtt-py
7
+ m3u8
8
+ Js2Py-3.13
9
+
10
+ [impersonate]
11
+ curl_cffi<0.8,>=0.7
@@ -0,0 +1 @@
1
+ twikit
@@ -0,0 +1,31 @@
1
+ """
2
+ ==========================
3
+ Twikit Twitter API Wrapper
4
+ ==========================
5
+
6
+ https://github.com/d60/twikit
7
+ A Python library for interacting with the Twitter API.
8
+ """
9
+
10
+ __version__ = '2.3.3'
11
+
12
+ import asyncio
13
+ import os
14
+
15
+ if os.name == 'nt':
16
+ asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
17
+
18
+ from ._captcha import Capsolver
19
+ from .bookmark import BookmarkFolder
20
+ from .errors import *
21
+ from .utils import build_query
22
+ from .client.client import Client
23
+ from .community import Community, CommunityCreator, CommunityMember, CommunityRule
24
+ from .geo import Place
25
+ from .group import Group, GroupMessage
26
+ from .list import List
27
+ from .message import Message
28
+ from .notification import Notification
29
+ from .trend import Trend
30
+ from .tweet import CommunityNote, Poll, ScheduledTweet, Tweet
31
+ from .user import User
@@ -0,0 +1,2 @@
1
+ from .base import CaptchaSolver
2
+ from .capsolver import Capsolver