-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.py
260 lines (245 loc) · 6.55 KB
/
run.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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
from flask import *
from bs4 import BeautifulSoup as bs
import requests, os, re, json, random
app = Flask(__name__)
# Var Status
sukses = "success"
gagal = "failed"
error = "error"
# FREE PROXY
@app.route("/api/freeproxy")
def freeproxy():
config = {}
config2 = {}
r = requests.get("https://api.getproxylist.com/proxy").text
j = json.loads(r)
ip = j["ip"]
port = j["port"]
pro = j["protocol"]
speed = j["downloadSpeed"]
# Menampung Data Json 2
config2["ip"] = ip
config2["port"] = port
config2["protocol"] = pro
config2["speedDownload"] = speed
# Menampung Data Json 1
config["status"] = sukses
config["result"] = json.loads("".join(json.dumps(config2)))
return "".join(json.dumps(config))
# YOUTUBE MP3 DOWNLOADER
@app.route("/api/ytmp3")
def ytmp3():
config = {}
config2 = {}
url = request.args.get("url")
if not url:
config["status"] = error
config["pesan"] = "Parameter URL tidak di temukan"
else:
if "watch?v=" in url:
id = re.findall('v=(.*)$',url)
elif "youtube.com" in url:
id = re.findall('.com/(.*)$',url)
elif "youtu.be" in url:
id = re.findall(".be/(.*)$",url)
else:
config["status"] = error
config["pesan"] = "Sepertinya URL tidak mensupport"
return "".join(json.dumps(config))
get = requests.get('https://www.download-mp3-youtube.com/api/?api_key=NDI2ODYyNzU4&format=mp3&logo=1&video_id='+id[0])
b = bs(get.text, "html.parser")
f = b.find('a',{'id':'downloadButton'})['href']
# Menampung data json 2
config2["url"] = url
config2["mp3"] = f
# Menampung data json 1
config["status"] = sukses
config["result"] = json.loads("".join(json.dumps(config2)))
return "".join(json.dumps(config))
# FACEBOOK VIDEO DOWNLOADER
@app.route("/api/fbvid")
def fbvid():
config = {}
config2 = {}
url = request.args.get("url")
if not url:
config["status"] = error
config["pesan"] = "Parameter URL tidak ditemukan"
else:
try:
r = requests.get(url)
f = re.search(r'\"(http[s]\:\/\/video.*?\.mp4\?.*?)\"',r.text)
if f:
urlvid = f.group(1).replace(";","&")
config2["url"] = url
config2["urlvid"] = urlvid
config["status"] = sukses
config["result"] = json.loads("".join(json.dumps(config2)))
else:
config["status"] = gagal
config["pesan"] = "Sepertinya Video tidak ditemukan"
except requests.exceptions.MissingSchema:
config["status"] = error
config["pesan"] = "Silahkan Masukna URL dengan benar"
return "".join(json.dumps(config))
# IP TRACK
@app.route("/api/track")
def track():
config = {}
config2 = {}
config3 = {}
target = request.args.get("target")
try:
ip = socket.gethostbyname(target)
except:
ip = target
key = ["2388107e74e7fe5424554967771b568b","7a1afbf9b63efdf5bdb30a08a736673c229b3ea738e667e0d259c135"]
urls = ["http://api.ipstack.com/","http://ip-api.com/json/","http://free.ipwhois.io/json/","https://api.ipdata.co/"]
r = requests.get(urls[0]+ip+"?access_key="+key[0]).text
j = json.loads(r)
# INFO IP
try:
type = j["type"]
except:
type = None
try:
negara = j["country"]
except:
negara = None
try:
code = j["country_code"]
except:
code = None
try:
benua = j["continent_name"]
except:
benua = None
try:
telp = j["location"]["calling_code"]
except:
telp = None
r2 = requests.get(urls[1]+ip+"?fields=mobile").text
j2 = json.loads(r2)
try:
mobile = j2["mobile"]
except:
mobile = None
# INFO TELP
# zona = j3["timezone"]
# gmt = j3["timezone_gmt"]
config2["type"] = type
config2["country"] = negara
config2["code"] = code
config2["continent_name"] = benua
config2["calling_code"] = telp
# Tampilkan
js = json.loads(json.dumps(config2))
config["status"] = sukses
config["result"] = js
return "".join(json.dumps(config))
# INSTAGRAM VIDEO DOWNLOADER
@app.route("/api/igdown")
def igdown():
config = {}
config2 = {}
url = request.args.get("url")
if not url:
config["status"] = error
config["pesan"] = "Parameter URL tidak ditemukan"
else:
try:
r = requests.get(url)
# if r.status_code == 200:
b = bs(r.text, "html.parser")
for f in b.findAll("meta"):
if f.get("property") == "og:video:secure_url":
config2["url"] = url
config2["urlvid"] = f.get("content")
config["status"] = sukses
config["result"] = config2
config["pesan"] = "Video Di Temukan"
del config["pesan"]
break
else:
config["status"] = gagal
config["pesan"] = "Sepertinya video tidak ditemukan"
except requests.exceptions.MissingSchema:
config["status"] = error
config["pesan"] = "Silahkan Masukan URL dengan benar"
j = json.dumps(config)
return j
# User Agent Fake
@app.route("/api/ua")
def ua():
config = {}
config2 = {}
data = []
basic = "https://developers.whatismybrowser.com/useragents/explore/software_name/"
browser = request.args.get("browser")
if browser:
if browser == "chrome":
url = basic+"chrome"
elif browser == "andro":
url = basic+"android-browser/"
elif browser == "edge":
url = basic+"edge/"
elif browser == "fbapp":
url = basic+"facebook-app/"
# Update V1.9
elif browser == "firefox":
url = basic+"firefox"
elif browser == "ig":
url = basic+"instagram"
elif browser == "opera":
url = basic+"opera"
elif browser == "opera-mini":
url = basic+"opera-mini"
elif browser == "safari":
url = basic+"safari"
elif browser == "uc":
url = basic+"uc-browser"
elif browser == "webkit":
url = basic+"webkit-based-browser"
elif browser == "yandex":
url = basic+"yandex-browser"
else:
config["status"] = error
config["pesan"] = "Browser '%s' tidak ditemukan"%(browser)
return "".join(json.dumps(config))
r = requests.get(url)
b = bs(r.text, "html.parser")
for f in b.findAll("td",{"class":"useragent"}):
data.append(f.text)
config2["ua"] = random.choice(data)
config["status"] = sukses
config["result"] = json.loads(json.dumps(config2))
else:
config["status"] = error
config["pesan"] = "Parameter Browser tidak ditemukan"
return "".join(json.dumps(config))
# JIKA PAGE ERROR MAKA:
@app.errorhandler(404)
def not_found(e):
return render_template("error.html")
# JIKA KLIK TOOLS MAKA:
@app.route("/tools")
def tools():
return render_template("tools.html")
# JIKA DI URL TERDAPAT /api TANPA URL /api/name MAKA:
@app.route("/api")
def api():
return render_template("tools.html")
# JIKA KLIK ABOUT MAKA:
@app.route("/about")
def about():
return render_template("about.html")
# JIKA KLIK TUTORIAL MAKA:
@app.route("/tutorial")
def tutorial():
return render_template("tutor.html")
# INDEX AWAL
@app.route("/")
def index():
return render_template("index.html")
if __name__ == '__main__':
app.run(host="0.0.0.0",port=os.environ.get("PORT"),debug=True)