-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathapp.py
188 lines (162 loc) · 8.01 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
181
182
183
184
185
186
187
188
from flask import Flask, request
import requests
import json
from twilio.twiml.messaging_response import MessagingResponse
from googletrans import Translator
app = Flask(__name__)
@app.route("/")
def hello():
return "Status Online"
@app.route('/bot', methods=['POST'])
def bot():
incoming_msg = request.values.get('Body', '')
#print(incoming_msg)
resp = MessagingResponse()
msg = resp.message()
responded = False
if 'start' in incoming_msg:
text = f'🤖 _Halo Saya Adalah Recsec Bot, Ada Yang Bisa Saya Bantu?_\n\n*Admin :*\n\n📞 : 085885105039\n📱 : _fb.me/rezzapriatna12_ \n\n🚀 *Fitur* \n\n✅ _Youtube Downloader_ \n✅ _Facebook Downloader_ \n✅ _Instagram Downloader_ \n✅ _Google Search_ \n✅ _Text To Speech_ \n✅ _Stalking Profil Instagram_ \n✅ _Translate_ \n\n\n _Untuk Menampilkan Command Ketik_ *Menu*'
msg.body(text)
responded = True
if 'info-covid' in incoming_msg or 'Info-covid' in incoming_msg:
import requests as r, json
req = r.get('https://coronavirus-19-api.herokuapp.com/countries/indonesia')
reqq = r.get('https://coronavirus-19-api.herokuapp.com/countries/world')
jss = reqq.json()
js = req.json()
text = f'*Info Coronavirus Indonesia*\n\n\n*Positif* : {js["cases"]} \n*Sembuh* : {js["recovered"]} \n*Meninggal* : {js["deaths"]} \n\n\n*Global* \n\n\n*Positif* : {jss["cases"]} \n*Sembuh* : {jss["recovered"]} \n*Meninggal* : {jss["deaths"]}'
msg.body(text)
responded = True
import requests as r
import re
par = incoming_msg[3:]
html = r.get(par)
video_url = re.search('sd_src:"(.+?)"', html.text).group(1)
msg.media(video_url)
responded = True
if '/IG' in incoming_msg:
import requests as r
par = incoming_msg[3:]
a = r.get(par+'?__a=1')
b = a.json()
c = b['graphql']['shortcode_media']
d = (c['video_url'])
msg.media(d)
responded = True
if '/GL' in incoming_msg:
from googlesearch import search
query = incoming_msg[3:]
for i in search(query, tld="com", num=10, stop=10, pause=2):
text = f'==========Results==========\n\n *Reff* : '+i
msg.body(text)
responded = True
if '/TR-en-id' in incoming_msg:
par = incoming_msg[9:]
translator = Translator()
result = translator.translate(par, src='en', dest='id')
msg.body(result.text)
responded = True
if '/TR-id-en' in incoming_msg:
par = incoming_msg[9:]
translator = Translator()
result = translator.translate(par, src='id', dest='en')
msg.body(result.text)
responded = True
if '/TR-id-kor' in incoming_msg:
par = incoming_msg[10:]
translator = Translator()
result = translator.translate(par, src='id', dest='ko')
msg.body(result.text)
responded = True
if '/TR-kor-id' in incoming_msg:
par = incoming_msg[10:]
translator = Translator()
result = translator.translate(par, src='ko', dest='id')
msg.body(result.text)
responded = True
if '/FL' in incoming_msg:
import requests as r
import re
par = incoming_msg[3:]
html = r.get(par)
video_url = re.search('sd_src:"(.+?)"', html.text).group(1)
reqq = r.get('http://tinyurl.com/api-create.php?url='+video_url)
msg.body('*VIDEO BERHASIL DI CONVERT*\n\nLINK : ' +reqq.text+'\n\n_Cara Download Lihat Foto Diatas_')
msg.media('https://user-images.githubusercontent.com/58212770/78709692-47566900-793e-11ea-9b48-69c72f9bec1e.png')
responded = True
if '/TTS' in incoming_msg:
par = incoming_msg[5:]
msg.media('https://api.farzain.com/tts.php?id='+par+'&apikey=JsaChFteVJakyjBa0M5syf64z&')
responded = True
if '/SG' in incoming_msg:
import requests
import json
par = incoming_msg[4:]
p = requests.get('http://api.farzain.com/ig_profile.php?id='+par+'&apikey=JsaChFteVJakyjBa0M5syf64z')
js = p.json()['info']
ms = (js['profile_pict'])
jp = p.json()['count']
text = f'Nama : *{js["full_name"]}* \nUsername : {js["username"]} \nBio : *{js["bio"]}* \nSitus Web : *{js["url_bio"]}* \nPengikut : *{jp["followers"]}* \nMengikuti : *{jp["following"]}* \nTotal Postingan : *{jp["post"]}* '
msg.body(text)
msg.media(ms)
responded = True
if '/YT' in incoming_msg:
import pafy
import requests as r
par = incoming_msg[4:]
audio = pafy.new(par)
gen = audio.getbestaudio(preftype='m4a')
genn = audio.getbestvideo(preftype='mp4')
req = r.get('http://tinyurl.com/api-create.php?url='+gen.url)
popo = r.get('http://tinyurl.com/api-create.php?url='+genn.url)
msg.body('_=========================_\n\n _Video Berhasil Diconvert_\n\n_=========================_\n\n''*'+gen.title+'*''\n\n*Link Download Music* :' +req.text+'\n\n*Link Download Video* :' +popo.text)
responded = True
if '/SY' in incoming_msg:
import requests as r
par = incoming_msg[3:]
req = r.get('http://api.farzain.com/yt_search.php?id='+par+'&apikey=JsaChFteVJakyjBa0M5syf64z&')
js = req.json()[1]
text = f'*Judul* : _{js["title"]}_ \n\n*Url Video* : _{js["url"]}_\n\n*Video ID* : _{js["videoId"]}\n\n_Note : Jika Ingin Download Video Ini Atau Convert Ke Musik, Salin Link Diatas Dan Gunakan Command /YT_'
msg.body(text)
msg.media((js['videoThumbs']))
responded = True
if '/JS' in incoming_msg:
import requests as r
par = incoming_msg[3:]
req = r.get('http://api.farzain.com/shalat.php?id='+par+'&apikey=JsaChFteVJakyjBa0M5syf64z&')
js = req.json()['respon']
text = f'*Waktu Sholat* \n\n*Subuh* : {js["shubuh"]} \n*Dzuhur* : {js["dzuhur"]} \n*Ashar* : {js["ashar"]} \n*Magrib* : {js["maghrib"]} \n*Isya* : {js["isya"]}'
msg.body(text)
responded = True
if 'jadwal-imsak' in incoming_msg:
msg.media('https://user-images.githubusercontent.com/58212770/80048733-35c6b100-853b-11ea-8043-ec0614a40039.jpeg')
responded = True
if 'help' in incoming_msg:
text = f'💻 *Help For Instagram*\n\n/IG <Link Video> Contoh : \n/IG https://www.instagram.com/p/BWhyIhRDBCw/\n\n\n*Note* : Link Harus Seperti Di Contoh Kalo link Akhirannya Ada ?utm_source=ig_web_copy_link hapus bagian itu\n\n 💻 *Help For Facebook*\n\n/FB _link video_ Contoh :\n\n/FB https://www.facebook.com/100010246050928/posts/1143182719366586/?app=fbl \n\n💻 *Help For Google Search* \n\n /GL <Query> Contoh : \n\n/GL rezzaapr \n\n💻 *Help For Instagram Stalking \n\n/SG <username> Contoh : \n\n/SG rzapr \n\n💻 *Help For Translate* \n\nTR-id-en Translate indonesia Ke inggris\n\n/TR-en-id Translate Inggris Ke Indonesia\n\n/TR-id-kor Translate Indonesia Ke Korea \n\n/TR-kor-id Translate Korea Ke Indonesia \n\n💻 *Help For Text To Speech* \n\n/TTS WhatsappBotRezzaapr\n\nJika Ingin Menggunakan Spasi Ganti Dengan %20\n\nContoh : /TTS Whatsapp%20Bot%Rezzaapr'
msg.body(text)
responded = True
if '!' in incoming_msg:
import requests as r
us = incoming_msg[2:]
import requests
import json
url = 'https://wsapi.simsimi.com/190410/talk/'
body = {
'utext': us,
'lang': 'id',
'country': ['ID'],
'atext_bad_prob_max': '0.7'
}
headers = {
'content-type': 'application/json',
'x-api-key': 'LKgWy5I-HoG8K0CmpWl.SNncus1UOpwBiA1XAZzA'
}
r = requests.post(url, data=json.dumps(body), headers=headers)
js = r.json()
msg.body(js['atext'])
responded = True
if responded == False:
msg.body('Maaf Saya Hanya Bot Tidak Mengenal Perintah Itu :), Silahkan Kirim start Untuk Menunju Ke Menu')
return str(resp)
if __name__ == "__main__":
app.run(host="localhost", port=8080, debug=True)