twitter-cli 0.4.2__tar.gz → 0.4.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.
- {twitter_cli-0.4.2 → twitter_cli-0.4.3}/PKG-INFO +1 -1
- {twitter_cli-0.4.2 → twitter_cli-0.4.3}/pyproject.toml +1 -1
- {twitter_cli-0.4.2 → twitter_cli-0.4.3}/tests/test_client.py +12 -14
- {twitter_cli-0.4.2 → twitter_cli-0.4.3}/twitter_cli/client.py +11 -30
- {twitter_cli-0.4.2 → twitter_cli-0.4.3}/uv.lock +1 -1
- {twitter_cli-0.4.2 → twitter_cli-0.4.3}/.github/workflows/ci.yml +0 -0
- {twitter_cli-0.4.2 → twitter_cli-0.4.3}/.github/workflows/publish-clawhub.yml +0 -0
- {twitter_cli-0.4.2 → twitter_cli-0.4.3}/.github/workflows/publish.yml +0 -0
- {twitter_cli-0.4.2 → twitter_cli-0.4.3}/.gitignore +0 -0
- {twitter_cli-0.4.2 → twitter_cli-0.4.3}/LICENSE +0 -0
- {twitter_cli-0.4.2 → twitter_cli-0.4.3}/README.md +0 -0
- {twitter_cli-0.4.2 → twitter_cli-0.4.3}/SKILL.md +0 -0
- {twitter_cli-0.4.2 → twitter_cli-0.4.3}/config.yaml +0 -0
- {twitter_cli-0.4.2 → twitter_cli-0.4.3}/tests/conftest.py +0 -0
- {twitter_cli-0.4.2 → twitter_cli-0.4.3}/tests/test_cli.py +0 -0
- {twitter_cli-0.4.2 → twitter_cli-0.4.3}/tests/test_config.py +0 -0
- {twitter_cli-0.4.2 → twitter_cli-0.4.3}/tests/test_config_normalization.py +0 -0
- {twitter_cli-0.4.2 → twitter_cli-0.4.3}/tests/test_filter.py +0 -0
- {twitter_cli-0.4.2 → twitter_cli-0.4.3}/tests/test_serialization.py +0 -0
- {twitter_cli-0.4.2 → twitter_cli-0.4.3}/twitter_cli/__init__.py +0 -0
- {twitter_cli-0.4.2 → twitter_cli-0.4.3}/twitter_cli/auth.py +0 -0
- {twitter_cli-0.4.2 → twitter_cli-0.4.3}/twitter_cli/cli.py +0 -0
- {twitter_cli-0.4.2 → twitter_cli-0.4.3}/twitter_cli/config.py +0 -0
- {twitter_cli-0.4.2 → twitter_cli-0.4.3}/twitter_cli/constants.py +0 -0
- {twitter_cli-0.4.2 → twitter_cli-0.4.3}/twitter_cli/filter.py +0 -0
- {twitter_cli-0.4.2 → twitter_cli-0.4.3}/twitter_cli/formatter.py +0 -0
- {twitter_cli-0.4.2 → twitter_cli-0.4.3}/twitter_cli/models.py +0 -0
- {twitter_cli-0.4.2 → twitter_cli-0.4.3}/twitter_cli/serialization.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: twitter-cli
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.3
|
|
4
4
|
Summary: A CLI for Twitter/X — feed, bookmarks, and user timeline in terminal
|
|
5
5
|
Project-URL: Homepage, https://github.com/jackwener/twitter-cli
|
|
6
6
|
Project-URL: Repository, https://github.com/jackwener/twitter-cli
|
|
@@ -213,30 +213,28 @@ class TestBestChromeTarget:
|
|
|
213
213
|
# ── _update_features_from_html ───────────────────────────────────────────
|
|
214
214
|
|
|
215
215
|
class TestUpdateFeaturesFromHtml:
|
|
216
|
-
def
|
|
217
|
-
|
|
216
|
+
def test_updates_existing_feature_flags(self):
|
|
217
|
+
"""Should update existing FEATURES keys, not add new ones."""
|
|
218
218
|
original = dict(FEATURES)
|
|
219
219
|
try:
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
"
|
|
224
|
-
''
|
|
220
|
+
# Use a key that exists in FEATURES
|
|
221
|
+
existing_key = list(FEATURES.keys())[0]
|
|
222
|
+
original_value = FEATURES[existing_key]
|
|
223
|
+
opposite = "false" if original_value else "true"
|
|
224
|
+
html = '"%s":{"value":%s}' % (existing_key, opposite)
|
|
225
225
|
_update_features_from_html(html)
|
|
226
|
-
assert FEATURES[
|
|
227
|
-
assert FEATURES["responsive_web_another_feature"] is False
|
|
228
|
-
assert FEATURES["rweb_some_flag"] is True
|
|
226
|
+
assert FEATURES[existing_key] != original_value
|
|
229
227
|
finally:
|
|
230
|
-
# Restore original state
|
|
231
228
|
FEATURES.clear()
|
|
232
229
|
FEATURES.update(original)
|
|
233
230
|
|
|
234
|
-
def
|
|
231
|
+
def test_does_not_add_new_keys(self):
|
|
232
|
+
"""Should never add keys not already in FEATURES (prevents URL bloat)."""
|
|
235
233
|
original = dict(FEATURES)
|
|
236
234
|
try:
|
|
237
|
-
html = '"
|
|
235
|
+
html = '"responsive_web_brand_new_feature":{"value":true}'
|
|
238
236
|
_update_features_from_html(html)
|
|
239
|
-
assert "
|
|
237
|
+
assert "responsive_web_brand_new_feature" not in FEATURES
|
|
240
238
|
finally:
|
|
241
239
|
FEATURES.clear()
|
|
242
240
|
FEATURES.update(original)
|
|
@@ -53,43 +53,24 @@ TWITTER_OPENAPI_URL = (
|
|
|
53
53
|
"main/src/config/placeholder.json"
|
|
54
54
|
)
|
|
55
55
|
|
|
56
|
+
# Essential features only — keep this list SMALL to avoid 414/431 URI Too Long.
|
|
57
|
+
# Twitter's API defaults missing features to False, so we only need True-valued ones
|
|
58
|
+
# that affect tweet data we actually consume. Each additional key adds ~60 chars to URL.
|
|
56
59
|
_DEFAULT_FEATURES = {
|
|
57
|
-
"rweb_video_screen_enabled": False,
|
|
58
|
-
"profile_label_improvements_pcf_label_in_post_enabled": True,
|
|
59
|
-
"responsive_web_profile_redirect_enabled": False,
|
|
60
|
-
"rweb_tipjar_consumption_enabled": False,
|
|
61
|
-
"verified_phone_label_enabled": False,
|
|
62
60
|
"creator_subscriptions_tweet_preview_api_enabled": True,
|
|
63
|
-
"responsive_web_graphql_timeline_navigation_enabled": True,
|
|
64
|
-
"responsive_web_graphql_skip_user_profile_image_extensions_enabled": False,
|
|
65
|
-
"premium_content_api_read_enabled": False,
|
|
66
61
|
"communities_web_enable_tweet_community_results_fetch": True,
|
|
67
62
|
"c9s_tweet_anatomy_moderator_badge_enabled": True,
|
|
68
|
-
"responsive_web_grok_analyze_button_fetch_trends_enabled": False,
|
|
69
|
-
"responsive_web_grok_analyze_post_followups_enabled": True,
|
|
70
|
-
"responsive_web_jetfuel_frame": True,
|
|
71
|
-
"responsive_web_grok_share_attachment_enabled": True,
|
|
72
|
-
"responsive_web_grok_annotations_enabled": True,
|
|
73
63
|
"articles_preview_enabled": True,
|
|
74
64
|
"responsive_web_edit_tweet_api_enabled": True,
|
|
75
65
|
"graphql_is_translatable_rweb_tweet_is_translatable_enabled": True,
|
|
76
66
|
"view_counts_everywhere_api_enabled": True,
|
|
77
67
|
"longform_notetweets_consumption_enabled": True,
|
|
78
68
|
"responsive_web_twitter_article_tweet_consumption_enabled": True,
|
|
79
|
-
"tweet_awards_web_tipping_enabled": False,
|
|
80
|
-
"content_disclosure_indicator_enabled": True,
|
|
81
|
-
"content_disclosure_ai_generated_indicator_enabled": True,
|
|
82
|
-
"responsive_web_grok_show_grok_translated_post": True,
|
|
83
|
-
"responsive_web_grok_analysis_button_from_backend": True,
|
|
84
|
-
"post_ctas_fetch_enabled": True,
|
|
85
|
-
"freedom_of_speech_not_reach_fetch_enabled": True,
|
|
86
|
-
"standardized_nudges_misinfo": True,
|
|
87
69
|
"tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled": True,
|
|
88
70
|
"longform_notetweets_rich_text_read_enabled": True,
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"responsive_web_grok_community_note_auto_translation_is_enabled": False,
|
|
71
|
+
"freedom_of_speech_not_reach_fetch_enabled": True,
|
|
72
|
+
"standardized_nudges_misinfo": True,
|
|
73
|
+
"responsive_web_graphql_timeline_navigation_enabled": True,
|
|
93
74
|
"responsive_web_enhance_cards_enabled": False,
|
|
94
75
|
}
|
|
95
76
|
|
|
@@ -226,11 +207,9 @@ def _update_features_from_html(html):
|
|
|
226
207
|
|
|
227
208
|
Twitter embeds feature switch config in inline scripts on the homepage.
|
|
228
209
|
We parse these to keep FEATURES in sync with the current frontend.
|
|
210
|
+
Only UPDATES existing keys — never adds new ones to avoid URL bloat.
|
|
229
211
|
"""
|
|
230
212
|
try:
|
|
231
|
-
# Look for feature flags in inline script content
|
|
232
|
-
# Pattern: "featureSwitch":{"...":{"value":true/false},...}
|
|
233
|
-
# Also try: features:{key:!0, key2:!1, ...} in JS bundles
|
|
234
213
|
feature_pattern = re.compile(
|
|
235
214
|
r'"([a-z][a-z0-9_]+)":\s*\{\s*"value"\s*:\s*(true|false)',
|
|
236
215
|
re.IGNORECASE,
|
|
@@ -239,8 +218,10 @@ def _update_features_from_html(html):
|
|
|
239
218
|
for match in feature_pattern.finditer(html):
|
|
240
219
|
key = match.group(1)
|
|
241
220
|
value = match.group(2).lower() == "true"
|
|
242
|
-
# Only update keys
|
|
243
|
-
|
|
221
|
+
# Only update keys already in FEATURES — never add new ones
|
|
222
|
+
# Adding new keys inflates URL length, causing 414/431 errors
|
|
223
|
+
if key in FEATURES and FEATURES[key] != value:
|
|
224
|
+
logger.debug("Feature flag updated: %s = %s -> %s", key, FEATURES[key], value)
|
|
244
225
|
FEATURES[key] = value
|
|
245
226
|
found += 1
|
|
246
227
|
if found:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|