1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "html": """<!DOCTYPE html>
10<html lang=\"en\">
11<head>
12 <meta charset=\"UTF-8\">
13 <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">
14 <script src=\"https://cdn.tailwindcss.com\"></script>
15</head>
16<body class=\"bg-gray-100 text-gray-900 flex items-center justify-center h-screen\">
17
18 <!-- OG Image Container -->
19 <div class=\"relative bg-white w-[1200px] h-[630px] rounded-lg shadow-xl border border-gray-200 overflow-hidden\">
20
21 <!-- Background Accent -->
22 <div class=\"absolute inset-0 bg-gradient-to-r from-indigo-100 via-pink-100 to-yellow-100 opacity-50\"></div>
23
24 <!-- Logo -->
25 <div class=\"absolute bottom-6 left-6\">
26 <img src=\"{{logoUrl}}\" alt=\"Blog Logo\" class=\"h-10\">
27 </div>
28
29 <!-- Content Wrapper -->
30 <div class=\"relative flex flex-col h-full p-16\">
31
32 <!-- Blog Category -->
33 <div class=\"text-base uppercase tracking-wider text-indigo-500 font-semibold mb-6\">{{category}}</div>
34
35 <!-- Blog Title -->
36 <h1 class=\"text-6xl font-bold leading-tight text-gray-800 mb-8\">{{title}}</h1>
37
38 <!-- Author and Date -->
39 <div class=\"flex items-center space-x-6 text-gray-600 text-xl\">
40 <div class=\"flex items-center space-x-3\">
41 <img class=\"w-12 h-12 rounded-full\" src=\"{{authorImage}}\" alt=\"{{author}}\">
42 <span>{{author}}</span>
43 </div>
44 <span>•</span>
45 <span>{{date}}</span>
46 </div>
47 </div>
48 </div>
49
50</body>
51</html>
52""",
53 "templateData": {
54 "category": "Technology",
55 "title": "How to create dynamic OG title for your web",
56 "logoUrl": "https://w7.pngwing.com/pngs/243/698/png-transparent-apify-logo-tech-companies.png",
57 "date": "January 3, 2025",
58 "author": "Daniil Poletaev",
59 "authorImage": "https://images.apifyusercontent.com/rO00zibE4A243KKKW3pwsdT-IXjgOFWuA2s4RJV_7VM/rs:fill:70:70/aHR0cHM6Ly9saDMuZ29vZ2xldXNlcmNvbnRlbnQuY29tL2EvQUNnOG9jSWRPZ1QxMHAxblVSbGhKZUswSlZUdXpLZzJmVWN6MkEtNGZka1hwVWRSX1NtOVFSZw",
60 },
61}
62
63
64run = client.actor("daniil.poletaev/og-image-generator").call(run_input=run_input)
65
66
67print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
68for item in client.dataset(run["defaultDatasetId"]).iterate_items():
69 print(item)
70
71