-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmaker_portfolio.py
More file actions
61 lines (44 loc) · 1.97 KB
/
Copy pathmaker_portfolio.py
File metadata and controls
61 lines (44 loc) · 1.97 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
60
61
"""
Maker portfolio: all products by a specific ProductHunt maker.
Useful for:
- Researching a founder's track record
- Finding serial makers in your niche
- Due diligence on potential partners
Requires ProductHunt API credentials.
export APIFY_API_TOKEN=apify_api_xxxxxx
export PH_CLIENT_ID=your_ph_client_id
export PH_CLIENT_SECRET=your_ph_client_secret
python examples/maker_portfolio.py
"""
from producthunt_scraper import ProductHuntScraperClient
MAKER_USERNAME = "rrhoover" # Ryan Hoover, PH founder
def main() -> None:
client = ProductHuntScraperClient()
print(f"Fetching portfolio for @{MAKER_USERNAME}...")
products = client.maker_products(MAKER_USERNAME, limit=100)
products = [p for p in products if p.get("success")]
if not products:
print("No products found.")
return
# Sort by upvotes
products.sort(key=lambda p: p.get("upvotes") or 0, reverse=True)
# Maker info from first product
maker_info = products[0].get("makerProfile") or {}
print(f"\n=== @{MAKER_USERNAME} — {maker_info.get('name', '')} ===")
print(f" Headline: {maker_info.get('headline', '')}")
print(f" Total products: {len(products)}")
total_upvotes = sum(p.get("upvotes") or 0 for p in products)
avg_upvotes = total_upvotes // len(products) if products else 0
viral = sum(1 for p in products if p.get("maturityTier") == "viral")
featured = sum(1 for p in products if p.get("isFeatured"))
print(f" Total upvotes: {total_upvotes:,}")
print(f" Avg upvotes: {avg_upvotes:,}")
print(f" Viral products: {viral}")
print(f" Featured: {featured}")
print(f"\n Top 10 products:")
for i, p in enumerate(products[:10], 1):
badges = " 🏆" if p.get("badges") else ""
print(f" {i:>2}. {p.get('productName', '?'):<35} "
f"{p.get('upvotes') or 0:>6,} upvotes{badges}")
if __name__ == "__main__":
main()