Download scripts/local_hunter.py from Paritosh-Sovereign/Friday-Subconscious: direct link, hf CLI and curl.
- Browser
- Download file 2.57 kB
-
https://huggingface.co/spaces/Paritosh-Sovereign/Friday-Subconscious/resolve/main/scripts/local_hunter.py
- Command line
-
hf download hf://spaces/Paritosh-Sovereign/Friday-Subconscious/scripts/local_hunter.py
-
curl -L -o local_hunter.py https://huggingface.co/spaces/Paritosh-Sovereign/Friday-Subconscious/resolve/main/scripts/local_hunter.py
2.57 kB
| import requests | |
| import json | |
| import time | |
| import random | |
| from duckduckgo_search import DDGS | |
| import trafilatura | |
| # --- CONFIGURATION --- | |
| CLOUD_URL = "https://paritosh-sovereign-friday-subconscious.hf.space/system/external-ingest" | |
| SOVEREIGN_PIN = "1978" | |
| STRATEGIC_TOPICS = [ | |
| "Regional Demographics and Residential Trends India 2024", | |
| "Strategic Infrastructure development and upcoming projects by Area", | |
| "Autonomous CRM Automation and OttoPilot strategies", | |
| "Deep Learning for Agentic Workflow Orchestration", | |
| "Strategic Finance & Venture Capital Risk Management" | |
| ] | |
| def scrape_url(url): | |
| """Local scraper logic using trafilatura.""" | |
| try: | |
| downloaded = trafilatura.fetch_url(url) | |
| content = trafilatura.extract(downloaded) | |
| return content[:3000] if content else None | |
| except: | |
| return None | |
| def hunt(): | |
| print("π [LOCAL HUNTER] Starting Sovereign Foraging Protocol...") | |
| print(f"π TARGET: {CLOUD_URL}") | |
| print("β" * 50) | |
| for topic in STRATEGIC_TOPICS: | |
| print(f"\nπ Hunting Intelligence: {topic}") | |
| results = [] | |
| try: | |
| with DDGS(timeout=30) as ddgs: | |
| ddg_results = list(ddgs.text(topic, max_results=3)) | |
| for r in ddg_results: | |
| print(f" β³ Capturing Source: {r['href']}") | |
| body = scrape_url(r['href']) | |
| if body: | |
| results.append({ | |
| "title": r['title'], | |
| "url": r['href'], | |
| "body": body | |
| }) | |
| time.sleep(random.uniform(2, 5)) # Human-like jitter | |
| # PUSH TO CLOUD | |
| if results: | |
| payload = { | |
| "topic": topic, | |
| "results": results, | |
| "secret": SOVEREIGN_PIN | |
| } | |
| resp = requests.post(CLOUD_URL, json=payload) | |
| if resp.status_code == 200: | |
| print(f"β SUCCESS: {len(results)} intelligence packages beamed to Cloud.") | |
| else: | |
| print(f"β οΈ CLOUD REJECTION: {resp.status_code} - {resp.text}") | |
| except Exception as e: | |
| print(f"β HUNT ERROR for {topic}: {e}") | |
| time.sleep(random.randint(10, 20)) # Cool down between topics | |
| print("\nβ" * 50) | |
| print("π [LOCAL HUNTER] Mission Complete. Grid Rejuvenated.") | |
| if __name__ == "__main__": | |
| hunt() | |