feat: add user commands, auto-detect browser, optimize performance

- Add user/user-posts/followers/following commands
- Add UserProfile model and GraphQL API methods
- Add print_user_profile and print_user_table formatters
- Auto-detect browser for cookies (Chrome → Edge → Firefox → Brave)
- Remove --browser option from all commands
- Remove cookie verification (v1.1 endpoints are gone)
- Use hardcoded fallback query IDs first (skip slow JS bundle scan)
- Update FEATURES from latest twitter-openapi config
- Fix user-posts: add required withVoice variable
- Add tweet URL links in feed output
- Add error handling to all user commands
This commit is contained in:
jackwener
2026-03-05 00:41:26 +08:00
parent 16752c3115
commit 7238b932ab
10 changed files with 770 additions and 353 deletions

View File

@@ -5,7 +5,6 @@ Uses a simple built-in YAML parser to avoid adding PyYAML as a dependency.
from __future__ import annotations
import os
import re
from pathlib import Path
from typing import Any, Dict, List, Union
@@ -29,13 +28,6 @@ DEFAULT_CONFIG = {
"views_log": 0.5,
},
},
"ai": {
"provider": "openai",
"api_key": "",
"model": "doubao-seed-2.0-code",
"base_url": "https://ark.cn-beijing.volces.com/api/coding",
"language": "zh-CN",
},
} # type: Dict[str, Any]
@@ -161,15 +153,9 @@ def load_config(config_path=None):
# Ensure nested dicts exist
config.setdefault("fetch", DEFAULT_CONFIG["fetch"])
config.setdefault("filter", DEFAULT_CONFIG["filter"])
config.setdefault("ai", DEFAULT_CONFIG["ai"])
# Deep-copy filter weights if needed
if "filter" in config and "weights" not in config["filter"]:
config["filter"]["weights"] = dict(DEFAULT_CONFIG["filter"]["weights"])
# AI API key fallback to env var
ai = config.get("ai", {})
if not ai.get("api_key"):
ai["api_key"] = os.environ.get("AI_API_KEY", "")
return config