(self, username, base)
| 14486 | return browser, context |
| 14487 | |
| 14488 | def analyze_social_onlyfans(self, username, base): |
| 14489 | return self._analyze_social_onlyfans_v2(username, base) |
| 14490 | |
| 14491 | def _fmt_of_ts(ts): |
| 14492 | if not ts: |
| 14493 | return "N/A" |
| 14494 | try: |
| 14495 | raw = str(ts).replace("Z", "+00:00").replace("z", "+00:00") |
| 14496 | if raw.endswith("+00:00"): |
| 14497 | dt = datetime.fromisoformat(raw) |
| 14498 | else: |
| 14499 | dt = datetime.fromisoformat(raw) |
| 14500 | if dt.tzinfo is None: |
| 14501 | dt = dt.replace(tzinfo=datetime.now().astimezone().tzinfo) |
| 14502 | utc = dt.astimezone(timezone.utc).strftime("%Y-%m-%d %H:%M:%S Z") |
| 14503 | local_dt = dt.astimezone() |
| 14504 | z = local_dt.strftime("%z") |
| 14505 | if z and len(z) == 5: |
| 14506 | z = f"{z[:3]}:{z[3:]}" |
| 14507 | if z: |
| 14508 | local = local_dt.strftime("%Y-%m-%d %H:%M:%S ") + f"(UTC{z})" |
| 14509 | else: |
| 14510 | local = local_dt.strftime("%Y-%m-%d %H:%M:%S (UTC)") |
| 14511 | if local.endswith("(UTC+0000)"): |
| 14512 | local = local.replace("(UTC+0000)", "(UTC)") |
| 14513 | return f"{utc} | {local}" |
| 14514 | except Exception: |
| 14515 | return str(ts) |
| 14516 | |
| 14517 | try: |
| 14518 | with sync_playwright() as p: |
| 14519 | browser, context = self._social_create_context(p, profile="aggressive") |
| 14520 | page = context.new_page() |
| 14521 | page.set_extra_http_headers({"Accept-Language": "en-US,en;q=0.9"}) |
| 14522 | response = page.goto(of_url, wait_until="domcontentloaded", timeout=22000) |
| 14523 | status_code = response.status if response else 500 |
| 14524 | |
| 14525 | if status_code >= 400: |
| 14526 | browser.close() |
| 14527 | return [self._social_result("OnlyFans", username, { |
| 14528 | "Profile": of_url, |
| 14529 | "Status": f"Accesso limitato (Playwright HTTP {status_code})", |
| 14530 | "__bm_technique": "onlyfans_vue_state", |
| 14531 | "__bm_source": "bookmarklet_onlyfans", |
| 14532 | "__bm_technique_confidence": "low" |
| 14533 | }, base_img, status_code, of_url, False)] |
| 14534 | |
| 14535 | try: |
| 14536 | page.wait_for_selector('#app', timeout=10000) |
| 14537 | except Exception: |
| 14538 | pass |
| 14539 | |
| 14540 | payload = page.evaluate(""" |
| 14541 | () => { |
| 14542 | const buildProfile = (d) => { |
| 14543 | if (!d || typeof d !== 'object') return null; |
| 14544 | const pick = (v) => { |
| 14545 | if (v === null || v === undefined) return null; |
nothing calls this directly
no test coverage detected