fix: console output to stderr for clean --json output

- Change Console() to Console(stderr=True) so all status/progress
  messages go to stderr, keeping stdout pure JSON when --json is used
- Add missing exception handling in likes command for fetch_user
- Fix SKILL.md: favorite -> favorites (correct command name)
This commit is contained in:
jackwener
2026-03-08 22:37:00 +08:00
parent 2559549a84
commit 0a7b6a6b78
2 changed files with 8 additions and 4 deletions

View File

@@ -46,7 +46,7 @@ from .formatter import (
from .serialization import tweets_from_json, tweets_to_json, users_to_json
console = Console()
console = Console(stderr=True)
FEED_TYPES = ["for-you", "following"]
@@ -296,7 +296,11 @@ def likes(screen_name, max_count, as_json, do_filter):
config = load_config()
client = _get_client(config)
console.print("👤 Fetching @%s's profile..." % screen_name)
profile = client.fetch_user(screen_name)
try:
profile = client.fetch_user(screen_name)
except RuntimeError as exc:
console.print("[red]❌ %s[/red]" % exc)
sys.exit(1)
_fetch_and_display(
lambda count: client.fetch_user_likes(profile.id, count),
"@%s likes" % screen_name, "❤️", max_count, as_json, None, do_filter, config,