import gradio as gr import json DATA = { "newComics": [ {"title": "Winter Breeze", "type": "manhwa", "chapter": "Chapter 34"}, {"title": "Strong Girl Geumjoo", "type": "manhwa", "chapter": "Chapter 39"}, {"title": "The Now (2021)", "type": "manhwa", "chapter": "Chapter 77"}, {"title": "From Disgraced Lady to Beloved Stepmother", "type": "manhwa", "chapter": "Chapter 9"}, {"title": "You're the Only One I Can See", "type": "manhwa", "chapter": "Chapter 1"}, {"title": "Immortal Simulator: Cultivating in Secret", "type": "manhua", "chapter": "Chapter 3"}, ], "updates": [ {"title": "Greetings, Sect Leader", "type": "manhua", "chapter": "Chapter 13", "time": "16 Menit lalu"}, {"title": "Killer Lawyer", "type": "manhwa", "chapter": "Chapter 25", "time": "47 Menit lalu"}, {"title": "The End Has Come", "type": "manhwa", "chapter": "Chapter 54", "time": "47 Menit lalu"}, {"title": "Super God of War", "type": "manhua", "chapter": "Chapter 7", "time": "1 Jam lalu"}, {"title": "Shijou Saikyou no Mahou Kenshi, F Rank Boukensha ni Tensei Suru", "type": "manga", "chapter": "Chapter 131", "time": "1 Jam lalu"}, {"title": "7-Nin no Nemuri Hime", "type": "manga", "chapter": "Chapter 48", "time": "1 Jam lalu"}, {"title": "Even the Absolute Being Is a First-Time Dad", "type": "manhwa", "chapter": "Chapter 45", "time": "1 Jam lalu"}, {"title": "My Gift LVL 9999 Unlimited Gacha", "type": "manga", "chapter": "Chapter 196", "time": "1 Jam lalu"}, {"title": "The World's Best Kunlun Tavern", "type": "manhwa", "chapter": "Chapter 111", "time": "2 Jam lalu"}, {"title": "The Eunuchs Second Life", "type": "manhwa", "chapter": "Chapter 35", "time": "2 Jam lalu"}, {"title": "The Peaceful Life of a Maid", "type": "manhwa", "chapter": "Chapter 20", "time": "2 Jam lalu"}, {"title": "Shamoneyism", "type": "manhwa", "chapter": "Chapter 40", "time": "2 Jam lalu"}, {"title": "The Villain Of Destiny", "type": "manhua", "chapter": "Chapter 323", "time": "2 Jam lalu"}, {"title": "Overlord Of Sichuan", "type": "manhwa", "chapter": "Chapter 21", "time": "2 Jam lalu"}, {"title": "The Rebel Of The Tyrant Noble Family", "type": "manhwa", "chapter": "Chapter 16", "time": "2 Jam lalu"}, {"title": "The Regressed Mercenary's Machinations", "type": "manhwa", "chapter": "Chapter 84", "time": "2 Jam lalu"}, {"title": "The Youngest Son Of A Rich Family", "type": "manhwa", "chapter": "Chapter 197", "time": "2 Jam lalu"}, {"title": "Magical Realm Shopkeeper", "type": "manhwa", "chapter": "Chapter 95", "time": "2 Jam lalu"}, {"title": "Riches Can't Buy Loyalty", "type": "manhua", "chapter": "Chapter 80", "time": "3 Jam lalu"}, {"title": "Global Beast Tamer", "type": "manhua", "chapter": "Chapter 61", "time": "3 Jam lalu"}, {"title": "Martial Evolution", "type": "manhwa", "chapter": "Chapter 106", "time": "3 Jam lalu"}, {"title": "Tanaka Ke, Tensei Suru", "type": "manga", "chapter": "Chapter 54", "time": "3 Jam lalu"}, {"title": "The Merciless Fairy Shall Become a Cultivation Vessel", "type": "manhua", "chapter": "Chapter 6", "time": "3 Jam lalu"}, {"title": "DANDADAN (2021)", "type": "manga", "chapter": "Chapter 231", "time": "3 Jam lalu"}, {"title": "Rebirth of the Emperor in the Reverse World", "type": "manhua", "chapter": "Chapter 42", "time": "4 Jam lalu"}, {"title": "Tang Clan Legend", "type": "manhwa", "chapter": "Chapter 43", "time": "5 Jam lalu"}, {"title": "Reincarnated Escort Warrior", "type": "manhwa", "chapter": "Chapter 147", "time": "10 Jam lalu"}, {"title": "The Emperor's Sword", "type": "manhwa", "chapter": "Chapter 112", "time": "10 Jam lalu"}, {"title": "World-Saving Is A Skill", "type": "manhwa", "chapter": "Chapter 21", "time": "10 Jam lalu"}, {"title": "High-Martial World", "type": "manhua", "chapter": "Chapter 21", "time": "11 Jam lalu"}, ], "genres": ["action","adventure","comedy","drama","fantasy","horror","isekai","martial_arts","mystery","romance","school_life","scifi","slice_of_life","supernatural","thriller","webtoons"] } CSS = """ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap'); :root{--bg:#0b0e14;--bg-card:#151a25;--bg-card-hover:#1c2333;--border:#252d3d;--primary:#8b5cf6;--text:#e4e8f1;--text-muted:#959fb5;--text-dim:#5a6478} *{margin:0;padding:0;box-sizing:border-box} body{font-family:'Inter',sans-serif;background:var(--bg);color:var(--text);line-height:1.5} .container{max-width:1200px;margin:0 auto;padding:0 16px} .header{position:sticky;top:0;z-index:100;background:rgba(11,14,20,.95);backdrop-filter:blur(12px);border-bottom:1px solid var(--border)} .hi{display:flex;align-items:center;gap:20px;height:60px} .logo{font-weight:800;font-size:1.5rem;color:#fff;text-decoration:none}.logo span{color:var(--primary)} .sb{flex:1;display:flex;max-width:400px}.sb input{flex:1;padding:8px 12px;border:1px solid var(--border);border-radius:8px 0 0 8px;background:var(--bg-card);color:var(--text);font-size:.9rem;outline:none}.sb button{padding:8px 12px;background:var(--primary);border:none;border-radius:0 8px 8px 0;color:#fff;cursor:pointer} nav{display:flex;gap:4px;margin-left:auto}nav a{color:var(--text-muted);text-decoration:none;font-size:.85rem;padding:6px 12px;border-radius:8px}nav a:hover{color:#fff;background:rgba(139,92,246,.15)} .hero{background:linear-gradient(135deg,#7c3aed,#2563eb);padding:48px 0 36px;text-align:center}.hero h1{font-size:1.8rem;font-weight:800;margin-bottom:6px}.hero p{color:rgba(255,255,255,.8)} .section{padding:40px 0}.sa{background:var(--bg-card);border-top:1px solid var(--border);border-bottom:1px solid var(--border)} .st{font-size:1.2rem;font-weight:700;margin-bottom:16px}.st i{color:var(--primary);margin-right:6px} .cg{display:grid;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:14px} .c{background:var(--bg-card);border-radius:12px;overflow:hidden;transition:transform .2s;cursor:pointer;display:block}.c:hover{transform:translateY(-4px)} .ci{width:100%;aspect-ratio:3/4;background:linear-gradient(135deg,#1e293b,#334155);display:flex;align-items:center;justify-content:center;font-size:2rem;color:var(--text-dim);position:relative} .badge{position:absolute;top:6px;left:6px;padding:2px 8px;border-radius:20px;font-size:.65rem;font-weight:600;text-transform:uppercase;color:#fff}.bmanga{background:#3b82f6}.bmanhua{background:#ef4444}.bmanhwa{background:#10b981} .cb{padding:8px 10px}.cb h3{font-size:.8rem;font-weight:600;margin-bottom:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.cb p{font-size:.7rem;color:var(--text-muted)} .ul{display:flex;flex-direction:column;gap:2px} .ui{display:flex;align-items:center;gap:12px;padding:8px 12px;background:var(--bg-card);border-radius:8px;text-decoration:none;color:inherit;transition:background .15s}.ui:hover{background:var(--bg-card-hover)} .ui .t{min-width:65px;text-align:center;padding:2px 8px;border-radius:4px;font-size:.65rem;font-weight:700;text-transform:uppercase;color:#fff}.ui .ti{flex:1;font-weight:600;font-size:.85rem}.ui .ch{color:var(--text-muted);font-size:.8rem;white-space:nowrap}.ui .tm{color:var(--text-dim);font-size:.7rem;white-space:nowrap} .gn{display:flex;flex-wrap:wrap;gap:6px} .gt{padding:4px 14px;background:var(--bg-card);border:1px solid var(--border);border-radius:999px;font-size:.75rem;color:var(--text-muted);text-transform:capitalize;cursor:pointer}.gt:hover{border-color:var(--primary);color:#fff} .footer{text-align:center;padding:24px 0;color:var(--text-dim);font-size:.75rem;border-top:1px solid var(--border)} @media(max-width:768px){.sb{max-width:100%}.cg{grid-template-columns:repeat(auto-fill,minmax(120px,1fr))}.hero h1{font-size:1.3rem}.hero{padding:32px 0 24px}nav{display:none}} """ HTML = """

Baca Komik, Manga, Manhua & Manhwa Gratis

Ribuan judul terupdate setiap hari.

⏰ Komik Baru

⚡ Update Terbaru

🏷️ Genre

""" JS = """ document.addEventListener('DOMContentLoaded', () => { const DATA = __DATA__; const nc = document.getElementById('nc'); if(nc) DATA.newComics.forEach(c => { const b = c.type === 'manga' ? 'bmanga' : c.type === 'manhua' ? 'bmanhua' : 'bmanhwa'; nc.innerHTML += '
'+c.type+''+c.title.charAt(0)+'

'+c.title+'

'+c.chapter+'

'; }); const ul = document.getElementById('ul'); if(ul) DATA.updates.forEach(u => { const b = u.type === 'manga' ? 'bmanga' : u.type === 'manhua' ? 'bmanhua' : 'bmanhwa'; ul.innerHTML += ''+u.type+''+u.title+''+u.chapter+''+u.time+''; }); const gn = document.getElementById('gn'); if(gn) DATA.genres.forEach(g => { gn.innerHTML += ''+g.replace(/_/g,' ')+''; }); const si = document.getElementById('si'); if(si) si.addEventListener('input', e => { const q = e.target.value.toLowerCase(); document.querySelectorAll('#nc .c').forEach(x => { const t = x.querySelector('h3')?.textContent.toLowerCase()||''; x.style.display = t.includes(q) ? '' : 'none'; }); }); }); """ data_json = json.dumps(DATA) js_with_data = JS.replace('"__DATA__"', data_json) HEAD = """ KomikHub """ FULL = f"{HEAD}{HTML}" with gr.Blocks(title="KomikHub") as app: gr.HTML(FULL) app.launch(share=False)