MCPcopy Create free account
hub / github.com/CScorza/IntelOSINT / analyze_social_reddit

Method analyze_social_reddit

IntelOSINT.py:17482–17513  ·  view source on GitHub ↗
(self, username, base)

Source from the content-addressed store, hash-verified

17480 return None
17481
17482 def analyze_social_reddit(self, username, base):
17483 api_url = f"https://www.reddit.com/user/{urllib.parse.quote(username)}/about.json"
17484 url = f"https://www.reddit.com/user/{urllib.parse.quote(username)}"
17485 info = {"Profile": url, "Status": " Analisi Reddit"}
17486 try:
17487 r = requests.get(api_url, headers={"User-Agent":"Mozilla/5.0", "Accept":"application/json"}, timeout=10)
17488 if r.status_code == 404:
17489 info["Status"] = " Non Trovato"
17490 return [self._social_result("Reddit", username, info, base["icon"], 404, url, False)]
17491 if r.status_code in (403, 429):
17492 return [self._social_result("Reddit", username, {"Status": "Blocco temporaneo (Reddit)", "Profile": url, "Nota": f"HTTP {r.status_code}"}, base["icon"], 200, url, False)]
17493 if r.status_code != 200:
17494 return None
17495 j = self._safe_response_json(r)
17496 d = (j or {}).get("data", {})
17497 if not d:
17498 info["Status"] = " Non Trovato"
17499 return [self._social_result("Reddit", username, info, base["icon"], 404, url, False)]
17500
17501 info["Status"] = " Online (Reddit API)"
17502 info["Nome"] = d.get("name") or username
17503 info["Karma Totale"] = str(d.get("total_karma", 0))
17504 info["Post Karma"] = str(d.get("link_karma", 0))
17505 info["Comment Karma"] = str(d.get("comment_karma", 0))
17506 info["ID Reddit"] = str(d.get("id") or "N/D")
17507 info["Is Gold"] = "Sì" if d.get("is_gold") else "No"
17508 info["Gold Expire"] = str(d.get("gold_expiration") or "N/D")
17509 info["Account Creato"] = self._crypto_ts_to_utc(d.get("created_utc")) if d.get("created_utc") else "N/D"
17510 if d.get("icon_img"): info["Avatar"] = d.get("icon_img")
17511 return [self._social_result("Reddit", username, info, d.get("icon_img") or base["icon"], 200, url, True)]
17512 except Exception:
17513 return None
17514
17515 def analyze_social_tiktok(self, username, base):
17516 raw_user = (username or "").strip()

Callers

nothing calls this directly

Calls 3

_social_resultMethod · 0.95
_safe_response_jsonMethod · 0.95
_crypto_ts_to_utcMethod · 0.95

Tested by

no test coverage detected