@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
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "threads-scraper",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Zero-cost Threads scraper for user profiles, thread feeds, discussions, and video/media downloads using dynamic LSD token extraction.",
|
|
5
|
+
"author": "SocialScrape",
|
|
6
|
+
"main": "cli.py",
|
|
7
|
+
"display_name": "Threads Scraper",
|
|
8
|
+
"command": "/threads",
|
|
9
|
+
"command_description": "Meta Threads profiles, feeds & discussions",
|
|
10
|
+
"aliases": ["/threads"],
|
|
11
|
+
"cli_aliases": ["threads"],
|
|
12
|
+
"url_patterns": ["threads.net"],
|
|
13
|
+
"tool_schema": {
|
|
14
|
+
"name": "threads_scrape",
|
|
15
|
+
"description": "Scrapes Meta Threads user profiles, creator thread feeds, single thread discussions, and media downloads.",
|
|
16
|
+
"parameters": {
|
|
17
|
+
"type": "object",
|
|
18
|
+
"properties": {
|
|
19
|
+
"target": {"type": "string", "description": "Threads post URL or creator @username."},
|
|
20
|
+
"input_file": {"type": "string", "description": "Path to .txt or .csv file for bulk Threads targets."},
|
|
21
|
+
"profile": {"type": "boolean", "description": "Extract user bio and stats."},
|
|
22
|
+
"feed": {"type": "boolean", "description": "Extract creator thread feed."},
|
|
23
|
+
"download_video": {"type": "boolean"},
|
|
24
|
+
"download_thumbnail": {"type": "boolean"},
|
|
25
|
+
"limit": {"type": "integer"}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"flag_mapping": {
|
|
30
|
+
"positional": ["target"],
|
|
31
|
+
"flags": {
|
|
32
|
+
"input_file": "--input-file",
|
|
33
|
+
"profile": "--profile",
|
|
34
|
+
"feed": "--feed",
|
|
35
|
+
"limit": "-l",
|
|
36
|
+
"download_video": "--download-video",
|
|
37
|
+
"download_thumbnail": "--download-thumb"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# TikTok Universal Scraper & Downloader Plugin šµ
|
|
2
|
+
|
|
3
|
+
> **A self-contained, high-speed Python SDK and CLI engine for watermark-free TikTok videos, audio tracks, spoken captions/transcripts, and creator feeds.**
|
|
4
|
+
|
|
5
|
+
This plugin extracts data and downloads media from **single TikTok videos**, **creator profile feeds**, **auto-generated spoken captions**, and **trending background music tracks** with zero browser overhead.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## š Comprehensive Feature Breakdown & Capabilities
|
|
10
|
+
|
|
11
|
+
### 1. š¬ Watermark-Free MP4 Video Downloader
|
|
12
|
+
- **How it works**: Uses `yt-dlp` stream extraction to bypass TikTok's burned-in watermarks, downloading original clean MP4 video files.
|
|
13
|
+
- **Capabilities**:
|
|
14
|
+
- Downloads crisp, watermark-free `.mp4` video files directly into `Outputs/videos/{id}/`.
|
|
15
|
+
- Supports resolution selectors: `best` (1080p/High), `720p`, and `480p`.
|
|
16
|
+
- Downloads high-resolution video cover frames and thumbnails into `Outputs/thumbnails/{id}/`.
|
|
17
|
+
|
|
18
|
+
### 2. š§ Isolated Audio Track Extractor
|
|
19
|
+
- **How it works**: Extracts pure background audio and trending songs without the video stream.
|
|
20
|
+
- **Download Modes**:
|
|
21
|
+
- **Audio Only (`--download-audio`)**: Saves high-bitrate `.m4a` or `.mp3` audio files into `Outputs/videos/{id}/audio.m4a`.
|
|
22
|
+
- Perfect for music discovery, audio sampling, and podcast/voiceover analysis.
|
|
23
|
+
|
|
24
|
+
### 3. š Spoken Captions & Transcripts Engine
|
|
25
|
+
- **How it works**: Scrapes embedded automated speech-to-text (ASR) closed captions and creator-provided subtitles.
|
|
26
|
+
- **Capabilities**:
|
|
27
|
+
- Generates clean **Plain Text (`.txt`)** saved to `Outputs/text_posts/{id}_transcript.txt`.
|
|
28
|
+
- Generates structured JSON with millisecond-level word timing and phrase arrays.
|
|
29
|
+
- **In-Memory Pipe (`--stdout`)**: Streams plain text transcript directly for AI agent consumption.
|
|
30
|
+
|
|
31
|
+
### 4. šŗ Creator Feed & Video Discovery
|
|
32
|
+
- **How it works**: Queries creator video feeds via `@username` or channel URLs to discover recent video IDs, descriptions, and view metrics.
|
|
33
|
+
- **Data Extracted**:
|
|
34
|
+
- `id`: Video identifier.
|
|
35
|
+
- `title`: Video caption and hashtags.
|
|
36
|
+
- `url`: Direct web link to video.
|
|
37
|
+
|
|
38
|
+
### 5. š¦ Complete Extraction Bundle (`--all`)
|
|
39
|
+
- **How it works**: Extracts video metadata, spoken transcript, audio track, and watermark-free video in a single unified command.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## š Standardized `Outputs/` Hierarchy
|
|
44
|
+
|
|
45
|
+
Every extracted video asset is organized cleanly into dedicated folders:
|
|
46
|
+
|
|
47
|
+
```text
|
|
48
|
+
plugins/tiktok-scrape/
|
|
49
|
+
āāā core.py # ā” Pure Python SDK (Zero prints, returns dicts)
|
|
50
|
+
āāā cli.py # š§ Interactive CLI & Terminal Runner
|
|
51
|
+
āāā plugin.json # š Universal plugin manifest
|
|
52
|
+
āāā SKILL.md # š§ AI Agent parameter discovery protocol
|
|
53
|
+
āāā README.md # š Master documentation (This file)
|
|
54
|
+
āāā requirements.txt # š¦ Isolated dependencies (yt-dlp, requests)
|
|
55
|
+
āāā Outputs/ # š¾ Standardized Categorized Storage
|
|
56
|
+
āāā videos/<video_id>/
|
|
57
|
+
ā āāā video.mp4 # Clean watermark-free MP4 video
|
|
58
|
+
ā āāā audio.m4a # Extracted pure audio track
|
|
59
|
+
āāā thumbnails/<video_id>/
|
|
60
|
+
ā āāā thumbnail.jpg # High-res video cover image
|
|
61
|
+
āāā comments/
|
|
62
|
+
ā āāā <video_id>_comments.json # Top comments & replies
|
|
63
|
+
āāā text_posts/
|
|
64
|
+
āāā <video_id>_metadata.json # Video statistics & tags
|
|
65
|
+
āāā <video_id>_transcript.txt # Spoken captions & transcript
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## š” AI Agent Usage: In-Memory / Zero-Disk Execution
|
|
71
|
+
|
|
72
|
+
When an AI agent (Claude Code, Cursor, Codex, Antigravity) executes this plugin, **it does NOT need to write heavy video files to disk**.
|
|
73
|
+
|
|
74
|
+
### Zero-Disk Execution Modes for AI Agents:
|
|
75
|
+
|
|
76
|
+
1. **In-Memory CLI Pipe (`--stdout`)**:
|
|
77
|
+
```bash
|
|
78
|
+
python plugins/tiktok-scrape/cli.py "https://www.tiktok.com/@creator/video/123456789" --transcript --stdout
|
|
79
|
+
```
|
|
80
|
+
*The spoken captions stream directly into the AI's standard input in RAM.*
|
|
81
|
+
|
|
82
|
+
2. **Direct Python SDK Import**:
|
|
83
|
+
```python
|
|
84
|
+
import sys
|
|
85
|
+
from pathlib import Path
|
|
86
|
+
sys.path.insert(0, str(Path("plugins/tiktok-scrape").resolve()))
|
|
87
|
+
import core
|
|
88
|
+
|
|
89
|
+
# Returns pure Python dictionary in RAM with zero disk writes!
|
|
90
|
+
transcript = core.get_tiktok_transcript("https://www.tiktok.com/@creator/video/123456789")
|
|
91
|
+
meta = core.get_tiktok_video_metadata("https://www.tiktok.com/@creator/video/123456789")
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## š CLI Commands & Usage Examples
|
|
97
|
+
|
|
98
|
+
### 1. Interactive Wizard (Easiest for Humans)
|
|
99
|
+
```bash
|
|
100
|
+
python plugins/tiktok-scrape/cli.py -i
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### 2. Single Video Downloads (Watermark-Free)
|
|
104
|
+
```bash
|
|
105
|
+
# Download watermark-free MP4 video
|
|
106
|
+
python plugins/tiktok-scrape/cli.py "https://www.tiktok.com/@creator/video/123456789" --download-video
|
|
107
|
+
|
|
108
|
+
# Extract pure audio track only
|
|
109
|
+
python plugins/tiktok-scrape/cli.py "https://www.tiktok.com/@creator/video/123456789" --download-audio
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### 3. Spoken Captions & Transcripts
|
|
113
|
+
```bash
|
|
114
|
+
# Extract captions and spoken transcript to text file
|
|
115
|
+
python plugins/tiktok-scrape/cli.py "https://www.tiktok.com/@creator/video/123456789" --transcript
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### 4. Creator Feed Discovery
|
|
119
|
+
```bash
|
|
120
|
+
# Discover recent videos from creator
|
|
121
|
+
python plugins/tiktok-scrape/cli.py "@mrbeast" --feed
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### 5. Full Extraction Suite
|
|
125
|
+
```bash
|
|
126
|
+
# Extract video, audio, captions, and metadata all in one run
|
|
127
|
+
python plugins/tiktok-scrape/cli.py "https://www.tiktok.com/@creator/video/123456789" --all
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## āļø CLI Flag Reference Table
|
|
133
|
+
|
|
134
|
+
| Flag | Shorthand | Type | Default | Description |
|
|
135
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
136
|
+
| `target` | - | `string` | `None` | TikTok video URL, ID, or creator `@username`. |
|
|
137
|
+
| `--interactive` | `-i` | `flag` | `False` | Launch step-by-step interactive wizard. |
|
|
138
|
+
| `--stdout` | - | `flag` | `False` | Stream structured data directly to console. |
|
|
139
|
+
| `--download-video` | - | `flag` | `False` | Download watermark-free `.mp4` video. |
|
|
140
|
+
| `--download-audio` | - | `flag` | `False` | Extract background audio track only. |
|
|
141
|
+
| `--download-thumb` | - | `flag` | `False` | Download high-res cover thumbnail. |
|
|
142
|
+
| `-q` / `--quality` | - | `string` | `best` | Video quality: `best`, `1080p`, `720p`, `480p`. |
|
|
143
|
+
| `--transcript` | - | `flag` | `False` | Extract video auto-captions and spoken words. |
|
|
144
|
+
| `--feed` | - | `flag` | `False` | Scrape creator upload feed. |
|
|
145
|
+
| `--all` | `-a` | `flag` | `False` | Extract EVERYTHING (Metadata + Captions + Audio + Video). |
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## š Security & Defensive Engineering
|
|
150
|
+
|
|
151
|
+
1. **Path Traversal Protection**: Output paths are validated against allowed project boundaries.
|
|
152
|
+
2. **Watermark Bypass**: Stream parsing connects directly to raw CDN endpoints without watermarking post-processing.
|
|
153
|
+
3. **Pacing & Rate Limiting**: Built-in human delay jitter protects burner sessions from platform rate limits.
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## š License
|
|
158
|
+
MIT License. Part of the [SocialScrape](../../README.md) toolkit.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tiktok-scrape
|
|
3
|
+
description: "Self-contained plugin and skill for scraping TikTok creator feeds, watermark-free videos, transcripts/captions, user profiles, and comment trees."
|
|
4
|
+
triggers:
|
|
5
|
+
- tiktok.com
|
|
6
|
+
- vm.tiktok.com
|
|
7
|
+
- vt.tiktok.com
|
|
8
|
+
- tiktok video
|
|
9
|
+
- download tiktok
|
|
10
|
+
- tiktok transcript
|
|
11
|
+
- tiktok comments
|
|
12
|
+
- tiktok feed
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# TikTok Scrape Plugin & Skill
|
|
16
|
+
|
|
17
|
+
## Overview
|
|
18
|
+
This plugin executes high-speed, cost-effective extraction and watermark-free media downloading for TikTok:
|
|
19
|
+
- **Watermark-Free Video Downloads**: Direct MP4 downloads via `yt-dlp`.
|
|
20
|
+
- **Audio & Captions / Transcripts**: Auto-captions extraction saved as plain text (`.txt`) and timestamped JSON.
|
|
21
|
+
- **Profiles & Feeds**: User info and recent video feed discovery via headless signature generation.
|
|
22
|
+
- **Comments**: Comment tree extraction with author names and likes.
|
|
23
|
+
|
|
24
|
+
All disk outputs are organized into structured directories inside `plugins/tiktok-scrape/Outputs/`:
|
|
25
|
+
- `Outputs/videos/`
|
|
26
|
+
- `Outputs/thumbnails/`
|
|
27
|
+
- `Outputs/comments/`
|
|
28
|
+
- `Outputs/text_posts/`
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## ā” Execution Modes & Commands
|
|
33
|
+
|
|
34
|
+
### 1. In-Memory / Zero-Disk Execution
|
|
35
|
+
```bash
|
|
36
|
+
python plugins/tiktok-scrape/cli.py "<TIKTOK_URL>" --stdout
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 2. Single Video Scrape
|
|
40
|
+
```bash
|
|
41
|
+
# Download watermark-free video and extract transcript
|
|
42
|
+
python plugins/tiktok-scrape/cli.py "<TIKTOK_URL>" --all
|
|
43
|
+
|
|
44
|
+
# Download video only
|
|
45
|
+
python plugins/tiktok-scrape/cli.py "<TIKTOK_URL>" --download-video
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 3. Interactive Wizard
|
|
49
|
+
```bash
|
|
50
|
+
python plugins/tiktok-scrape/cli.py -i
|
|
51
|
+
```
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"""
|
|
2
|
+
TikTok Universal Scraper CLI (`cli.py`)
|
|
3
|
+
Interactive CLI and presentation layer for tiktok-scrape.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import os
|
|
7
|
+
import sys
|
|
8
|
+
import json
|
|
9
|
+
import argparse
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
from typing import Dict, Any
|
|
12
|
+
|
|
13
|
+
sys.stdout.reconfigure(encoding="utf-8")
|
|
14
|
+
PLUGIN_DIR = Path(__file__).parent.resolve()
|
|
15
|
+
try:
|
|
16
|
+
from plugins.shared.paths import get_plugin_outputs_dir
|
|
17
|
+
except ImportError:
|
|
18
|
+
_shared_parent = str(PLUGIN_DIR.parent.resolve())
|
|
19
|
+
if _shared_parent not in sys.path:
|
|
20
|
+
sys.path.insert(0, _shared_parent)
|
|
21
|
+
from shared.paths import get_plugin_outputs_dir
|
|
22
|
+
|
|
23
|
+
DEFAULT_OUTPUTS_DIR = get_plugin_outputs_dir(PLUGIN_DIR)
|
|
24
|
+
|
|
25
|
+
try:
|
|
26
|
+
from core import (
|
|
27
|
+
extract_tiktok_id_or_user,
|
|
28
|
+
download_tiktok_media,
|
|
29
|
+
get_tiktok_video_metadata,
|
|
30
|
+
get_tiktok_transcript,
|
|
31
|
+
get_tiktok_user_feed,
|
|
32
|
+
)
|
|
33
|
+
except ImportError:
|
|
34
|
+
sys.path.insert(0, str(PLUGIN_DIR))
|
|
35
|
+
from core import (
|
|
36
|
+
extract_tiktok_id_or_user,
|
|
37
|
+
download_tiktok_media,
|
|
38
|
+
get_tiktok_video_metadata,
|
|
39
|
+
get_tiktok_transcript,
|
|
40
|
+
get_tiktok_user_feed,
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def run_interactive_wizard():
|
|
45
|
+
print("=" * 65)
|
|
46
|
+
print(" šµ TikTok Universal Scraper & Downloader Wizard")
|
|
47
|
+
print("=" * 65)
|
|
48
|
+
print("\nSelect Option:")
|
|
49
|
+
print(" [1] Download Watermark-Free Video (MP4)")
|
|
50
|
+
print(" [2] Download Audio Only (MP3/M4A)")
|
|
51
|
+
print(" [3] Extract Video Captions / Transcript")
|
|
52
|
+
print(" [4] Scrape Creator Feed & Recent Videos")
|
|
53
|
+
print(" [5] Full Extraction Suite (--all)")
|
|
54
|
+
|
|
55
|
+
choice = input("\nEnter choice [1-5] (default: 1): ").strip() or "1"
|
|
56
|
+
target = input("\nEnter TikTok Video URL or @username: ").strip()
|
|
57
|
+
if not target:
|
|
58
|
+
print("[!] No target specified. Exiting.")
|
|
59
|
+
return
|
|
60
|
+
|
|
61
|
+
if choice in ("1", "2"):
|
|
62
|
+
is_audio = (choice == "2")
|
|
63
|
+
print(f"\n[+] Downloading from TikTok target: {target}...")
|
|
64
|
+
res = download_tiktok_media(target, download_video=not is_audio, download_audio=is_audio)
|
|
65
|
+
if res.get("status") == "success":
|
|
66
|
+
print(f"\nā
Download complete!")
|
|
67
|
+
if res.get("video_path"):
|
|
68
|
+
print(f" š¬ Video saved: {res['video_path']}")
|
|
69
|
+
if res.get("audio_path"):
|
|
70
|
+
print(f" šµ Audio saved: {res['audio_path']}")
|
|
71
|
+
if res.get("thumbnail_path"):
|
|
72
|
+
print(f" š¼ļø Thumbnail saved: {res['thumbnail_path']}")
|
|
73
|
+
else:
|
|
74
|
+
print(f"[!] Download notice: {res.get('error')}")
|
|
75
|
+
|
|
76
|
+
elif choice == "3":
|
|
77
|
+
print(f"\n[+] Extracting captions/transcript for {target}...")
|
|
78
|
+
res = get_tiktok_transcript(target)
|
|
79
|
+
if res.get("status") == "success":
|
|
80
|
+
print(f"\nā
Transcript Extracted:")
|
|
81
|
+
print(f" š Text: {res.get('text', '')[:300]}...")
|
|
82
|
+
if res.get("saved_text_path"):
|
|
83
|
+
print(f" š¾ Saved to: {res['saved_text_path']}")
|
|
84
|
+
else:
|
|
85
|
+
print(f"[!] Extraction notice: {res.get('error')}")
|
|
86
|
+
|
|
87
|
+
elif choice == "4":
|
|
88
|
+
print(f"\n[+] Scraping TikTok Creator Feed for {target}...")
|
|
89
|
+
res = get_tiktok_user_feed(target, limit=10)
|
|
90
|
+
print(f"\nā
Feed Discovered: {res.get('total_found', 0)} videos found.")
|
|
91
|
+
for v in res.get("videos", []):
|
|
92
|
+
print(f" - [{v.get('id')}] {v.get('title')[:60]}")
|
|
93
|
+
|
|
94
|
+
elif choice == "5":
|
|
95
|
+
print(f"\n[+] Running Full TikTok Suite on {target}...")
|
|
96
|
+
m = get_tiktok_video_metadata(target)
|
|
97
|
+
t = get_tiktok_transcript(target)
|
|
98
|
+
d = download_tiktok_media(target)
|
|
99
|
+
print(f"\nā
Full Extraction Bundle Completed:")
|
|
100
|
+
print(json.dumps({"metadata": m, "transcript": t, "download": d}, indent=2, default=str))
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def main():
|
|
104
|
+
parser = argparse.ArgumentParser(description="TikTok Scraper & Watermark-Free Downloader CLI")
|
|
105
|
+
parser.add_argument("target", nargs="?", help="TikTok video URL or @username")
|
|
106
|
+
parser.add_argument("-i", "--interactive", action="store_true", help="Launch interactive wizard")
|
|
107
|
+
parser.add_argument("--stdout", action="store_true", help="Print structured data directly to stdout")
|
|
108
|
+
parser.add_argument("--download-video", action="store_true", help="Download watermark-free MP4 video")
|
|
109
|
+
parser.add_argument("--download-audio", action="store_true", help="Extract audio track only")
|
|
110
|
+
parser.add_argument("--download-thumb", action="store_true", help="Download cover image")
|
|
111
|
+
parser.add_argument("-q", "--quality", default="best", choices=["best", "1080p", "720p", "480p"], help="Video quality")
|
|
112
|
+
parser.add_argument("--transcript", action="store_true", help="Extract video captions/transcript")
|
|
113
|
+
parser.add_argument("--feed", action="store_true", help="Scrape user video feed")
|
|
114
|
+
parser.add_argument("--all", action="store_true", help="Extract all metadata, transcript, and media")
|
|
115
|
+
parser.add_argument("--output-dir", "-o", type=str, default=str(DEFAULT_OUTPUTS_DIR), help="Output base directory.")
|
|
116
|
+
|
|
117
|
+
args = parser.parse_args()
|
|
118
|
+
if args.output_dir:
|
|
119
|
+
os.environ["SOCIALSCRAPE_OUTPUT_DIR"] = str(Path(args.output_dir).expanduser().resolve())
|
|
120
|
+
if args.interactive or not args.target:
|
|
121
|
+
run_interactive_wizard()
|
|
122
|
+
return
|
|
123
|
+
|
|
124
|
+
parsed = extract_tiktok_id_or_user(args.target)
|
|
125
|
+
|
|
126
|
+
if args.stdout:
|
|
127
|
+
if args.transcript:
|
|
128
|
+
data = get_tiktok_transcript(args.target)
|
|
129
|
+
elif args.feed or parsed["type"] == "user":
|
|
130
|
+
data = get_tiktok_user_feed(parsed["id"])
|
|
131
|
+
else:
|
|
132
|
+
data = get_tiktok_video_metadata(args.target)
|
|
133
|
+
print(json.dumps(data, indent=2, ensure_ascii=False))
|
|
134
|
+
return
|
|
135
|
+
|
|
136
|
+
if args.transcript:
|
|
137
|
+
res = get_tiktok_transcript(args.target)
|
|
138
|
+
print(f"[+] Transcript extracted for {args.target}")
|
|
139
|
+
return
|
|
140
|
+
|
|
141
|
+
if args.feed or parsed["type"] == "user":
|
|
142
|
+
res = get_tiktok_user_feed(parsed["id"])
|
|
143
|
+
print(f"[+] Feed discovered: {res.get('total_found', 0)} videos")
|
|
144
|
+
return
|
|
145
|
+
|
|
146
|
+
if args.download_video or args.download_audio or args.download_thumb or args.all:
|
|
147
|
+
res = download_tiktok_media(
|
|
148
|
+
args.target,
|
|
149
|
+
download_video=(args.download_video or args.all),
|
|
150
|
+
download_audio=args.download_audio,
|
|
151
|
+
download_thumbnail=(args.download_thumb or args.all),
|
|
152
|
+
quality=args.quality
|
|
153
|
+
)
|
|
154
|
+
print(f"[+] TikTok Media Download result: {res.get('status')}")
|
|
155
|
+
return
|
|
156
|
+
|
|
157
|
+
# Default: metadata extraction
|
|
158
|
+
res = get_tiktok_video_metadata(args.target)
|
|
159
|
+
print(f"[+] Scraped TikTok video: {res.get('title') or res.get('status')}")
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
if __name__ == "__main__":
|
|
163
|
+
main()
|