@auscera/socialscrape 0.0.0-stage → 2.0.2
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.
- package/README.md +111 -2
- package/bin/socialscrape.mjs +115 -0
- package/engine/README.md +245 -0
- package/engine/SKILL.md +194 -0
- package/engine/agent.py +665 -0
- package/engine/batch_manager.py +622 -0
- package/engine/cli.py +23 -0
- package/engine/handlers.py +1109 -0
- package/engine/plugins/__init__.py +77 -0
- package/engine/plugins/instagram-scrape/README.md +164 -0
- package/engine/plugins/instagram-scrape/SKILL.md +53 -0
- package/engine/plugins/instagram-scrape/cli.py +176 -0
- package/engine/plugins/instagram-scrape/core.py +408 -0
- package/engine/plugins/instagram-scrape/plugin.json +42 -0
- package/engine/plugins/linkedin-scrape/README.md +143 -0
- package/engine/plugins/linkedin-scrape/SKILL.md +47 -0
- package/engine/plugins/linkedin-scrape/cli.py +126 -0
- package/engine/plugins/linkedin-scrape/core.py +188 -0
- package/engine/plugins/linkedin-scrape/plugin.json +36 -0
- package/engine/plugins/meta-ad-library-scraper/README.md +127 -0
- package/engine/plugins/meta-ad-library-scraper/SKILL.md +44 -0
- package/engine/plugins/meta-ad-library-scraper/cli.py +161 -0
- package/engine/plugins/meta-ad-library-scraper/core.py +348 -0
- package/engine/plugins/meta-ad-library-scraper/plugin.json +44 -0
- package/engine/plugins/pinterest-scraper/README.md +150 -0
- package/engine/plugins/pinterest-scraper/SKILL.md +45 -0
- package/engine/plugins/pinterest-scraper/cli.py +193 -0
- package/engine/plugins/pinterest-scraper/core.py +420 -0
- package/engine/plugins/pinterest-scraper/plugin.json +40 -0
- package/engine/plugins/reddit-discussion-scraper/README.md +162 -0
- package/engine/plugins/reddit-discussion-scraper/SKILL.md +52 -0
- package/engine/plugins/reddit-discussion-scraper/cli.py +218 -0
- package/engine/plugins/reddit-discussion-scraper/core.py +546 -0
- package/engine/plugins/reddit-discussion-scraper/plugin.json +46 -0
- package/engine/plugins/shared/__init__.py +15 -0
- package/engine/plugins/shared/paths.py +90 -0
- package/engine/plugins/shared/process_runner.py +169 -0
- package/engine/plugins/shared/session_manager.py +287 -0
- package/engine/plugins/threads-scraper/README.md +139 -0
- package/engine/plugins/threads-scraper/SKILL.md +43 -0
- package/engine/plugins/threads-scraper/cli.py +178 -0
- package/engine/plugins/threads-scraper/core.py +460 -0
- package/engine/plugins/threads-scraper/plugin.json +40 -0
- package/engine/plugins/tiktok-scrape/README.md +158 -0
- package/engine/plugins/tiktok-scrape/SKILL.md +51 -0
- package/engine/plugins/tiktok-scrape/cli.py +163 -0
- package/engine/plugins/tiktok-scrape/core.py +313 -0
- package/engine/plugins/tiktok-scrape/plugin.json +40 -0
- package/engine/plugins/twitter-scrape/README.md +158 -0
- package/engine/plugins/twitter-scrape/SKILL.md +50 -0
- package/engine/plugins/twitter-scrape/cli.py +153 -0
- package/engine/plugins/twitter-scrape/core.py +254 -0
- package/engine/plugins/twitter-scrape/plugin.json +40 -0
- package/engine/plugins/youtube-scrape/README.md +199 -0
- package/engine/plugins/youtube-scrape/SKILL.md +115 -0
- package/engine/plugins/youtube-scrape/cli.py +340 -0
- package/engine/plugins/youtube-scrape/core.py +829 -0
- package/engine/plugins/youtube-scrape/plugin.json +48 -0
- package/engine/requirements.txt +8 -0
- package/engine/socialscrape_cli.py +500 -0
- package/engine/storage.py +570 -0
- package/engine/ui.py +690 -0
- package/package.json +27 -3
package/engine/ui.py
ADDED
|
@@ -0,0 +1,690 @@
|
|
|
1
|
+
"""
|
|
2
|
+
SocialScrape Presentation & UI Layer (`ui.py`).
|
|
3
|
+
Implements OpenCode-identical visual components, ANSI anti-tearing safeguards,
|
|
4
|
+
terminal responsiveness, card styling, and interactive menus.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import sys
|
|
8
|
+
import time
|
|
9
|
+
import json
|
|
10
|
+
import shutil
|
|
11
|
+
import textwrap
|
|
12
|
+
import subprocess
|
|
13
|
+
from pathlib import Path
|
|
14
|
+
from typing import List, Dict, Any, Optional
|
|
15
|
+
|
|
16
|
+
from rich import box
|
|
17
|
+
from rich.console import Console
|
|
18
|
+
from rich.text import Text
|
|
19
|
+
from rich.panel import Panel
|
|
20
|
+
from rich.table import Table
|
|
21
|
+
from rich.align import Align
|
|
22
|
+
from rich.markdown import Markdown
|
|
23
|
+
from rich.tree import Tree
|
|
24
|
+
|
|
25
|
+
from prompt_toolkit import prompt as pt_prompt
|
|
26
|
+
from prompt_toolkit.application import Application
|
|
27
|
+
from prompt_toolkit.layout.containers import HSplit, Window
|
|
28
|
+
from prompt_toolkit.layout.controls import FormattedTextControl
|
|
29
|
+
from prompt_toolkit.layout.layout import Layout
|
|
30
|
+
from prompt_toolkit.layout.margins import ScrollbarMargin
|
|
31
|
+
from prompt_toolkit.widgets import Frame
|
|
32
|
+
from prompt_toolkit.formatted_text import ANSI, HTML
|
|
33
|
+
from prompt_toolkit.key_binding import KeyBindings
|
|
34
|
+
from prompt_toolkit.styles import Style
|
|
35
|
+
|
|
36
|
+
from storage import get_root_dir, get_plugins_dir
|
|
37
|
+
|
|
38
|
+
# Force UTF-8 on Windows console
|
|
39
|
+
if sys.platform == "win32":
|
|
40
|
+
sys.stdout.reconfigure(encoding="utf-8")
|
|
41
|
+
|
|
42
|
+
console = Console()
|
|
43
|
+
|
|
44
|
+
# ==============================================================================
|
|
45
|
+
# TERMINAL MOUSE & VIEWPORT PROTOCOL (PPA SPECIFICATION)
|
|
46
|
+
# ==============================================================================
|
|
47
|
+
# \033[?1049l: Exit alternate screen buffer (if active)
|
|
48
|
+
# \033[?1007l: Disable alternate scroll mode (mouse wheel -> up/down arrow conversion)
|
|
49
|
+
# \033[?1000l: Disable standard mouse tracking
|
|
50
|
+
# \033[?1002l: Disable button event mouse tracking
|
|
51
|
+
# \033[?1003l: Disable any event mouse tracking
|
|
52
|
+
# \033[?1006l: Disable SGR extended mouse mode
|
|
53
|
+
# \033[?1015l: Disable URXVT mouse mode
|
|
54
|
+
# \033[?25h: Ensure cursor is visible
|
|
55
|
+
TERMINAL_MOUSE_RESET = "\033[?1049l\033[?1007l\033[?1000l\033[?1002l\033[?1003l\033[?1006l\033[?1015l\033[?25h"
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def reset_terminal_mouse_mode() -> None:
|
|
59
|
+
"""Forces the terminal emulator to unhook mouse interception and restore 100% native window scrollback."""
|
|
60
|
+
try:
|
|
61
|
+
sys.stdout.write(TERMINAL_MOUSE_RESET)
|
|
62
|
+
sys.stdout.flush()
|
|
63
|
+
except Exception:
|
|
64
|
+
pass
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
# Purge any sticky mouse interception on module import
|
|
68
|
+
reset_terminal_mouse_mode()
|
|
69
|
+
|
|
70
|
+
# ==============================================================================
|
|
71
|
+
# 1. OPENCODE THEME CONSTANTS & COLOR TOKENS
|
|
72
|
+
# ==============================================================================
|
|
73
|
+
COLOR_TEXT = "#eeeeee" # Crisp primary text
|
|
74
|
+
COLOR_MUTED = "#808080" # Dim secondary text
|
|
75
|
+
COLOR_PRIMARY = "#fab283" # Warm peach/amber for commands
|
|
76
|
+
COLOR_ACCENT = "#9d7cd8" # Soft lavender/purple for categories & highlights
|
|
77
|
+
COLOR_SECONDARY = "#5c9cf5" # Soft blue for badge
|
|
78
|
+
COLOR_BORDER = "#3c3c3c" # Subtle dark border
|
|
79
|
+
COLOR_BG_POPUP = "#181818" # Dark popup background
|
|
80
|
+
COLOR_BG_SELECT = "#2a2a2a" # Highlighted item background
|
|
81
|
+
|
|
82
|
+
# OpenCode 3-row block glyphs
|
|
83
|
+
SOCIAL_LEFT = [
|
|
84
|
+
"█▀▀█ █▀▀█ █▀▀▀ █ █▀▀█ █ ",
|
|
85
|
+
"▀▀▀▄ █ █ █ █ █▀▀█ █ ",
|
|
86
|
+
"█▄▄█ ▀▀▀▀ ▀▀▀▀ ▀ ▀ ▀ ▀▀▀▀",
|
|
87
|
+
]
|
|
88
|
+
|
|
89
|
+
SCRAPE_RIGHT = [
|
|
90
|
+
"█▀▀█ █▀▀▀ █▀▀▄ █▀▀█ █▀▀█ █▀▀█",
|
|
91
|
+
"▀▀▀▄ █ █▀▀▄ █▀▀█ █▀▀▀ █▀▀ ",
|
|
92
|
+
"█▄▄█ ▀▀▀▀ ▀ ▀ ▀ ▀ ▀ ▀▀▀▀",
|
|
93
|
+
]
|
|
94
|
+
|
|
95
|
+
tui_style = Style.from_dict({
|
|
96
|
+
"prompt": "bold #eeeeee",
|
|
97
|
+
"completion-menu": "bg:#1e1e1e #eeeeee",
|
|
98
|
+
"completion-menu.completion": "bg:#1e1e1e #fab283 bold",
|
|
99
|
+
"completion-menu.completion.current": "bg:#333333 #ffffff bold",
|
|
100
|
+
"completion-menu.meta": "bg:#1e1e1e #808080",
|
|
101
|
+
"completion-menu.meta.current": "bg:#333333 #9d7cd8 italic",
|
|
102
|
+
"bottom-toolbar": "bg:#141414 #808080",
|
|
103
|
+
"bottom-toolbar.badge": "bg:#282828 #5c9cf5 bold",
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
COMMAND_CATALOG = [
|
|
107
|
+
{
|
|
108
|
+
"category": "AI Agent & Configuration",
|
|
109
|
+
"items": [
|
|
110
|
+
("/agent", "Agent Mode", "Enable natural language AI routing via OpenRouter"),
|
|
111
|
+
("/manual", "Manual Mode", "Bypass AI routing to use exact manual slash commands"),
|
|
112
|
+
("/models", "AI Models", "Browse, search & select active OpenRouter AI model"),
|
|
113
|
+
]
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"category": "Features & Scrapers",
|
|
117
|
+
"items": [
|
|
118
|
+
("/youtube", "YouTube Scraper", "Extract transcripts (txt/json), metadata, comments & download 4K/1080p video"),
|
|
119
|
+
("/instagram", "Instagram Scraper", "Scrape profiles, reels, posts, comments & download MP4 videos/carousels"),
|
|
120
|
+
("/tiktok", "TikTok Scraper", "Extract transcripts, creator feeds & download watermark-free MP4/audio"),
|
|
121
|
+
("/linkedin", "LinkedIn Scraper", "Scrape member profiles, company intelligence, and post updates safely"),
|
|
122
|
+
("/twitter", "Twitter / X Scraper", "Extract tweet text, threads, user timelines & download attached MP4/GIFs"),
|
|
123
|
+
("/reddit", "Reddit Scraper", "Extract subreddit feeds, nested comment trees, user history & download media"),
|
|
124
|
+
("/threads", "Threads Scraper", "Scrape Meta Threads user profiles, timeline feeds & single thread discussions"),
|
|
125
|
+
("/pinterest", "Pinterest Scraper", "Scrape pins, creator boards, visual searches & download high-res media"),
|
|
126
|
+
("/meta", "Meta Ad Library", "Search competitor active ads, copy text, funnels & download video ad MP4s"),
|
|
127
|
+
("/plugins", "Active Plugins", "Inspect discovered social scraper plugins and their health"),
|
|
128
|
+
("/outputs", "View Outputs", "Interactive tree viewer of all downloaded media and text records"),
|
|
129
|
+
]
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"category": "Hub & Utilities",
|
|
133
|
+
"items": [
|
|
134
|
+
("/new", "New Session", "Start fresh new chat session with clean history"),
|
|
135
|
+
("/history", "Chat History", "Scroll through previous conversation turns and scrape logs"),
|
|
136
|
+
("/readme", "Documentation", "Render full formatted markdown project documentation"),
|
|
137
|
+
("/update", "Update Repo", "Safely pull latest updates from remote repository without overwriting user data"),
|
|
138
|
+
("/fix", "Repair Setup", "Reinstall and repair missing or broken package dependencies"),
|
|
139
|
+
("/clear", "Clear Screen", "Clear the terminal screen and redraw the home screen"),
|
|
140
|
+
("/help", "Help Matrix", "Display all commands and keybindings"),
|
|
141
|
+
("/exit", "Exit Session", "Gracefully terminate the SocialScrape session"),
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
]
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
# ==============================================================================
|
|
148
|
+
# 2. BANNER & PRESENTATION HELPERS
|
|
149
|
+
# ==============================================================================
|
|
150
|
+
|
|
151
|
+
def render_opencode_banner(version: str = "2.0.2") -> Text:
|
|
152
|
+
"""Renders the OpenCode-exact block glyph banner with clean muted/bright contrast."""
|
|
153
|
+
banner = Text()
|
|
154
|
+
total_width = len(SOCIAL_LEFT[0]) + 1 + len(SCRAPE_RIGHT[0])
|
|
155
|
+
for l, r in zip(SOCIAL_LEFT, SCRAPE_RIGHT):
|
|
156
|
+
banner.append(l + " ", style=f"bold {COLOR_MUTED}")
|
|
157
|
+
banner.append(r + "\n", style=f"bold {COLOR_TEXT}")
|
|
158
|
+
|
|
159
|
+
ver_str = f"v{version}"
|
|
160
|
+
banner.append(" " * (total_width - len(ver_str)) + ver_str + "\n", style=f"{COLOR_MUTED}")
|
|
161
|
+
return banner
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
def get_git_branch(root_dir: Optional[Path] = None) -> str:
|
|
165
|
+
"""Attempts to get current git branch name."""
|
|
166
|
+
target_dir = root_dir or get_root_dir()
|
|
167
|
+
try:
|
|
168
|
+
res = subprocess.run(
|
|
169
|
+
["git", "rev-parse", "--abbrev-ref", "HEAD"],
|
|
170
|
+
cwd=target_dir,
|
|
171
|
+
capture_output=True,
|
|
172
|
+
text=True,
|
|
173
|
+
timeout=1,
|
|
174
|
+
)
|
|
175
|
+
if res.returncode == 0 and res.stdout.strip():
|
|
176
|
+
return res.stdout.strip()
|
|
177
|
+
except (subprocess.SubprocessError, FileNotFoundError, OSError):
|
|
178
|
+
pass
|
|
179
|
+
return "main"
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
def get_active_plugins(plugins_dir: Optional[Path] = None) -> List[Dict[str, Any]]:
|
|
183
|
+
"""Discovers all valid plugins in the plugins/ directory in consistent sorted order, parsing plugin.json if present."""
|
|
184
|
+
target_dir = plugins_dir or get_plugins_dir()
|
|
185
|
+
discovered = []
|
|
186
|
+
if target_dir.exists():
|
|
187
|
+
for p in sorted(target_dir.iterdir(), key=lambda x: x.name):
|
|
188
|
+
if p.is_dir() and p.name != "shared":
|
|
189
|
+
cli_path = p / "cli.py"
|
|
190
|
+
core_path = p / "core.py"
|
|
191
|
+
plugin_json_path = p / "plugin.json"
|
|
192
|
+
if cli_path.exists() or core_path.exists():
|
|
193
|
+
plugin_meta: Dict[str, Any] = {
|
|
194
|
+
"name": p.name,
|
|
195
|
+
"path": str(p),
|
|
196
|
+
"cli": str(cli_path) if cli_path.exists() else None,
|
|
197
|
+
}
|
|
198
|
+
if plugin_json_path.exists():
|
|
199
|
+
try:
|
|
200
|
+
with open(plugin_json_path, "r", encoding="utf-8") as f:
|
|
201
|
+
meta = json.load(f)
|
|
202
|
+
plugin_meta.update(meta)
|
|
203
|
+
except Exception:
|
|
204
|
+
pass
|
|
205
|
+
discovered.append(plugin_meta)
|
|
206
|
+
return discovered
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
def display_home_screen(version: str = "2.0.2") -> None:
|
|
210
|
+
"""Renders the clean, minimal OpenCode-identical home screen."""
|
|
211
|
+
reset_terminal_mouse_mode()
|
|
212
|
+
console.clear()
|
|
213
|
+
console.print()
|
|
214
|
+
console.print()
|
|
215
|
+
console.print()
|
|
216
|
+
|
|
217
|
+
# 1. Logo
|
|
218
|
+
logo = render_opencode_banner(version=version)
|
|
219
|
+
console.print(Align.center(logo))
|
|
220
|
+
|
|
221
|
+
# 2. Command Shortcuts Table (OpenCode 3-column format)
|
|
222
|
+
cmd_table = Table.grid(padding=(0, 4))
|
|
223
|
+
cmd_table.add_column(style=f"bold {COLOR_PRIMARY}", justify="left")
|
|
224
|
+
cmd_table.add_column(style=f"bold {COLOR_TEXT}", justify="left")
|
|
225
|
+
cmd_table.add_column(style=f"{COLOR_MUTED}", justify="left")
|
|
226
|
+
|
|
227
|
+
cmd_table.add_row("/agent", "agent mode", "ctrl+x a")
|
|
228
|
+
cmd_table.add_row("/manual", "manual mode", "ctrl+x m")
|
|
229
|
+
cmd_table.add_row("/help", "show help", "ctrl+x h")
|
|
230
|
+
cmd_table.add_row("/plugins", "list plugins", "ctrl+x p")
|
|
231
|
+
|
|
232
|
+
console.print(Align.center(cmd_table))
|
|
233
|
+
console.print()
|
|
234
|
+
console.print()
|
|
235
|
+
|
|
236
|
+
# 3. Center Feature Highlight Message
|
|
237
|
+
highlight = Text("Universal Social Media Scraper • Transcripts, Metadata & 4K Video Downloader", style=f"bold {COLOR_ACCENT}")
|
|
238
|
+
console.print(Align.center(highlight))
|
|
239
|
+
console.print()
|
|
240
|
+
console.print()
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
def open_command_modal() -> Optional[str]:
|
|
244
|
+
"""Displays an OpenCode-style floating modal dialog."""
|
|
245
|
+
console.print()
|
|
246
|
+
|
|
247
|
+
modal_content = Text()
|
|
248
|
+
modal_content.append("Select Feature / Command", style=f"bold {COLOR_TEXT}")
|
|
249
|
+
modal_content.append(" " * 32 + "esc\n\n", style=f"{COLOR_MUTED}")
|
|
250
|
+
modal_content.append("Type number or command below to execute:\n", style=f"{COLOR_MUTED}")
|
|
251
|
+
modal_content.append("─" * 60 + "\n", style=f"{COLOR_BORDER}")
|
|
252
|
+
|
|
253
|
+
item_idx = 1
|
|
254
|
+
index_map = {}
|
|
255
|
+
|
|
256
|
+
for cat in COMMAND_CATALOG:
|
|
257
|
+
modal_content.append(f"\n{cat['category']}\n", style=f"bold {COLOR_ACCENT}")
|
|
258
|
+
for cmd, title, desc in cat["items"]:
|
|
259
|
+
modal_content.append(f" [{item_idx}] ", style=f"bold {COLOR_PRIMARY}")
|
|
260
|
+
modal_content.append(f"{cmd:<10} ", style=f"bold {COLOR_TEXT}")
|
|
261
|
+
modal_content.append(f"{desc}\n", style=f"{COLOR_MUTED}")
|
|
262
|
+
index_map[str(item_idx)] = cmd
|
|
263
|
+
item_idx += 1
|
|
264
|
+
|
|
265
|
+
panel = Panel(
|
|
266
|
+
modal_content,
|
|
267
|
+
border_style=COLOR_BORDER,
|
|
268
|
+
padding=(1, 2),
|
|
269
|
+
title="[bold white]SocialScrape Command Palette[/bold white]",
|
|
270
|
+
title_align="left",
|
|
271
|
+
)
|
|
272
|
+
console.print(Align.center(panel))
|
|
273
|
+
|
|
274
|
+
try:
|
|
275
|
+
choice = pt_prompt("\nEnter choice (number or /command, or Enter to cancel): ").strip()
|
|
276
|
+
if not choice:
|
|
277
|
+
return None
|
|
278
|
+
if choice in index_map:
|
|
279
|
+
return index_map[choice]
|
|
280
|
+
if choice.startswith("/"):
|
|
281
|
+
return choice
|
|
282
|
+
return f"/{choice}"
|
|
283
|
+
except (KeyboardInterrupt, EOFError):
|
|
284
|
+
return None
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
# ==============================================================================
|
|
288
|
+
# 3. CONVERSATIONAL CARDS & RESPONSES
|
|
289
|
+
# ==============================================================================
|
|
290
|
+
|
|
291
|
+
def render_user_message(text: str) -> None:
|
|
292
|
+
"""Renders the user's message with 2 vertical lines in OpenCode style."""
|
|
293
|
+
timestamp = time.strftime("%I:%M %p")
|
|
294
|
+
console.print()
|
|
295
|
+
console.print(f"[{COLOR_BORDER}] ┃[/{COLOR_BORDER}] [bold {COLOR_TEXT}]{text}[/bold {COLOR_TEXT}]")
|
|
296
|
+
console.print(f"[{COLOR_BORDER}] ┃[/{COLOR_BORDER}] [{COLOR_MUTED}]USER ({timestamp})[/{COLOR_MUTED}]")
|
|
297
|
+
console.print()
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
def render_ai_response(content: str, model_id: str = "") -> None:
|
|
301
|
+
"""Renders an AI assistant response with dynamic line wrapping inside a rounded container card."""
|
|
302
|
+
timestamp = time.strftime("%I:%M %p")
|
|
303
|
+
model_tag = model_id.split("/")[-1] if model_id else "AI"
|
|
304
|
+
term_width = shutil.get_terminal_size((80, 24)).columns
|
|
305
|
+
card_width = max(min(term_width - 4, 88), 45)
|
|
306
|
+
content_width = card_width - 8
|
|
307
|
+
|
|
308
|
+
wrapped_lines: List[str] = []
|
|
309
|
+
for raw_line in content.strip().splitlines():
|
|
310
|
+
if not raw_line.strip():
|
|
311
|
+
wrapped_lines.append("")
|
|
312
|
+
continue
|
|
313
|
+
wrapped = textwrap.wrap(raw_line, width=content_width, replace_whitespace=False, drop_whitespace=False)
|
|
314
|
+
wrapped_lines.extend(wrapped)
|
|
315
|
+
|
|
316
|
+
body_text = "\n".join(wrapped_lines)
|
|
317
|
+
panel = Panel(
|
|
318
|
+
Text(body_text, style="bold #ffffff"),
|
|
319
|
+
title=f"[bold #808080]Social[/bold #808080][bold #ffffff]Scrape AI[/bold #ffffff] [dim #5c9cf5]({model_tag})[/dim #5c9cf5]",
|
|
320
|
+
title_align="left",
|
|
321
|
+
subtitle=f"[dim #5c9cf5]{timestamp}[/dim #5c9cf5]",
|
|
322
|
+
subtitle_align="right",
|
|
323
|
+
box=box.ROUNDED,
|
|
324
|
+
border_style=COLOR_BORDER,
|
|
325
|
+
width=card_width,
|
|
326
|
+
padding=(1, 2)
|
|
327
|
+
)
|
|
328
|
+
console.print()
|
|
329
|
+
console.print(Align.center(panel))
|
|
330
|
+
console.print()
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
def render_action_card(message: str) -> None:
|
|
334
|
+
"""Renders an action or notice inside a clean OpenCode card."""
|
|
335
|
+
console.print()
|
|
336
|
+
console.print(f"[{COLOR_BORDER}] ┃[/{COLOR_BORDER}]")
|
|
337
|
+
console.print(f"[{COLOR_BORDER}] ┃[/{COLOR_BORDER}] {message}")
|
|
338
|
+
console.print(f"[{COLOR_BORDER}] ┃[/{COLOR_BORDER}]")
|
|
339
|
+
console.print()
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
def open_history_viewer(conversation_history: Optional[List[Dict[str, Any]]] = None, active_model: str = "") -> None:
|
|
343
|
+
"""Displays OpenCode-style interactive full-screen scrollable history viewer with mouse support."""
|
|
344
|
+
if conversation_history is None:
|
|
345
|
+
try:
|
|
346
|
+
from agent import get_conversation_history, get_openrouter_model
|
|
347
|
+
conversation_history = get_conversation_history()
|
|
348
|
+
active_model = get_openrouter_model()
|
|
349
|
+
except Exception:
|
|
350
|
+
conversation_history = []
|
|
351
|
+
active_model = ""
|
|
352
|
+
|
|
353
|
+
out: List[str] = []
|
|
354
|
+
out.append("\x1b[1;36m ╭─ 📜 SocialScrape Session History ──────────────────────────────────────────╮\x1b[0m\n")
|
|
355
|
+
out.append(f"\x1b[1;90m │ {len(conversation_history)} conversation turns | ↑↓/PgUp/PgDn/Mouse Wheel to scroll | q/Esc to exit \x1b[0m\n")
|
|
356
|
+
out.append("\x1b[1;36m ╰────────────────────────────────────────────────────────────────────────────╯\x1b[0m\n\n")
|
|
357
|
+
|
|
358
|
+
if not conversation_history:
|
|
359
|
+
out.append(" \x1b[0;33mℹ No messages or scraping actions recorded in current session yet.\x1b[0m\n")
|
|
360
|
+
out.append(" \x1b[0;90m Run commands (e.g. /youtube, /plugins, /batch) or chat in /agent mode to view history.\x1b[0m\n\n")
|
|
361
|
+
else:
|
|
362
|
+
for msg in conversation_history:
|
|
363
|
+
role = msg.get("role")
|
|
364
|
+
content = msg.get("content", "")
|
|
365
|
+
if not content:
|
|
366
|
+
continue
|
|
367
|
+
if role == "user":
|
|
368
|
+
if not content.startswith("[System Observation"):
|
|
369
|
+
out.append(f"\x1b[1;34m ┃ \x1b[1;37m{content}\x1b[0m\n")
|
|
370
|
+
out.append(f"\x1b[1;34m ┃ \x1b[0;90m👤 USER\x1b[0m\n\n")
|
|
371
|
+
elif role == "assistant":
|
|
372
|
+
tag = active_model.split("/")[-1] if active_model else "SocialScrape AI"
|
|
373
|
+
out.append(f"\x1b[1;35m ╭─ 🤖 SocialScrape AI ({tag}) ──────────────────────────────────╮\x1b[0m\n")
|
|
374
|
+
for line in content.splitlines():
|
|
375
|
+
out.append(f"\x1b[1;35m │\x1b[0m {line}\n")
|
|
376
|
+
out.append(f"\x1b[1;35m ╰────────────────────────────────────────────────────────────────────────╯\x1b[0m\n\n")
|
|
377
|
+
elif role == "tool":
|
|
378
|
+
out.append(f"\x1b[0;90m ─── Tool Output ─────────────────────────────────────────────────────────\x1b[0m\n")
|
|
379
|
+
for line in content[:1000].splitlines():
|
|
380
|
+
out.append(f" {line}\n")
|
|
381
|
+
out.append("\n")
|
|
382
|
+
|
|
383
|
+
out.append("\x1b[0;90m [End of History - Press q or Esc to return to CLI prompt]\x1b[0m\n")
|
|
384
|
+
transcript_ansi = "".join(out)
|
|
385
|
+
|
|
386
|
+
control = FormattedTextControl(text=ANSI(transcript_ansi), focusable=True)
|
|
387
|
+
window = Window(
|
|
388
|
+
content=control,
|
|
389
|
+
right_margins=[ScrollbarMargin(display_arrows=True)],
|
|
390
|
+
wrap_lines=True
|
|
391
|
+
)
|
|
392
|
+
window.vertical_scroll = 100000 # Scroll to bottom
|
|
393
|
+
|
|
394
|
+
kb = KeyBindings()
|
|
395
|
+
|
|
396
|
+
@kb.add("q")
|
|
397
|
+
@kb.add("escape")
|
|
398
|
+
@kb.add("enter")
|
|
399
|
+
def _exit(event):
|
|
400
|
+
event.app.exit()
|
|
401
|
+
|
|
402
|
+
@kb.add("up")
|
|
403
|
+
def _up(event):
|
|
404
|
+
window._scroll_up()
|
|
405
|
+
|
|
406
|
+
@kb.add("down")
|
|
407
|
+
def _down(event):
|
|
408
|
+
window._scroll_down()
|
|
409
|
+
|
|
410
|
+
@kb.add("pageup")
|
|
411
|
+
@kb.add("c-u")
|
|
412
|
+
def _pageup(event):
|
|
413
|
+
for _ in range(8):
|
|
414
|
+
window._scroll_up()
|
|
415
|
+
|
|
416
|
+
@kb.add("pagedown")
|
|
417
|
+
@kb.add("c-d")
|
|
418
|
+
def _pagedown(event):
|
|
419
|
+
for _ in range(8):
|
|
420
|
+
window._scroll_down()
|
|
421
|
+
|
|
422
|
+
@kb.add("home")
|
|
423
|
+
def _home(event):
|
|
424
|
+
window.vertical_scroll = 0
|
|
425
|
+
|
|
426
|
+
@kb.add("end")
|
|
427
|
+
def _end(event):
|
|
428
|
+
window.vertical_scroll = 100000
|
|
429
|
+
|
|
430
|
+
root = HSplit([
|
|
431
|
+
Window(
|
|
432
|
+
height=1,
|
|
433
|
+
content=FormattedTextControl(
|
|
434
|
+
ANSI("\x1b[7;1;35m SocialScrape 1:1 OpenCode History Viewer \x1b[0;90m (Mouse Wheel / ↑↓ / PgUp PgDn to scroll | q/Esc to exit)\x1b[0m")
|
|
435
|
+
)
|
|
436
|
+
),
|
|
437
|
+
Frame(window),
|
|
438
|
+
])
|
|
439
|
+
|
|
440
|
+
try:
|
|
441
|
+
viewer_app = Application(
|
|
442
|
+
layout=Layout(root, focused_element=window),
|
|
443
|
+
key_bindings=kb,
|
|
444
|
+
mouse_support=True,
|
|
445
|
+
full_screen=True
|
|
446
|
+
)
|
|
447
|
+
viewer_app.run()
|
|
448
|
+
except Exception:
|
|
449
|
+
console.print(Align.center(Panel(Text.from_ansi(transcript_ansi), title="Session History", border_style=COLOR_BORDER)))
|
|
450
|
+
finally:
|
|
451
|
+
reset_terminal_mouse_mode()
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
# Keep backward compatible alias
|
|
455
|
+
open_chat_history_viewer = open_history_viewer
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
def render_doctor_report(diagnostics: Dict[str, Any]) -> None:
|
|
459
|
+
"""Renders a standardized OpenCode 2-column system diagnostic inspection table."""
|
|
460
|
+
table = Table(box=box.ROUNDED, border_style=COLOR_BORDER, show_header=True, padding=(0, 2))
|
|
461
|
+
table.add_column("Component / Diagnostic", style="bold #eeeeee", width=30)
|
|
462
|
+
table.add_column("Status & Details", style="#808080", width=50)
|
|
463
|
+
|
|
464
|
+
# 1. Runtime & Execution Mode
|
|
465
|
+
mode_text = "[bold green]GLOBAL MODE (User Data Dir)[/bold green]" if diagnostics.get("is_global") else "[bold yellow]LOCAL MODE (CWD)[/bold yellow]"
|
|
466
|
+
table.add_row("Execution Mode", mode_text)
|
|
467
|
+
table.add_row("Python Runtime", f"{diagnostics.get('python_version')} ({diagnostics.get('python_path')})")
|
|
468
|
+
table.add_row("Package Version", f"v{diagnostics.get('package_version')}")
|
|
469
|
+
table.add_row("", "")
|
|
470
|
+
|
|
471
|
+
# 2. Storage & Filesystem
|
|
472
|
+
table.add_row(f"[bold {COLOR_PRIMARY}]── Storage & Filesystem ──[/bold {COLOR_PRIMARY}]", "")
|
|
473
|
+
table.add_row("Data Directory", str(diagnostics.get("data_dir", "")))
|
|
474
|
+
table.add_row("Config Directory", str(diagnostics.get("config_dir", "")))
|
|
475
|
+
table.add_row("Plugins Directory", f"{diagnostics.get('plugins_dir')} ({diagnostics.get('plugins_count', 0)} spokes active)")
|
|
476
|
+
table.add_row("Chats Directory", f"{diagnostics.get('chats_dir')} ({diagnostics.get('chats_count', 0)} saved sessions)")
|
|
477
|
+
table.add_row("", "")
|
|
478
|
+
|
|
479
|
+
# 3. Media & Extraction Health
|
|
480
|
+
table.add_row(f"[bold {COLOR_PRIMARY}]── Extraction & Downloader Engine ──[/bold {COLOR_PRIMARY}]", "")
|
|
481
|
+
yt_status = "[bold green]● INSTALLED[/bold green]" if diagnostics.get("has_yt_dlp") else "[bold red]✖ MISSING (yt-dlp)[/bold red]"
|
|
482
|
+
table.add_row("yt-dlp Core Engine", yt_status)
|
|
483
|
+
tr_status = "[bold green]● INSTALLED[/bold green]" if diagnostics.get("has_transcript_api") else "[bold yellow]○ Optional missing (youtube-transcript-api)[/bold yellow]"
|
|
484
|
+
table.add_row("Transcript API Bypass", tr_status)
|
|
485
|
+
table.add_row("", "")
|
|
486
|
+
|
|
487
|
+
# 4. AI Intelligence Core
|
|
488
|
+
k_status = f"[bold green]● Configured[/bold green] ({diagnostics.get('api_key_masked')})" if diagnostics.get("api_key_configured") else "[bold yellow]○ Missing (Manual Mode only)[/bold yellow]"
|
|
489
|
+
table.add_row(f"[bold {COLOR_PRIMARY}]── AI Intelligence Core ──[/bold {COLOR_PRIMARY}]", "")
|
|
490
|
+
table.add_row("OpenRouter API Key", k_status)
|
|
491
|
+
table.add_row("Active AI Model", f"[{COLOR_PRIMARY}]{diagnostics.get('active_model')}[/{COLOR_PRIMARY}]")
|
|
492
|
+
|
|
493
|
+
panel = Panel(Align.center(table), title="[bold white]🩺 System Diagnostics (/doctor)[/bold white]", border_style=COLOR_PRIMARY, box=box.ROUNDED)
|
|
494
|
+
console.print()
|
|
495
|
+
console.print(Align.center(panel))
|
|
496
|
+
console.print()
|
|
497
|
+
|
|
498
|
+
|
|
499
|
+
def render_plugin_features(plugin_name: str = "youtube-scrape") -> None:
|
|
500
|
+
"""
|
|
501
|
+
Renders an in-depth, structured feature and capabilities matrix for a specific plugin.
|
|
502
|
+
"""
|
|
503
|
+
p_lower = plugin_name.lower().replace("_", "-")
|
|
504
|
+
|
|
505
|
+
if "youtube" in p_lower:
|
|
506
|
+
table = Table(title="✨ YouTube Universal Scraper Feature Matrix", border_style=COLOR_BORDER, show_header=True)
|
|
507
|
+
table.add_column("Feature Area", style=f"bold {COLOR_PRIMARY}", width=22)
|
|
508
|
+
table.add_column("Capability Description", style=f"{COLOR_TEXT}", width=42)
|
|
509
|
+
table.add_column("CLI Flag / Method", style=f"{COLOR_MUTED}", width=24)
|
|
510
|
+
|
|
511
|
+
table.add_row("Transcripts", "Extract full text (.txt) & structured timestamped segments (.json)", "--url <URL> (default)")
|
|
512
|
+
table.add_row("Video Metadata", "Scrape view count, likes, upload date, tags & description", "-m / --metadata")
|
|
513
|
+
table.add_row("Comments & Sentiment", "Extract top comment threads, author info & reply counts", "--comments [--max-comments N]")
|
|
514
|
+
table.add_row("4K/HD Downloader", "Download MP4 video in selected quality (4K, 1080p, 720p, 480p)", "--download-video -q <quality>")
|
|
515
|
+
table.add_row("Thumbnails & Audio", "Extract max-resolution cover thumbnails (.jpg) and audio tracks", "--download-thumb / --download-audio")
|
|
516
|
+
table.add_row("Channel Discovery", "Batch scrape entire channels across /videos, /streams, /shorts", "-c @handle -t <type> -l <N>")
|
|
517
|
+
table.add_row("In-Memory Pipe", "Stream clean transcript directly to terminal / stdout for AI", "--stdout")
|
|
518
|
+
table.add_row("Full Complete Suite", "Extract all: Transcripts + Metadata + Comments + Video", "-a / --all")
|
|
519
|
+
|
|
520
|
+
console.print()
|
|
521
|
+
console.print(table)
|
|
522
|
+
console.print(f"[{COLOR_MUTED}]Run this plugin now with: [bold #5c9cf5]/youtube[/bold #5c9cf5][/{COLOR_MUTED}]\n")
|
|
523
|
+
|
|
524
|
+
elif "instagram" in p_lower:
|
|
525
|
+
table = Table(title="✨ Instagram Universal Scraper Feature Matrix", border_style=COLOR_BORDER, show_header=True)
|
|
526
|
+
table.add_column("Feature Area", style=f"bold {COLOR_PRIMARY}", width=22)
|
|
527
|
+
table.add_column("Capability Description", style=f"{COLOR_TEXT}", width=42)
|
|
528
|
+
table.add_column("CLI Flag / Method", style=f"{COLOR_MUTED}", width=24)
|
|
529
|
+
|
|
530
|
+
table.add_row("User Profiles", "Scrape biography, follower/following counts, post stats & bio text", "--profile / <username>")
|
|
531
|
+
table.add_row("Reels & Videos", "Download full MP4 video reels and post videos directly", "--download-video [-q quality]")
|
|
532
|
+
table.add_row("Carousels & Photos", "Extract high-res cover photos and multi-slide carousel images", "--download-thumb")
|
|
533
|
+
table.add_row("Comments & Captions", "Extract post comment threads, author details, and engagement", "--comments [--max-comments N]")
|
|
534
|
+
table.add_row("In-Memory Pipe", "Stream structured post/profile JSON straight to terminal", "--stdout")
|
|
535
|
+
table.add_row("Full Complete Suite", "Extract Profile + Posts + Comments + Media in one run", "-a / --all")
|
|
536
|
+
|
|
537
|
+
console.print()
|
|
538
|
+
console.print(table)
|
|
539
|
+
console.print(f"[{COLOR_MUTED}]Run this plugin now with: [bold #5c9cf5]/instagram[/bold #5c9cf5][/{COLOR_MUTED}]\n")
|
|
540
|
+
|
|
541
|
+
elif "tiktok" in p_lower:
|
|
542
|
+
table = Table(title="✨ TikTok Universal Scraper Feature Matrix", border_style=COLOR_BORDER, show_header=True)
|
|
543
|
+
table.add_column("Feature Area", style=f"bold {COLOR_PRIMARY}", width=22)
|
|
544
|
+
table.add_column("Capability Description", style=f"{COLOR_TEXT}", width=42)
|
|
545
|
+
table.add_column("CLI Flag / Method", style=f"{COLOR_MUTED}", width=24)
|
|
546
|
+
|
|
547
|
+
table.add_row("Watermark-Free Video", "Download pristine watermark-free MP4 video files", "--download-video")
|
|
548
|
+
table.add_row("Audio Track Extraction", "Extract pure background audio and songs (.m4a/.mp3)", "--download-audio")
|
|
549
|
+
table.add_row("Captions / Transcripts", "Extract video auto-captions and spoken words to text file", "--transcript")
|
|
550
|
+
table.add_row("Creator Video Feeds", "Discover creator upload feeds and video link lists", "--feed / @username")
|
|
551
|
+
table.add_row("In-Memory Pipe", "Stream transcript or video metadata directly to stdout", "--stdout")
|
|
552
|
+
table.add_row("Full Complete Suite", "Download video, audio, captions, and metadata", "-a / --all")
|
|
553
|
+
|
|
554
|
+
console.print()
|
|
555
|
+
console.print(table)
|
|
556
|
+
console.print(f"[{COLOR_MUTED}]Run this plugin now with: [bold #5c9cf5]/tiktok[/bold #5c9cf5][/{COLOR_MUTED}]\n")
|
|
557
|
+
|
|
558
|
+
elif "linkedin" in p_lower:
|
|
559
|
+
table = Table(title="✨ LinkedIn Intelligence Scraper Feature Matrix", border_style=COLOR_BORDER, show_header=True)
|
|
560
|
+
table.add_column("Feature Area", style=f"bold {COLOR_PRIMARY}", width=22)
|
|
561
|
+
table.add_column("Capability Description", style=f"{COLOR_TEXT}", width=42)
|
|
562
|
+
table.add_column("CLI Flag / Method", style=f"{COLOR_MUTED}", width=24)
|
|
563
|
+
|
|
564
|
+
table.add_row("Member Profiles", "Extract experience, headline, bio, education into Markdown", "--profile / <vanity_name>")
|
|
565
|
+
table.add_row("Company Intelligence", "Scrape industry, employee count, website, and overview", "--company <company_slug>")
|
|
566
|
+
table.add_row("Post Comments", "Extract discussion updates, sentiment, and comments", "--comments")
|
|
567
|
+
table.add_row("Safety Rails", "Automatic request pacing (max 50 req/day per li_at session)", "Built-in rate limiter")
|
|
568
|
+
table.add_row("In-Memory Pipe", "Stream markdown profile straight to stdout for AI context", "--stdout")
|
|
569
|
+
table.add_row("Full Complete Suite", "Scrape profile details, company data, and posts", "-a / --all")
|
|
570
|
+
|
|
571
|
+
console.print()
|
|
572
|
+
console.print(table)
|
|
573
|
+
console.print(f"[{COLOR_MUTED}]Run this plugin now with: [bold #5c9cf5]/linkedin[/bold #5c9cf5][/{COLOR_MUTED}]\n")
|
|
574
|
+
|
|
575
|
+
elif "twitter" in p_lower or " x" in p_lower or p_lower == "x":
|
|
576
|
+
table = Table(title="✨ Twitter / X Scraper Feature Matrix", border_style=COLOR_BORDER, show_header=True)
|
|
577
|
+
table.add_column("Feature Area", style=f"bold {COLOR_PRIMARY}", width=22)
|
|
578
|
+
table.add_column("Capability Description", style=f"{COLOR_TEXT}", width=42)
|
|
579
|
+
table.add_column("CLI Flag / Method", style=f"{COLOR_MUTED}", width=24)
|
|
580
|
+
|
|
581
|
+
table.add_row("Tweet Text & Metrics", "Extract tweet body, likes, retweets, replies, author", "<TWEET_URL> (default)")
|
|
582
|
+
table.add_row("Video & GIF Downloader", "Download attached MP4 video or animated GIF", "--download-video")
|
|
583
|
+
table.add_row("Attached Photos", "Download attached full-resolution images", "--download-thumb")
|
|
584
|
+
table.add_row("User Timeline", "Scrape recent tweets from creator feed", "--timeline / @handle")
|
|
585
|
+
table.add_row("In-Memory Pipe", "Stream tweet JSON directly to stdout for AI processing", "--stdout")
|
|
586
|
+
table.add_row("Full Complete Suite", "Download tweet text, media attachments, and replies", "-a / --all")
|
|
587
|
+
|
|
588
|
+
console.print()
|
|
589
|
+
console.print(table)
|
|
590
|
+
console.print(f"[{COLOR_MUTED}]Run this plugin now with: [bold #5c9cf5]/twitter[/bold #5c9cf5][/{COLOR_MUTED}]\n")
|
|
591
|
+
|
|
592
|
+
elif "reddit" in p_lower:
|
|
593
|
+
table = Table(title="✨ Reddit Discussion Scraper Feature Matrix", border_style=COLOR_BORDER, show_header=True)
|
|
594
|
+
table.add_column("Feature Area", style=f"bold {COLOR_PRIMARY}", width=22)
|
|
595
|
+
table.add_column("Capability Description", style=f"{COLOR_TEXT}", width=42)
|
|
596
|
+
table.add_column("CLI Flag / Method", style=f"{COLOR_MUTED}", width=24)
|
|
597
|
+
|
|
598
|
+
table.add_row("Subreddit Feeds", "Extract hot, top, new, rising discussion posts", "r/<subreddit> --sort <sort>")
|
|
599
|
+
table.add_row("Comment Trees", "Unroll deep nested comment hierarchies & karma up to 10 levels", "--comments / <post_url>")
|
|
600
|
+
table.add_row("User History", "Extract user submission and comment history across subreddits", "--user / u/<username>")
|
|
601
|
+
table.add_row("Keyword Search", "Search sitewide or subreddit for buying intent & pain points", "--search <query>")
|
|
602
|
+
table.add_row("Media Downloader", "Download v.redd.it videos (MP4) and preview images", "--download-video / --download-thumb")
|
|
603
|
+
table.add_row("In-Memory Pipe", "Stream structured discussion JSON directly to stdout", "--stdout")
|
|
604
|
+
table.add_row("Full Complete Suite", "Extract post text, nested comments, and download media", "-a / --all")
|
|
605
|
+
|
|
606
|
+
console.print()
|
|
607
|
+
console.print(table)
|
|
608
|
+
console.print(f"[{COLOR_MUTED}]Run this plugin now with: [bold #5c9cf5]/reddit[/bold #5c9cf5][/{COLOR_MUTED}]\n")
|
|
609
|
+
|
|
610
|
+
elif "threads" in p_lower:
|
|
611
|
+
table = Table(title="✨ Meta Threads Scraper Feature Matrix", border_style=COLOR_BORDER, show_header=True)
|
|
612
|
+
table.add_column("Feature Area", style=f"bold {COLOR_PRIMARY}", width=22)
|
|
613
|
+
table.add_column("Capability Description", style=f"{COLOR_TEXT}", width=42)
|
|
614
|
+
table.add_column("CLI Flag / Method", style=f"{COLOR_MUTED}", width=24)
|
|
615
|
+
|
|
616
|
+
table.add_row("User Profiles", "Extract bio, follower counts, verified badges, and avatar", "@<username> --profile")
|
|
617
|
+
table.add_row("Creator Feeds", "Scrape timeline thread posts and likes from creator feed", "@<username> --feed -l <N>")
|
|
618
|
+
table.add_row("Thread Discussions", "Extract single thread post and discussion replies", "<THREAD_URL>")
|
|
619
|
+
table.add_row("Media Downloader", "Download attached MP4 videos and images", "--download-video / --download-thumb")
|
|
620
|
+
table.add_row("Dynamic LSD Token", "Automatic CSRF token extraction with zero login required", "Built-in engine")
|
|
621
|
+
table.add_row("In-Memory Pipe", "Stream thread conversation JSON directly to stdout", "--stdout")
|
|
622
|
+
|
|
623
|
+
console.print()
|
|
624
|
+
console.print(table)
|
|
625
|
+
console.print(f"[{COLOR_MUTED}]Run this plugin now with: [bold #5c9cf5]/threads[/bold #5c9cf5][/{COLOR_MUTED}]\n")
|
|
626
|
+
|
|
627
|
+
elif "pinterest" in p_lower:
|
|
628
|
+
table = Table(title="✨ Pinterest Scraper Feature Matrix", border_style=COLOR_BORDER, show_header=True)
|
|
629
|
+
table.add_column("Feature Area", style=f"bold {COLOR_PRIMARY}", width=22)
|
|
630
|
+
table.add_column("Capability Description", style=f"{COLOR_TEXT}", width=42)
|
|
631
|
+
table.add_column("CLI Flag / Method", style=f"{COLOR_MUTED}", width=24)
|
|
632
|
+
|
|
633
|
+
table.add_row("Pin Intelligence", "Extract descriptions, outbound links, repin/save counts", "<PIN_URL_OR_ID>")
|
|
634
|
+
table.add_row("Creator Profiles", "Scrape follower stats, boards count, following count, bio", "<username> --profile")
|
|
635
|
+
table.add_row("User Pin Feeds", "Scrape latest pins saved or created by a user", "<username> --pins -l <N>")
|
|
636
|
+
table.add_row("Visual Searches", "Search Pinterest for design, product and visual inspiration", "--search <query>")
|
|
637
|
+
table.add_row("High-Res Downloader", "Download original uncompressed images and video pins", "--download-media")
|
|
638
|
+
table.add_row("In-Memory Pipe", "Stream structured pin metadata directly to stdout", "--stdout")
|
|
639
|
+
|
|
640
|
+
console.print()
|
|
641
|
+
console.print(table)
|
|
642
|
+
console.print(f"[{COLOR_MUTED}]Run this plugin now with: [bold #5c9cf5]/pinterest[/bold #5c9cf5][/{COLOR_MUTED}]\n")
|
|
643
|
+
|
|
644
|
+
elif "meta" in p_lower or "ad" in p_lower or "facebook" in p_lower:
|
|
645
|
+
table = Table(title="✨ Meta / Facebook Ad Library Intelligence Feature Matrix", border_style=COLOR_BORDER, show_header=True)
|
|
646
|
+
table.add_column("Feature Area", style=f"bold {COLOR_PRIMARY}", width=22)
|
|
647
|
+
table.add_column("Capability Description", style=f"{COLOR_TEXT}", width=42)
|
|
648
|
+
table.add_column("CLI Flag / Method", style=f"{COLOR_MUTED}", width=24)
|
|
649
|
+
|
|
650
|
+
table.add_row("Keyword Ad Search", "Search active competitor ads across all countries", "<keyword> --country US")
|
|
651
|
+
table.add_row("Company Page Audits", "Extract all live campaigns run by a Facebook Page ID", "--page-id <page_id>")
|
|
652
|
+
table.add_row("Ad Copy Swipe Files", "Scrape headlines, primary body text, CTA buttons, links", "Structured JSON output")
|
|
653
|
+
table.add_row("Video Ad Downloader", "Download raw CDN video ad MP4s and creative images", "--download-video / --download-thumb")
|
|
654
|
+
table.add_row("Format Filters", "Filter ads by format: video, image, meme, or all", "--media-type video")
|
|
655
|
+
table.add_row("In-Memory Pipe", "Stream competitor ad swipe files directly to stdout", "--stdout")
|
|
656
|
+
|
|
657
|
+
console.print()
|
|
658
|
+
console.print(table)
|
|
659
|
+
console.print(f"[{COLOR_MUTED}]Run this plugin now with: [bold #5c9cf5]/meta[/bold #5c9cf5][/{COLOR_MUTED}]\n")
|
|
660
|
+
else:
|
|
661
|
+
console.print(f"[{COLOR_MUTED}]Plugin '{plugin_name}' does not have extended feature metadata registered.[/{COLOR_MUTED}]\n")
|
|
662
|
+
|
|
663
|
+
|
|
664
|
+
def build_bottom_toolbar_html(
|
|
665
|
+
version: str,
|
|
666
|
+
root_dir: Path,
|
|
667
|
+
active_model: str,
|
|
668
|
+
allowed_models: List[Dict[str, Any]],
|
|
669
|
+
agent_mode: bool,
|
|
670
|
+
) -> HTML:
|
|
671
|
+
"""Renders the OpenCode-style docked footer bar."""
|
|
672
|
+
branch = get_git_branch(root_dir)
|
|
673
|
+
cwd_str = str(root_dir)
|
|
674
|
+
matched_model = next((m for m in allowed_models if m["id"] == active_model), None)
|
|
675
|
+
model_name = matched_model["name"] if matched_model else active_model.split("/")[-1]
|
|
676
|
+
|
|
677
|
+
if agent_mode:
|
|
678
|
+
mode_badge = "BUILD AGENT"
|
|
679
|
+
badge_style = "bg='#282828' color='#5c9cf5'"
|
|
680
|
+
model_info = f"<style color='#666666'> OpenRouter: </style><b><style color='#fab283'>{model_name}</style></b>"
|
|
681
|
+
else:
|
|
682
|
+
mode_badge = "KEYBOARD MANUAL"
|
|
683
|
+
badge_style = "bg='#282828' color='#fab283'"
|
|
684
|
+
model_info = "<style color='#666666'> enter: send | /agent: switch</style>"
|
|
685
|
+
|
|
686
|
+
return HTML(
|
|
687
|
+
f"<style color='#808080'>socialscrape v{version} {cwd_str}:{branch}</style>"
|
|
688
|
+
f"{model_info}"
|
|
689
|
+
f" <b><style color='#808080'>tab </style></b><b><style {badge_style}>┃ {mode_badge} </style></b>"
|
|
690
|
+
)
|