-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapp.py
66 lines (57 loc) · 2.95 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
import re
import bs4
import requests
from platform import uname
from telethon import events
from bs4 import BeautifulSoup
from telegraph import Telegraph
from telethon.errors.rpcerrorlist import YouBlockedUserError
from userbot import Var
from userbot import CMD_HELP ,ALIVE_NAME
from userbot.utils import admin_cmd, edit_or_reply , sudo_cmd
DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else "cat"
@bot.on(admin_cmd(pattern=r"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")
lnk = 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===> @Dark_cobra_support <==="
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="appx ?(.*)"))
@bot.on(sudo_cmd(pattern="appx ?(.*)", allow_sudo=True))
async def mod(event):
if event.fwd_from:
return
modr = event.pattern_match.group(1)
botusername = "@PremiumAppBot"
if event.reply_to_msg_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": "`.app (app name)\nUse - Get a preview nd link of all apps from playstore.\
\n\n.appx (app name)\nUse - send mod apks file.`"})