-
Notifications
You must be signed in to change notification settings - Fork 5
/
app.py
180 lines (169 loc) · 6.51 KB
/
app.py
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
"""Fetch App Details from Playstore. @LEGEND_USERBOT_SUPPORT 🚶
.app <app_name> to fetch app details.
.appr <app_name> to fetch app details with Xpl0iter request link.
.mods <app_name> to get the premier app from telegram if available.."""
import bs4
import requests
from ULTRA.utils import admin_cmd, edit_or_reply, sudo_cmd
from ULTRA import ALIVE_NAME, CMD_HELP
DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else "Hell User"
@bot.on(admin_cmd(pattern="app (.*)"))
@bot.on(sudo_cmd(pattern="app (.*)", allow_sudo=True))
async def apk(event):
app_name = event.pattern_match.group(1)
event = await edit_or_reply(event, "Searching!")
try:
remove_space = app_name.split(" ")
final_name = "+".join(remove_space)
page = requests.get(
"https://play.google.com/store/search?q=" + final_name + "&c=apps"
)
str(page.status_code)
soup = bs4.BeautifulSoup(page.content, "lxml", from_encoding="utf-8")
results = soup.findAll("div", "ZmHEEd")
app_name = (
results[0].findNext("div", "Vpfmgd").findNext("div", "WsMG1c nnK0zc").text
)
app_dev = results[0].findNext("div", "Vpfmgd").findNext("div", "KoLSrc").text
app_dev_link = (
"https://play.google.com"
+ results[0].findNext("div", "Vpfmgd").findNext("a", "mnKHRc")["href"]
)
app_rating = (
results[0]
.findNext("div", "Vpfmgd")
.findNext("div", "pf5lIe")
.find("div")["aria-label"]
)
app_link = (
"https://play.google.com"
+ results[0]
.findNext("div", "Vpfmgd")
.findNext("div", "vU6FJ p63iDd")
.a["href"]
)
app_icon = (
results[0]
.findNext("div", "Vpfmgd")
.findNext("div", "uzcko")
.img["data-src"]
)
app_details = "<a href='" + app_icon + "'>📲​</a>"
app_details += " <b>" + app_name + "</b>"
app_details += (
"\n\n<code>Developer :</code> <a href='"
+ app_dev_link
+ "'>"
+ app_dev
+ "</a>"
)
app_details += "\n<code>Rating :</code> " + app_rating.replace(
"Rated ", "⭐ "
).replace(" out of ", "/").replace(" stars", "", 1).replace(
" stars", "⭐ "
).replace(
"five", "5"
)
app_details += (
"\n<code>Features :</code> <a href='"
+ app_link
+ "'>View in Play Store</a>"
)
app_details += f"\n\n===> {DEFAULTUSER} <==="
await event.edit(app_details, link_preview=True, parse_mode="HTML")
except IndexError:
await event.edit("No result found in search. Please enter **Valid app name**")
except Exception as err:
await event.edit("Exception Occured:- " + str(err))
@bot.on(admin_cmd(pattern="appr (.*)"))
@bot.on(sudo_cmd(pattern="appr (.*)", allow_sudo=True))
async def apkr(event):
app_name = event.pattern_match.group(1)
event = await edit_or_reply(event, "searching!")
try:
remove_space = app_name.split(" ")
final_name = "+".join(remove_space)
page = requests.get(
"https://play.google.com/store/search?q=" + final_name + "&c=apps"
)
str(page.status_code)
soup = bs4.BeautifulSoup(page.content, "lxml", from_encoding="utf-8")
results = soup.findAll("div", "ZmHEEd")
app_name = (
results[0].findNext("div", "Vpfmgd").findNext("div", "WsMG1c nnK0zc").text
)
app_dev = results[0].findNext("div", "Vpfmgd").findNext("div", "KoLSrc").text
app_dev_link = (
"https://play.google.com"
+ results[0].findNext("div", "Vpfmgd").findNext("a", "mnKHRc")["href"]
)
app_rating = (
results[0]
.findNext("div", "Vpfmgd")
.findNext("div", "pf5lIe")
.find("div")["aria-label"]
)
app_link = (
"https://play.google.com"
+ results[0]
.findNext("div", "Vpfmgd")
.findNext("div", "vU6FJ p63iDd")
.a["href"]
)
app_icon = (
results[0]
.findNext("div", "Vpfmgd")
.findNext("div", "uzcko")
.img["data-src"]
)
app_details = "<a href='" + app_icon + "'>📲​</a>"
app_details += " <b>" + app_name + "</b>"
app_details += (
"\n\n<code>Developer :</code> <a href='"
+ app_dev_link
+ "'>"
+ app_dev
+ "</a>"
)
app_details += "\n<code>Rating :</code> " + app_rating.replace(
"Rated ", "⭐ "
).replace(" out of ", "/").replace(" stars", "", 1).replace(
" stars", "⭐ "
).replace(
"five", "5"
)
app_details += (
"\n<code>Features :</code> <a href='"
+ app_link
+ "'>View in Play Store</a>"
)
app_details += "\n\n<b>Download : </b> <a href='https://t.me/joinchat/JCu-H1NikiYDgNjpjPYd4A'>Request_Here</a>"
app_details += "\n\n===> @Xpl0iter <==="
await event.edit(app_details, link_preview=True, parse_mode="HTML")
except IndexError:
await event.edit("No result found in search. Please enter **Valid app name**")
except Exception as err:
await event.edit("Exception Occured:- " + str(err))
@borg.on(admin_cmd(pattern="mods ?(.*)"))
async def mod(event):
if event.fwd_from:
return
modr = event.pattern_match.group(1)
botusername = "@PremiumAppBot"
if event.reply_to_msg_id:
reply_to_id = await event.get_reply_message()
tap = await bot.inline_query(botusername, modr)
await tap[0].click(event.chat_id)
await event.delete()
CMD_HELP.update(
{
"app": "**Plugin :** `app`\
\n**Syntax : **`.app [app name]`\
\n**Usage: **searches the app in the playstore and provides the link to the app in playstore and fetchs app details \
\n\n**Syntax : **`.mods [app name]`\
\n**Usage: **searches and downloads the modded app\
\n\n**Syntax : **`.appr [app name]`\
\n**Usage: **searches the app in the playstore and provides the link to the app in playstore and fetchs app details with Xpl0iter request link. \
"
}
)