kacapower commited on
Commit
8efccc5
·
verified ·
1 Parent(s): 99083f9

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +97 -0
app.py ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from google_play_scraper import search, app
3
+
4
+ def generate_blogger_html(app_query, custom_link, mod_features):
5
+ try:
6
+ # 1. Agent searches the Play Store for the app
7
+ search_results = search(app_query, lang='en', country='us')
8
+ if not search_results:
9
+ return "Error: Could not find this app on the Play Store."
10
+
11
+ # 2. Extract the exact App ID and fetch full details
12
+ app_id = search_results[0]['appId']
13
+ app_details = app(app_id, lang='en', country='us')
14
+
15
+ # 3. Parse the data
16
+ title = app_details.get('title', app_query)
17
+ icon_url = app_details.get('icon', '')
18
+ rating = round(app_details.get('score', 4.5), 1)
19
+ category = app_details.get('genre', 'Utility')
20
+ # Use the summary (short description) to keep the post clean
21
+ description = app_details.get('summary', 'Premium application with enhanced features.')
22
+
23
+ # 4. Format the custom Mod Features into an HTML list
24
+ features_list = ""
25
+ for feature in mod_features.split(','):
26
+ if feature.strip():
27
+ features_list += f'<li style="margin-bottom: 8px;"><i class="fa-solid fa-check" style="color: var(--neon-green); margin-right: 10px;"></i> {feature.strip()}</li>\n'
28
+
29
+ # 5. Build the Lexical Space HTML Template
30
+ html_template = f"""
31
+ <div style="display: none;">
32
+ <img src="{icon_url}" alt="{title} Icon" />
33
+ </div>
34
+
35
+ <div class="app-post-wrapper" style="background: rgba(15, 23, 42, 0.6); border-radius: 20px; padding: 30px; border: 1px solid rgba(255,255,255,0.05); backdrop-filter: blur(12px); color: #fff; font-family: 'Plus Jakarta Sans', sans-serif; max-width: 800px; margin: 0 auto;">
36
+
37
+ <div style="display: flex; gap: 20px; align-items: center; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 25px; margin-bottom: 25px; flex-wrap: wrap;">
38
+ <img src="{icon_url}" style="width: 110px; height: 110px; border-radius: 24px; box-shadow: 0 10px 20px rgba(0,0,0,0.5); flex-shrink: 0;">
39
+ <div style="flex: 1; min-width: 250px;">
40
+ <h1 style="margin: 0 0 8px 0; font-size: 2.2rem; font-weight: 800; line-height: 1.1;">{title} <span style="font-size: 0.8rem; background: var(--neon-blue); padding: 4px 10px; border-radius: 12px; vertical-align: middle; margin-left: 10px; letter-spacing: 1px;">MOD</span></h1>
41
+ <p style="margin: 0 0 12px 0; color: #94a3b8; font-weight: 600;"><i class="fa-solid fa-layer-group"></i> {category} • Max Store Verified</p>
42
+ <div style="display: flex; gap: 15px; font-size: 0.95rem; color: #cbd5e1; font-weight: 700;">
43
+ <span><i class="fa-solid fa-star" style="color:#f59e0b;"></i> {rating}</span>
44
+ <span><i class="fa-solid fa-shield-halved" style="color: var(--neon-green);"></i> Secure</span>
45
+ <span><i class="fa-brands fa-android"></i> Android 9.0+</span>
46
+ </div>
47
+ </div>
48
+ </div>
49
+
50
+ <div style="text-align: center; margin-bottom: 35px; background: #020617; padding: 25px; border-radius: 16px; border: 1px solid rgba(255,255,255,0.02);">
51
+ <a href="{custom_link}" target="_blank" style="display: inline-block; width: 100%; max-width: 400px; background: var(--neon-blue); color: #fff; text-decoration: none; padding: 16px; border-radius: 50px; font-weight: 800; font-size: 1.15rem; box-shadow: 0 0 25px rgba(59,130,246,0.4); transition: transform 0.3s ease;">
52
+ <i class="fa-solid fa-cloud-arrow-down" style="margin-right: 8px;"></i> Download APK via Secure Link
53
+ </a>
54
+ <p style="font-size: 0.8rem; color: #64748b; margin-top: 15px; margin-bottom: 0;">
55
+ <i class="fa-solid fa-lock"></i> Link encrypted. Client-side scanning enabled.
56
+ </p>
57
+ </div>
58
+
59
+ <h3 style="border-left: 4px solid var(--neon-purple); padding-left: 12px; margin-bottom: 15px; font-size: 1.3rem;">About this Application</h3>
60
+ <p style="color: #cbd5e1; line-height: 1.7; margin-bottom: 30px; font-size: 0.95rem;">{description}</p>
61
+
62
+ <h3 style="border-left: 4px solid var(--neon-green); padding-left: 12px; margin-bottom: 15px; font-size: 1.3rem;">Max Store Modifications</h3>
63
+ <div style="background: rgba(16, 185, 129, 0.05); border: 1px solid rgba(16, 185, 129, 0.2); padding: 20px; border-radius: 12px;">
64
+ <ul style="color: #f1f5f9; line-height: 1.8; list-style-type: none; padding-left: 0; margin: 0; font-weight: 600;">
65
+ {features_list}
66
+ </ul>
67
+ </div>
68
+ </div>
69
+ """
70
+ return html_template
71
+
72
+ except Exception as e:
73
+ return f"Error generating HTML: {str(e)}"
74
+
75
+ # 6. Gradio Interface Setup
76
+ with gr.Blocks(theme=gr.themes.Monochrome()) as agent_ui:
77
+ gr.Markdown("# 🚀 Lexical Space Post Generator Agent")
78
+ gr.Markdown("Type the app name, provide your secure link, and let the scraper generate the perfect Blogger HTML.")
79
+
80
+ with gr.Row():
81
+ with gr.Column():
82
+ app_input = gr.Textbox(label="App Name (e.g., YouTube, TeraBox)", placeholder="Search query for Play Store...")
83
+ link_input = gr.Textbox(label="Your Download Link (Mega, PixelDrain, etc.)", placeholder="https://...")
84
+ features_input = gr.Textbox(label="Mod Features (Comma separated)", placeholder="Premium Unlocked, No Ads, Analytics Removed", value="Premium Unlocked, No Ads, Analytics Removed")
85
+ generate_btn = gr.Button("⚙️ Generate HTML", variant="primary")
86
+
87
+ with gr.Column():
88
+ html_output = gr.Code(label="Generated HTML (Copy & Paste to Blogger)", language="html", interactive=False)
89
+
90
+ generate_btn.click(
91
+ fn=generate_blogger_html,
92
+ inputs=[app_input, link_input, features_input],
93
+ outputs=[html_output]
94
+ )
95
+
96
+ if __name__ == "__main__":
97
+ agent_ui.launch()