-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbulk_analyze.py
More file actions
59 lines (46 loc) · 1.84 KB
/
Copy pathbulk_analyze.py
File metadata and controls
59 lines (46 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
"""
Analyze many WooCommerce stores in one batch.
Sorts results by estimated monthly revenue and prints a summary table.
export APIFY_API_TOKEN=apify_api_xxxxxx
python examples/bulk_analyze.py
"""
from woocommerce_analyzer import WooCommerceAnalyzerClient
STORES = [
"https://woocommerce.com",
# Replace with your competitors
]
def main() -> None:
client = WooCommerceAnalyzerClient(timeout=1800)
print(f"Analyzing {len(STORES)} WooCommerce stores "
f"(estimated cost: ${client.estimate_cost(len(STORES))})...\n")
results = client.analyze(
STORES,
max_concurrency=5,
# Speed-ups: skip slowest layers if you don't need them
extract_brand_age=True, # Wayback + crt.sh — slowest
extract_traffic=True,
)
print(f"{'Domain':<30} {'Visits/mo':>12} {'Revenue/mo':>14} "
f"{'Quality':>8} {'Risk':>5} {'WP':>5}")
print("-" * 80)
sorted_r = sorted(
results,
key=lambda x: -((x.get("revenue_estimate") or {})
.get("monthly_revenue_usd_est") or 0),
)
for r in sorted_r:
if not r.get("success"):
print(f" ERROR: {r.get('domain', r.get('input_url', '?'))}: "
f"{r.get('error', '?')}")
continue
traffic = r.get("traffic") or {}
revenue = r.get("revenue_estimate") or {}
visits = traffic.get("monthly_visits") or 0
rev = revenue.get("monthly_revenue_usd_est") or 0
quality = r.get("tech_quality_score", 0)
risk = r.get("dropshipper_risk_bucket", "?")[:4]
wp = r.get("wordpress_version", "?")[:5]
print(f"{r.get('domain', '?'):<30} {visits:>12,} "
f"{f'${rev:,.0f}':>14} {quality:>8}/100 {risk:>5} {wp:>5}")
if __name__ == "__main__":
main()