@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.
Files changed (63) hide show
  1. package/README.md +111 -2
  2. package/bin/socialscrape.mjs +115 -0
  3. package/engine/README.md +245 -0
  4. package/engine/SKILL.md +194 -0
  5. package/engine/agent.py +665 -0
  6. package/engine/batch_manager.py +622 -0
  7. package/engine/cli.py +23 -0
  8. package/engine/handlers.py +1109 -0
  9. package/engine/plugins/__init__.py +77 -0
  10. package/engine/plugins/instagram-scrape/README.md +164 -0
  11. package/engine/plugins/instagram-scrape/SKILL.md +53 -0
  12. package/engine/plugins/instagram-scrape/cli.py +176 -0
  13. package/engine/plugins/instagram-scrape/core.py +408 -0
  14. package/engine/plugins/instagram-scrape/plugin.json +42 -0
  15. package/engine/plugins/linkedin-scrape/README.md +143 -0
  16. package/engine/plugins/linkedin-scrape/SKILL.md +47 -0
  17. package/engine/plugins/linkedin-scrape/cli.py +126 -0
  18. package/engine/plugins/linkedin-scrape/core.py +188 -0
  19. package/engine/plugins/linkedin-scrape/plugin.json +36 -0
  20. package/engine/plugins/meta-ad-library-scraper/README.md +127 -0
  21. package/engine/plugins/meta-ad-library-scraper/SKILL.md +44 -0
  22. package/engine/plugins/meta-ad-library-scraper/cli.py +161 -0
  23. package/engine/plugins/meta-ad-library-scraper/core.py +348 -0
  24. package/engine/plugins/meta-ad-library-scraper/plugin.json +44 -0
  25. package/engine/plugins/pinterest-scraper/README.md +150 -0
  26. package/engine/plugins/pinterest-scraper/SKILL.md +45 -0
  27. package/engine/plugins/pinterest-scraper/cli.py +193 -0
  28. package/engine/plugins/pinterest-scraper/core.py +420 -0
  29. package/engine/plugins/pinterest-scraper/plugin.json +40 -0
  30. package/engine/plugins/reddit-discussion-scraper/README.md +162 -0
  31. package/engine/plugins/reddit-discussion-scraper/SKILL.md +52 -0
  32. package/engine/plugins/reddit-discussion-scraper/cli.py +218 -0
  33. package/engine/plugins/reddit-discussion-scraper/core.py +546 -0
  34. package/engine/plugins/reddit-discussion-scraper/plugin.json +46 -0
  35. package/engine/plugins/shared/__init__.py +15 -0
  36. package/engine/plugins/shared/paths.py +90 -0
  37. package/engine/plugins/shared/process_runner.py +169 -0
  38. package/engine/plugins/shared/session_manager.py +287 -0
  39. package/engine/plugins/threads-scraper/README.md +139 -0
  40. package/engine/plugins/threads-scraper/SKILL.md +43 -0
  41. package/engine/plugins/threads-scraper/cli.py +178 -0
  42. package/engine/plugins/threads-scraper/core.py +460 -0
  43. package/engine/plugins/threads-scraper/plugin.json +40 -0
  44. package/engine/plugins/tiktok-scrape/README.md +158 -0
  45. package/engine/plugins/tiktok-scrape/SKILL.md +51 -0
  46. package/engine/plugins/tiktok-scrape/cli.py +163 -0
  47. package/engine/plugins/tiktok-scrape/core.py +313 -0
  48. package/engine/plugins/tiktok-scrape/plugin.json +40 -0
  49. package/engine/plugins/twitter-scrape/README.md +158 -0
  50. package/engine/plugins/twitter-scrape/SKILL.md +50 -0
  51. package/engine/plugins/twitter-scrape/cli.py +153 -0
  52. package/engine/plugins/twitter-scrape/core.py +254 -0
  53. package/engine/plugins/twitter-scrape/plugin.json +40 -0
  54. package/engine/plugins/youtube-scrape/README.md +199 -0
  55. package/engine/plugins/youtube-scrape/SKILL.md +115 -0
  56. package/engine/plugins/youtube-scrape/cli.py +340 -0
  57. package/engine/plugins/youtube-scrape/core.py +829 -0
  58. package/engine/plugins/youtube-scrape/plugin.json +48 -0
  59. package/engine/requirements.txt +8 -0
  60. package/engine/socialscrape_cli.py +500 -0
  61. package/engine/storage.py +570 -0
  62. package/engine/ui.py +690 -0
  63. package/package.json +27 -3
@@ -0,0 +1,150 @@
1
+ # Pinterest Universal Scraper & Downloader Plugin šŸ“Œ
2
+
3
+ > **A self-contained, high-speed, zero-cost Python SDK and CLI engine for Pinterest pins, boards, creator profiles, visual searches, and high-res media downloads.**
4
+
5
+ This plugin extracts structured pin metadata, board feeds, user statistics, and high-resolution media from **single pins**, **user profiles**, **pin feeds**, and **keyword search queries** using Pinterest's internal Resource APIs.
6
+
7
+ ---
8
+
9
+ ## 🌟 Comprehensive Feature Breakdown & Capabilities
10
+
11
+ ### 1. šŸ“Œ Single Pin Intelligence & High-Res Media
12
+ - **How it works**: Queries `https://www.pinterest.com/resource/PinResource/get/` with detailed field-set options and URL-encoded query contexts.
13
+ - **Data Extracted**:
14
+ - `title`, `description`, `created_at`
15
+ - `repin_count`: Total saves / repins
16
+ - `comment_count`: Total comments
17
+ - `link`: Direct destination outbound URL
18
+ - `image_url`: Highest-available resolution image link (`orig` / `736x`)
19
+ - `video_url`: MP4 video stream link (720p / 480p) where available
20
+ - `pinner`: Username, full name, and user ID of the creator.
21
+ - Saved into `Outputs/text_posts/pin_{pin_id}/pin_metadata.json`.
22
+
23
+ ### 2. šŸ‘¤ Creator Profile Intelligence & Bio Extraction
24
+ - **How it works**: Queries `https://www.pinterest.com/resource/UserResource/get/` for comprehensive creator statistics.
25
+ - **Data Extracted**:
26
+ - `username`, `full_name`, `about` (biography)
27
+ - `follower_count`, `following_count`
28
+ - `pin_count`: Total pins created/saved
29
+ - `board_count`: Total public boards
30
+ - `website_url`, `image_large_url` (high-res avatar).
31
+ - Saved into `Outputs/text_posts/user_{username}/profile.json`.
32
+
33
+ ### 3. šŸ–¼ļø Creator Pins Feed Extraction
34
+ - **How it works**: Queries `https://www.pinterest.com/resource/UserPinsResource/get/` with custom page sizing.
35
+ - **Capabilities**:
36
+ - Scrapes a creator's chronological pin feed.
37
+ - Extracts pin IDs, titles, descriptions, outbound links, repin counts, and thumbnail CDN links.
38
+ - Saved into `Outputs/text_posts/user_{username}/pins.json`.
39
+
40
+ ### 4. šŸ” Visual Trends & Keyword Search
41
+ - **How it works**: Queries `https://www.pinterest.com/resource/BaseSearchResource/get/` for visual trend exploration, e-commerce research, and moodboard curation.
42
+ - **Capabilities**:
43
+ - Search any keyword (e.g. `"minimalist web design"`, `"infographics"`).
44
+ - Extracts top matching pins, creators, descriptions, and high-res image links.
45
+ - Saved into `Outputs/text_posts/searches/search_{query}.json`.
46
+
47
+ ### 5. šŸŽ¬ Media & High-Res Image Downloader
48
+ - **How it works**: Downloads original resolution photos (`.jpg` / `.png` / `.webp`) and MP4 video pins directly into `Outputs/` with automatic stream fallback to `yt-dlp`.
49
+ - **Download Modes**:
50
+ - **High-Res Images (`--download-media`)**: Downloads original uncompressed pin image files into `Outputs/thumbnails/pin_{pin_id}/`.
51
+ - **Video Pins**: Downloads `.mp4` video pin streams into `Outputs/videos/pin_{pin_id}/`.
52
+
53
+ ---
54
+
55
+ ## šŸ“ Standardized `Outputs/` Hierarchy
56
+
57
+ Every extracted pin, profile, and visual asset is organized into dedicated folders:
58
+
59
+ ```text
60
+ plugins/pinterest-scraper/
61
+ ā”œā”€ā”€ core.py # ⚔ Pure Python SDK (Zero prints, returns dicts)
62
+ ā”œā”€ā”€ cli.py # šŸ§™ Interactive CLI & Terminal Runner
63
+ ā”œā”€ā”€ plugin.json # šŸ“‹ Universal plugin manifest
64
+ ā”œā”€ā”€ SKILL.md # 🧠 AI Agent parameter discovery protocol
65
+ ā”œā”€ā”€ README.md # šŸ“– Master documentation (This file)
66
+ └── Outputs/ # šŸ’¾ Standardized Categorized Storage
67
+ ā”œā”€ā”€ videos/pin_<pin_id>/
68
+ │ └── video.mp4 # Downloaded video pin
69
+ ā”œā”€ā”€ thumbnails/pin_<pin_id>/
70
+ │ └── pin.jpg # Original high-resolution pin image
71
+ ā”œā”€ā”€ comments/ # Pin comments
72
+ └── text_posts/
73
+ ā”œā”€ā”€ pin_<pin_id>/
74
+ │ └── pin_metadata.json # Deep pin metadata & links
75
+ ā”œā”€ā”€ user_<username>/
76
+ │ ā”œā”€ā”€ profile.json # Creator profile statistics
77
+ │ └── pins.json # Creator pin feeds
78
+ └── searches/
79
+ └── search_<query>.json # Visual keyword search results
80
+ ```
81
+
82
+ ---
83
+
84
+ ## šŸ’” AI Agent Usage: In-Memory / Zero-Disk Execution
85
+
86
+ When an AI agent (Claude Code, Cursor, Codex, Antigravity) executes this plugin, **it does NOT need to write heavy media artifacts to disk**.
87
+
88
+ ### Zero-Disk Execution Modes for AI Agents:
89
+
90
+ 1. **In-Memory CLI Pipe (`--stdout`)**:
91
+ ```bash
92
+ python plugins/pinterest-scraper/cli.py "https://www.pinterest.com/pin/1234567890/" --stdout
93
+ ```
94
+ *The structured JSON streams directly into the AI's standard input in RAM.*
95
+
96
+ 2. **Direct Python SDK Import**:
97
+ ```python
98
+ import sys
99
+ from pathlib import Path
100
+ sys.path.insert(0, str(Path("plugins/pinterest-scraper").resolve()))
101
+ import core
102
+
103
+ # Returns pure Python dictionary in RAM with zero disk writes!
104
+ pin = core.get_pin_details("1234567890")
105
+ profile = core.get_pinterest_user_profile("designmilk")
106
+ search = core.search_pinterest_pins("saas landing page", limit=10)
107
+ ```
108
+
109
+ ---
110
+
111
+ ## šŸš€ CLI Commands & Usage Examples
112
+
113
+ ### 1. Interactive Wizard (Easiest for Humans)
114
+ ```bash
115
+ python plugins/pinterest-scraper/cli.py -i
116
+ ```
117
+
118
+ ### 2. Single Pin Metadata & Media Download
119
+ ```bash
120
+ # Scrape pin details and download original high-res image
121
+ python plugins/pinterest-scraper/cli.py "https://www.pinterest.com/pin/1234567890/" --download-media
122
+
123
+ # Scrape pin by ID
124
+ python plugins/pinterest-scraper/cli.py 1234567890
125
+ ```
126
+
127
+ ### 3. Creator Profile Scraping
128
+ ```bash
129
+ # Scrape creator statistics and bio
130
+ python plugins/pinterest-scraper/cli.py designmilk --profile
131
+ ```
132
+
133
+ ### 4. Creator Pin Feeds
134
+ ```bash
135
+ # Scrape latest 30 pins from a creator
136
+ python plugins/pinterest-scraper/cli.py designmilk --pins --limit 30
137
+ ```
138
+
139
+ ### 5. Keyword & Visual Search
140
+ ```bash
141
+ # Search Pinterest for design inspiration
142
+ python plugins/pinterest-scraper/cli.py --search "minimalist brand identity" --limit 25
143
+ ```
144
+
145
+ ---
146
+
147
+ ## šŸ”’ Rate Limiting & Safety Rails
148
+
149
+ - **Resource API Encoding**: Formats request options and contexts using standard URL encoding for reliable execution.
150
+ - **RateLimiter**: Integrated with `plugins/shared/session_manager.py` enforcing a default pacing of 1.5–3.5 seconds between requests and a 120 requests/hour ceiling.
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: pinterest-scraper
3
+ description: "Self-contained plugin and skill for scraping Pinterest pins, high-res images, user profiles, creator pin feeds, keyword searches, and media downloads."
4
+ triggers:
5
+ - pinterest.com
6
+ - pinterest.com/pin
7
+ - pin.it
8
+ - pinterest scrape
9
+ - pinterest profile
10
+ - download pinterest
11
+ - pinterest image
12
+ ---
13
+
14
+ # Pinterest Scraper & Media Downloader Skill
15
+
16
+ ## Overview
17
+ This plugin executes zero-cost, unauthenticated extraction of Pinterest pins, user profiles, feeds, search results, and media via Pinterest's internal Resource APIs.
18
+
19
+ ### Capabilities:
20
+ - **Pin Metadata**: Detailed description, destination link, repin/save counts, and high-res image CDN links.
21
+ - **Creator Profiles**: Bio, follower counts, following counts, board counts, and pin counts.
22
+ - **User Pin Feeds**: Latest pins created or saved by a user.
23
+ - **Keyword Search**: Discover top pins for design, e-commerce, and visual ideas.
24
+ - **Media Downloader**: Download high-resolution images and video pins directly into `Outputs/thumbnails/` and `Outputs/videos/`.
25
+
26
+ ---
27
+
28
+ ## ⚔ CLI Usage Examples
29
+
30
+ ```bash
31
+ # 1. Interactive Wizard
32
+ python plugins/pinterest-scraper/cli.py -i
33
+
34
+ # 2. Scrape Pin Details & Download Image
35
+ python plugins/pinterest-scraper/cli.py "https://www.pinterest.com/pin/1234567890/" --download-media
36
+
37
+ # 3. Scrape Creator Profile
38
+ python plugins/pinterest-scraper/cli.py designmilk --profile
39
+
40
+ # 4. Scrape User Pins Feed
41
+ python plugins/pinterest-scraper/cli.py designmilk --pins --limit 30
42
+
43
+ # 5. Search Pins by Keyword
44
+ python plugins/pinterest-scraper/cli.py --search "minimalist packaging design" --limit 20
45
+ ```
@@ -0,0 +1,193 @@
1
+ """
2
+ Pinterest Scraper CLI (`cli.py`)
3
+ Interactive wizard and command-line presentation layer for pinterest-scraper.
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_pinterest_target,
28
+ get_pin_details,
29
+ get_pinterest_user_profile,
30
+ get_pinterest_user_pins,
31
+ search_pinterest_pins,
32
+ download_pinterest_media,
33
+ )
34
+ except ImportError:
35
+ sys.path.insert(0, str(PLUGIN_DIR))
36
+ from core import (
37
+ extract_pinterest_target,
38
+ get_pin_details,
39
+ get_pinterest_user_profile,
40
+ get_pinterest_user_pins,
41
+ search_pinterest_pins,
42
+ download_pinterest_media,
43
+ )
44
+
45
+
46
+ def run_interactive_wizard():
47
+ print("=" * 65)
48
+ print(" šŸ“Œ Pinterest Universal Scraper & Downloader Wizard")
49
+ print("=" * 65)
50
+ print("\nSelect Option:")
51
+ print(" [1] Scrape Single Pin Details & High-Res Image")
52
+ print(" [2] Scrape Creator Profile & Bio Stats")
53
+ print(" [3] Scrape Creator Pins Feed")
54
+ print(" [4] Keyword Search for Pins")
55
+ print(" [5] Download Pin Media (High-Res Image / Video MP4)")
56
+ print(" [6] Full Extraction Suite (--all)")
57
+
58
+ choice = input("\nEnter choice [1-6] (default: 1): ").strip() or "1"
59
+
60
+ if choice == "1":
61
+ target = input("\nEnter Pin URL or ID (e.g. '1234567890' or 'pinterest.com/pin/...'): ").strip()
62
+ if not target:
63
+ print("[!] No pin specified. Exiting.")
64
+ return
65
+ print(f"\n[+] Extracting Pin details for {target}...")
66
+ res = get_pin_details(target)
67
+ if res.get("status") == "success":
68
+ print(f"\nāœ… Pin Extracted:")
69
+ print(f" šŸ“Œ Title: {res.get('title')}")
70
+ print(f" šŸ“ Description: {res.get('description')}")
71
+ print(f" šŸ”— Link: {res.get('link')}")
72
+ print(f" šŸ’¾ Saved to: {res.get('saved_path')}")
73
+ else:
74
+ print(f"[!] Error: {res.get('error')}")
75
+
76
+ elif choice == "2":
77
+ username = input("\nEnter Pinterest Username (e.g. 'designmilk'): ").strip()
78
+ if not username:
79
+ print("[!] No username specified. Exiting.")
80
+ return
81
+ print(f"\n[+] Fetching Profile for {username}...")
82
+ res = get_pinterest_user_profile(username)
83
+ if res.get("status") == "success":
84
+ prof = res.get("profile", {})
85
+ print(f"\nāœ… Profile Extracted:")
86
+ print(f" šŸ‘¤ Name: {prof.get('full_name')} (@{prof.get('username')})")
87
+ print(f" šŸ“ About: {prof.get('about')}")
88
+ print(f" šŸ‘„ Followers: {prof.get('follower_count'):,}")
89
+ print(f" šŸ“Œ Pins: {prof.get('pin_count'):,}")
90
+ print(f" šŸ’¾ Saved to: {res.get('saved_path')}")
91
+ else:
92
+ print(f"[!] Error: {res.get('error')}")
93
+
94
+ elif choice == "3":
95
+ username = input("\nEnter Pinterest Username: ").strip()
96
+ limit_str = input("Limit pins count (default: 25): ").strip() or "25"
97
+ limit = int(limit_str) if limit_str.isdigit() else 25
98
+ print(f"\n[+] Fetching Pins for {username}...")
99
+ res = get_pinterest_user_pins(username, limit=limit)
100
+ if res.get("status") == "success":
101
+ print(f"\nāœ… Extracted {res['count']} pins for {username}")
102
+ print(f"šŸ’¾ Saved to: {res.get('saved_path')}")
103
+ for idx, p in enumerate(res["pins"][:5], 1):
104
+ print(f" {idx}. {p.get('title') or 'Untitled Pin'} (Repins: {p.get('repin_count', 0)})")
105
+ else:
106
+ print(f"[!] Error: {res.get('error')}")
107
+
108
+ elif choice == "4":
109
+ query = input("\nEnter Search Keyword (e.g. 'minimalist logo design'): ").strip()
110
+ print(f"\n[+] Searching Pinterest for '{query}'...")
111
+ res = search_pinterest_pins(query)
112
+ if res.get("status") == "success":
113
+ print(f"\nāœ… Found {res['count']} pins for '{query}'")
114
+ print(f"šŸ’¾ Saved to: {res.get('saved_path')}")
115
+ else:
116
+ print(f"[!] Error: {res.get('error')}")
117
+
118
+ elif choice == "5":
119
+ target = input("\nEnter Pin URL or ID: ").strip()
120
+ print(f"\n[+] Downloading Media for Pin {target}...")
121
+ res = download_pinterest_media(target)
122
+ if res.get("status") == "success":
123
+ print(f"\nāœ… Download complete!")
124
+ if res.get("thumbnail_path"):
125
+ print(f" šŸ–¼ļø Image saved: {res['thumbnail_path']}")
126
+ if res.get("video_path"):
127
+ print(f" šŸŽ¬ Video saved: {res['video_path']}")
128
+ else:
129
+ print(f"[!] Notice: {res.get('error')}")
130
+
131
+ elif choice == "6":
132
+ target = input("\nEnter Pin or Username: ").strip()
133
+ parsed = extract_pinterest_target(target)
134
+ print(f"\n[+] Running Full Extraction Suite on {target}...")
135
+ if parsed["type"] == "user":
136
+ p = get_pinterest_user_profile(parsed["id"])
137
+ pins = get_pinterest_user_pins(parsed["id"])
138
+ print(json.dumps({"profile": p, "pins": pins}, indent=2, default=str))
139
+ else:
140
+ d = get_pin_details(target)
141
+ m = download_pinterest_media(target)
142
+ print(json.dumps({"pin": d, "media": m}, indent=2, default=str))
143
+
144
+
145
+ def main():
146
+ parser = argparse.ArgumentParser(description="Pinterest Scraper & Media Downloader CLI")
147
+ parser.add_argument("target", nargs="?", help="Pin URL/ID, Username, or Board")
148
+ parser.add_argument("-i", "--interactive", action="store_true", help="Launch interactive wizard")
149
+ parser.add_argument("--profile", action="store_true", help="Extract user profile info")
150
+ parser.add_argument("--pins", action="store_true", help="Scrape user pins feed")
151
+ parser.add_argument("--search", type=str, help="Search Pinterest by keyword")
152
+ parser.add_argument("-l", "--limit", type=int, default=25, help="Number of items to extract")
153
+ parser.add_argument("--download-media", action="store_true", help="Download high-res pin image or video")
154
+ parser.add_argument("--stdout", action="store_true", help="Output raw JSON to stdout")
155
+ parser.add_argument("--output-dir", "-o", type=str, default=str(DEFAULT_OUTPUTS_DIR), help="Output base directory.")
156
+
157
+ args = parser.parse_args()
158
+ if args.output_dir:
159
+ os.environ["SOCIALSCRAPE_OUTPUT_DIR"] = str(Path(args.output_dir).expanduser().resolve())
160
+
161
+ if args.interactive or (not args.target and not args.search):
162
+ run_interactive_wizard()
163
+ return
164
+
165
+ result = {}
166
+
167
+ if args.search:
168
+ result = search_pinterest_pins(args.search, limit=args.limit)
169
+ elif args.target:
170
+ parsed = extract_pinterest_target(args.target)
171
+ if args.profile or (parsed["type"] == "user" and not args.pins):
172
+ result = get_pinterest_user_profile(parsed["id"])
173
+ elif args.pins or parsed["type"] == "user":
174
+ result = get_pinterest_user_pins(parsed["id"], limit=args.limit)
175
+ elif parsed["type"] == "pin":
176
+ result = get_pin_details(parsed["id"])
177
+ if args.download_media:
178
+ result["media_download"] = download_pinterest_media(parsed["id"])
179
+
180
+ if args.stdout:
181
+ print(json.dumps(result, indent=2, default=str))
182
+ else:
183
+ status = result.get("status")
184
+ if status == "success":
185
+ print(f"āœ… Extraction completed successfully!")
186
+ if "saved_path" in result:
187
+ print(f"šŸ’¾ File: {result['saved_path']}")
188
+ else:
189
+ print(f"[!] Notice: {result.get('error', 'Operation finished with warnings.')}")
190
+
191
+
192
+ if __name__ == "__main__":
193
+ main()