Spaces:
Runtime error
Runtime error
Upload 3 files
Browse files- Dockerfile +12 -0
- app.py +835 -0
- requirements.txt +6 -0
Dockerfile
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.10-slim
|
| 2 |
+
|
| 3 |
+
WORKDIR /app
|
| 4 |
+
|
| 5 |
+
COPY requirements.txt .
|
| 6 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 7 |
+
|
| 8 |
+
COPY app.py .
|
| 9 |
+
|
| 10 |
+
EXPOSE 7860
|
| 11 |
+
|
| 12 |
+
CMD ["python", "app.py"]
|
app.py
ADDED
|
@@ -0,0 +1,835 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
π₯ SUPER MULTI-API - 20+ Features in One
|
| 4 |
+
Developer: WASIF ALI
|
| 5 |
+
Telegram: @THE_FREE_HACKS
|
| 6 |
+
"""
|
| 7 |
+
|
| 8 |
+
from flask import Flask, request, jsonify, Response
|
| 9 |
+
import requests
|
| 10 |
+
import json
|
| 11 |
+
import time
|
| 12 |
+
import re
|
| 13 |
+
import cloudscraper
|
| 14 |
+
from datetime import datetime
|
| 15 |
+
from fake_useragent import UserAgent
|
| 16 |
+
from urllib.parse import urlparse, quote_plus
|
| 17 |
+
from concurrent.futures import ThreadPoolExecutor
|
| 18 |
+
from bs4 import BeautifulSoup
|
| 19 |
+
import base64
|
| 20 |
+
|
| 21 |
+
app = Flask(__name__)
|
| 22 |
+
ua = UserAgent()
|
| 23 |
+
scraper = cloudscraper.create_scraper()
|
| 24 |
+
executor = ThreadPoolExecutor(max_workers=5)
|
| 25 |
+
|
| 26 |
+
# ============================================================
|
| 27 |
+
# DEVELOPER INFO
|
| 28 |
+
# ============================================================
|
| 29 |
+
DEVELOPER = "WASIF ALI"
|
| 30 |
+
TELEGRAM = "@THE_FREE_HACKS"
|
| 31 |
+
|
| 32 |
+
def api_response(success, platform, data=None, message=None, error=None, extra=None):
|
| 33 |
+
"""Standardized API response for all endpoints"""
|
| 34 |
+
response = {
|
| 35 |
+
"success": success,
|
| 36 |
+
"platform": platform,
|
| 37 |
+
"timestamp": datetime.now().isoformat(),
|
| 38 |
+
"developer": DEVELOPER,
|
| 39 |
+
"telegram": TELEGRAM
|
| 40 |
+
}
|
| 41 |
+
if data is not None:
|
| 42 |
+
response["data"] = data
|
| 43 |
+
if message:
|
| 44 |
+
response["message"] = message
|
| 45 |
+
if error:
|
| 46 |
+
response["error"] = error
|
| 47 |
+
if extra:
|
| 48 |
+
response.update(extra)
|
| 49 |
+
return jsonify(response)
|
| 50 |
+
|
| 51 |
+
# ============================================================
|
| 52 |
+
# 1. 3D LOGO GENERATOR
|
| 53 |
+
# ============================================================
|
| 54 |
+
@app.route("/api/v1/3d-logo")
|
| 55 |
+
def generate_3d_logo():
|
| 56 |
+
prompt = request.args.get("prompt")
|
| 57 |
+
platform = "3d-logo-generator"
|
| 58 |
+
|
| 59 |
+
if not prompt:
|
| 60 |
+
return api_response(False, platform, error="Prompt is required")
|
| 61 |
+
|
| 62 |
+
try:
|
| 63 |
+
api_url = "https://viscodev.x10.mx/3D_CARTOON/api.php"
|
| 64 |
+
res = requests.post(api_url, json={"prompt": prompt}, timeout=30)
|
| 65 |
+
|
| 66 |
+
if res.status_code != 200:
|
| 67 |
+
return api_response(False, platform, error="External API failed")
|
| 68 |
+
|
| 69 |
+
data = res.json()
|
| 70 |
+
|
| 71 |
+
if not data.get("success"):
|
| 72 |
+
return api_response(False, platform, error=data.get("message", "Generation failed"))
|
| 73 |
+
|
| 74 |
+
images = data.get("images_with_background") or data.get("images") or data.get("with_background") or []
|
| 75 |
+
|
| 76 |
+
return api_response(True, platform, data={
|
| 77 |
+
"prompt": prompt,
|
| 78 |
+
"images": images,
|
| 79 |
+
"count": len(images)
|
| 80 |
+
})
|
| 81 |
+
except Exception as e:
|
| 82 |
+
return api_response(False, platform, error=str(e))
|
| 83 |
+
|
| 84 |
+
# ============================================================
|
| 85 |
+
# 2. AI VIDEO GENERATOR (Text2Video)
|
| 86 |
+
# ============================================================
|
| 87 |
+
TEXT2VIDEO_HEADERS = {
|
| 88 |
+
'User-Agent': "okhttp/5.1.0",
|
| 89 |
+
'Accept-Encoding': "gzip",
|
| 90 |
+
'authorization': "eyJzdWIiOiIyMzQyZmczNHJ0MzR0MzQiLCJuYW1lIjoiSm9obiIsImV4cCI6MTczNTY4OTYwMH0=",
|
| 91 |
+
'sign': "68d6165b72a7f2d8d17b0dc6fe9691abdf77c583",
|
| 92 |
+
'pt': "",
|
| 93 |
+
'v': "72",
|
| 94 |
+
'deviceid': "1b5336ed0297604a"
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
@app.route("/api/v1/ai-video")
|
| 98 |
+
def generate_ai_video():
|
| 99 |
+
prompt = request.args.get("prompt")
|
| 100 |
+
platform = "ai-video-generator"
|
| 101 |
+
|
| 102 |
+
if not prompt:
|
| 103 |
+
return api_response(False, platform, error="Prompt is required")
|
| 104 |
+
|
| 105 |
+
# NSFW Check
|
| 106 |
+
try:
|
| 107 |
+
nsfw_res = requests.post(
|
| 108 |
+
"https://text2video.aritek.app/nsfw",
|
| 109 |
+
data={'prompt': prompt, 'ctry_target': 'others', 'versionCode': '72',
|
| 110 |
+
'deviceID': '1b5336ed0297604a', 'isPremium': '0'},
|
| 111 |
+
headers=TEXT2VIDEO_HEADERS,
|
| 112 |
+
timeout=15
|
| 113 |
+
)
|
| 114 |
+
nsfw_data = nsfw_res.json()
|
| 115 |
+
|
| 116 |
+
if nsfw_data.get('code') != 0 or not nsfw_data.get('success'):
|
| 117 |
+
return api_response(False, platform, error="NSFW check failed")
|
| 118 |
+
|
| 119 |
+
if nsfw_data.get('data', [{}])[0].get('nsfw'):
|
| 120 |
+
return api_response(False, platform, error="Prompt flagged as NSFW")
|
| 121 |
+
except Exception as e:
|
| 122 |
+
return api_response(False, platform, error=f"NSFW error: {str(e)}")
|
| 123 |
+
|
| 124 |
+
# Generate Video Key
|
| 125 |
+
try:
|
| 126 |
+
headers_json = TEXT2VIDEO_HEADERS.copy()
|
| 127 |
+
headers_json['content-type'] = "application/json; charset=utf-8"
|
| 128 |
+
|
| 129 |
+
payload = {
|
| 130 |
+
"ai_sound": 1,
|
| 131 |
+
"aspect_ratio": "auto",
|
| 132 |
+
"ctry_target": "others",
|
| 133 |
+
"deviceID": "1b5336ed0297604a",
|
| 134 |
+
"isPremium": 0,
|
| 135 |
+
"prompt": prompt,
|
| 136 |
+
"used": [],
|
| 137 |
+
"versionCode": 72
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
res = requests.post(
|
| 141 |
+
"https://text2video.aritek.app/txt2videov3",
|
| 142 |
+
data=json.dumps(payload),
|
| 143 |
+
headers=headers_json,
|
| 144 |
+
timeout=15
|
| 145 |
+
)
|
| 146 |
+
data = res.json()
|
| 147 |
+
|
| 148 |
+
if data.get('code') != 0:
|
| 149 |
+
return api_response(False, platform, error="Video generation failed")
|
| 150 |
+
|
| 151 |
+
video_key = data.get("key")
|
| 152 |
+
if not video_key:
|
| 153 |
+
return api_response(False, platform, error="No video key received")
|
| 154 |
+
except Exception as e:
|
| 155 |
+
return api_response(False, platform, error=f"Key generation error: {str(e)}")
|
| 156 |
+
|
| 157 |
+
# Fetch Video URL
|
| 158 |
+
for attempt in range(10):
|
| 159 |
+
try:
|
| 160 |
+
video_res = requests.post(
|
| 161 |
+
"https://text2video.aritek.app/video",
|
| 162 |
+
data=json.dumps({"keys": [video_key]}),
|
| 163 |
+
headers=headers_json,
|
| 164 |
+
timeout=15
|
| 165 |
+
)
|
| 166 |
+
video_data = video_res.json()
|
| 167 |
+
|
| 168 |
+
if video_data.get("code") == 0 and video_data.get("datas"):
|
| 169 |
+
video_info = video_data["datas"][0]
|
| 170 |
+
video_url = video_info.get("url")
|
| 171 |
+
|
| 172 |
+
if video_url:
|
| 173 |
+
return api_response(True, platform, data={
|
| 174 |
+
"prompt": prompt,
|
| 175 |
+
"video_url": video_url,
|
| 176 |
+
"filename": urlparse(video_url).path.split("/")[-1],
|
| 177 |
+
"safe": video_info.get("safe", "unknown"),
|
| 178 |
+
"attempts": attempt + 1
|
| 179 |
+
})
|
| 180 |
+
time.sleep(3)
|
| 181 |
+
except:
|
| 182 |
+
continue
|
| 183 |
+
|
| 184 |
+
return api_response(False, platform, error="Video generation timeout")
|
| 185 |
+
|
| 186 |
+
# ============================================================
|
| 187 |
+
# 3. MAGIC STUDIO AI ART GENERATOR
|
| 188 |
+
# ============================================================
|
| 189 |
+
@app.route("/api/v1/ai-art")
|
| 190 |
+
def generate_ai_art():
|
| 191 |
+
prompt = request.args.get("prompt")
|
| 192 |
+
platform = "ai-art-generator"
|
| 193 |
+
|
| 194 |
+
if not prompt:
|
| 195 |
+
return api_response(False, platform, error="Prompt is required")
|
| 196 |
+
|
| 197 |
+
try:
|
| 198 |
+
magic_url = "https://ai-api.magicstudio.com/api/ai-art-generator"
|
| 199 |
+
magic_headers = {
|
| 200 |
+
"user-agent": ua.random,
|
| 201 |
+
"accept": "application/json, text/plain, */*",
|
| 202 |
+
"origin": "https://magicstudio.com",
|
| 203 |
+
"referer": "https://magicstudio.com/ai-art-generator/"
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
magic_data = {
|
| 207 |
+
"prompt": prompt,
|
| 208 |
+
"output_format": "bytes",
|
| 209 |
+
"user_profile_id": "null",
|
| 210 |
+
"anonymous_user_id": "8c8fe58b-f1dd-40b8-86ac-a91ea7d7b4c2",
|
| 211 |
+
"user_is_subscribed": "false",
|
| 212 |
+
"client_id": "pSgX7WgjukXCBoYwDM8G8GLnRRkvAoJlqa5eAVvj95o"
|
| 213 |
+
}
|
| 214 |
+
|
| 215 |
+
res = requests.post(magic_url, data=magic_data, headers=magic_headers, timeout=30)
|
| 216 |
+
|
| 217 |
+
if res.status_code == 200:
|
| 218 |
+
# Convert to base64 for JSON response
|
| 219 |
+
img_base64 = base64.b64encode(res.content).decode('utf-8')
|
| 220 |
+
return api_response(True, platform, data={
|
| 221 |
+
"prompt": prompt,
|
| 222 |
+
"image_base64": img_base64,
|
| 223 |
+
"format": "png"
|
| 224 |
+
})
|
| 225 |
+
else:
|
| 226 |
+
return api_response(False, platform, error=f"API error: {res.status_code}")
|
| 227 |
+
except Exception as e:
|
| 228 |
+
return api_response(False, platform, error=str(e))
|
| 229 |
+
|
| 230 |
+
# RAW IMAGE endpoint
|
| 231 |
+
@app.route("/api/v1/ai-art/raw")
|
| 232 |
+
def generate_ai_art_raw():
|
| 233 |
+
prompt = request.args.get("prompt")
|
| 234 |
+
if not prompt:
|
| 235 |
+
return jsonify({"error": "Prompt required"}), 400
|
| 236 |
+
|
| 237 |
+
try:
|
| 238 |
+
magic_url = "https://ai-api.magicstudio.com/api/ai-art-generator"
|
| 239 |
+
magic_headers = {
|
| 240 |
+
"user-agent": ua.random,
|
| 241 |
+
"origin": "https://magicstudio.com",
|
| 242 |
+
"referer": "https://magicstudio.com/ai-art-generator/"
|
| 243 |
+
}
|
| 244 |
+
magic_data = {
|
| 245 |
+
"prompt": prompt,
|
| 246 |
+
"output_format": "bytes",
|
| 247 |
+
"anonymous_user_id": "8c8fe58b-f1dd-40b8-86ac-a91ea7d7b4c2",
|
| 248 |
+
"client_id": "pSgX7WgjukXCBoYwDM8G8GLnRRkvAoJlqa5eAVvj95o"
|
| 249 |
+
}
|
| 250 |
+
res = requests.post(magic_url, data=magic_data, headers=magic_headers, timeout=30)
|
| 251 |
+
return Response(res.content, mimetype="image/png")
|
| 252 |
+
except Exception as e:
|
| 253 |
+
return jsonify({"error": str(e)}), 500
|
| 254 |
+
|
| 255 |
+
# ============================================================
|
| 256 |
+
# 4. CHATGPT API (with Authentication)
|
| 257 |
+
# ============================================================
|
| 258 |
+
CHATGPT_BASE = "https://api.souimagery.fun/v1"
|
| 259 |
+
CHATGPT_KEY = "sk-Nm3CRnIJjnHgBc8U9lHgN6ZSGU7UXPh3ROLrlPbAvy6N77AS"
|
| 260 |
+
|
| 261 |
+
@app.route("/api/v1/chatgpt")
|
| 262 |
+
def chatgpt():
|
| 263 |
+
prompt = request.args.get("prompt") or request.args.get("q") or request.args.get("message")
|
| 264 |
+
platform = "chatgpt"
|
| 265 |
+
|
| 266 |
+
if not prompt:
|
| 267 |
+
return api_response(False, platform, error="Prompt is required")
|
| 268 |
+
|
| 269 |
+
try:
|
| 270 |
+
headers = {
|
| 271 |
+
"Authorization": f"Bearer {CHATGPT_KEY}",
|
| 272 |
+
"Content-Type": "application/json",
|
| 273 |
+
"User-Agent": ua.random
|
| 274 |
+
}
|
| 275 |
+
|
| 276 |
+
payload = {
|
| 277 |
+
"model": "gpt-3.5-turbo",
|
| 278 |
+
"messages": [{"role": "user", "content": prompt}],
|
| 279 |
+
"temperature": 0.7,
|
| 280 |
+
"max_tokens": 2000
|
| 281 |
+
}
|
| 282 |
+
|
| 283 |
+
res = requests.post(
|
| 284 |
+
f"{CHATGPT_BASE}/chat/completions",
|
| 285 |
+
headers=headers,
|
| 286 |
+
json=payload,
|
| 287 |
+
timeout=60
|
| 288 |
+
)
|
| 289 |
+
|
| 290 |
+
if res.status_code == 200:
|
| 291 |
+
data = res.json()
|
| 292 |
+
response_text = data.get("choices", [{}])[0].get("message", {}).get("content", "")
|
| 293 |
+
|
| 294 |
+
return api_response(True, platform, data={
|
| 295 |
+
"prompt": prompt,
|
| 296 |
+
"response": response_text,
|
| 297 |
+
"model": data.get("model"),
|
| 298 |
+
"usage": data.get("usage")
|
| 299 |
+
})
|
| 300 |
+
else:
|
| 301 |
+
return api_response(False, platform, error=f"API error: {res.status_code}", extra={"details": res.text})
|
| 302 |
+
except Exception as e:
|
| 303 |
+
return api_response(False, platform, error=str(e))
|
| 304 |
+
|
| 305 |
+
@app.route("/api/v1/chatgpt/models")
|
| 306 |
+
def chatgpt_models():
|
| 307 |
+
try:
|
| 308 |
+
headers = {"Authorization": f"Bearer {CHATGPT_KEY}"}
|
| 309 |
+
res = requests.get(f"{CHATGPT_BASE}/models", headers=headers, timeout=10)
|
| 310 |
+
return api_response(True, "chatgpt", data=res.json())
|
| 311 |
+
except Exception as e:
|
| 312 |
+
return api_response(False, "chatgpt", error=str(e))
|
| 313 |
+
|
| 314 |
+
# ============================================================
|
| 315 |
+
# 5. TIKTOK DOWNLOADER (Single)
|
| 316 |
+
# ============================================================
|
| 317 |
+
@app.route("/api/v1/tiktok")
|
| 318 |
+
def tiktok_download():
|
| 319 |
+
url = request.args.get("url")
|
| 320 |
+
platform = "tiktok"
|
| 321 |
+
|
| 322 |
+
if not url:
|
| 323 |
+
return api_response(False, platform, error="URL is required")
|
| 324 |
+
|
| 325 |
+
try:
|
| 326 |
+
api_url = f"https://tikwm.com/api/?url={url}"
|
| 327 |
+
res = requests.get(api_url, headers={"User-Agent": ua.random}, timeout=15)
|
| 328 |
+
data = res.json()
|
| 329 |
+
|
| 330 |
+
if data.get("code") != 0 or not data.get("data"):
|
| 331 |
+
return api_response(False, platform, error=data.get("msg", "Failed to fetch"))
|
| 332 |
+
|
| 333 |
+
video_data = data["data"]
|
| 334 |
+
|
| 335 |
+
return api_response(True, platform, data={
|
| 336 |
+
"title": video_data.get("title"),
|
| 337 |
+
"cover": video_data.get("cover"),
|
| 338 |
+
"duration": video_data.get("duration"),
|
| 339 |
+
"play_count": video_data.get("play_count"),
|
| 340 |
+
"digg_count": video_data.get("digg_count"),
|
| 341 |
+
"comment_count": video_data.get("comment_count"),
|
| 342 |
+
"share_count": video_data.get("share_count"),
|
| 343 |
+
"download_count": video_data.get("download_count"),
|
| 344 |
+
"author": video_data.get("author"),
|
| 345 |
+
"video_no_watermark": video_data.get("play"),
|
| 346 |
+
"video_watermark": video_data.get("wmplay"),
|
| 347 |
+
"music": video_data.get("music"),
|
| 348 |
+
"music_title": video_data.get("music_info", {}).get("title"),
|
| 349 |
+
"music_author": video_data.get("music_info", {}).get("author"),
|
| 350 |
+
"images": video_data.get("images", [])
|
| 351 |
+
})
|
| 352 |
+
except Exception as e:
|
| 353 |
+
return api_response(False, platform, error=str(e))
|
| 354 |
+
|
| 355 |
+
# ============================================================
|
| 356 |
+
# 6. ALL-IN-ONE SOCIAL MEDIA DOWNLOADER
|
| 357 |
+
# ============================================================
|
| 358 |
+
def detect_platform(url):
|
| 359 |
+
url = url.lower()
|
| 360 |
+
if "tiktok.com" in url:
|
| 361 |
+
return "tiktok"
|
| 362 |
+
if "instagram.com" in url:
|
| 363 |
+
return "instagram"
|
| 364 |
+
if "facebook.com" in url or "fb.watch" in url or "fb.com" in url:
|
| 365 |
+
return "facebook"
|
| 366 |
+
if "youtube.com" in url or "youtu.be" in url:
|
| 367 |
+
return "youtube"
|
| 368 |
+
if "snapchat.com" in url:
|
| 369 |
+
return "snapchat"
|
| 370 |
+
if "pinterest.com" in url or "pin.it" in url:
|
| 371 |
+
return "pinterest"
|
| 372 |
+
if "spotify.com" in url:
|
| 373 |
+
return "spotify"
|
| 374 |
+
if "twitter.com" in url or "x.com" in url:
|
| 375 |
+
return "twitter"
|
| 376 |
+
if "reddit.com" in url:
|
| 377 |
+
return "reddit"
|
| 378 |
+
if "likee.com" in url or "likee.video" in url:
|
| 379 |
+
return "likee"
|
| 380 |
+
if "capcut.com" in url:
|
| 381 |
+
return "capcut"
|
| 382 |
+
if "threads.net" in url:
|
| 383 |
+
return "threads"
|
| 384 |
+
return "unknown"
|
| 385 |
+
|
| 386 |
+
def extract_download_url(video_data):
|
| 387 |
+
"""Extract direct download URL from various API responses"""
|
| 388 |
+
if isinstance(video_data, dict):
|
| 389 |
+
if "video" in video_data:
|
| 390 |
+
return video_data["video"]
|
| 391 |
+
if "url" in video_data:
|
| 392 |
+
return video_data["url"]
|
| 393 |
+
if "data" in video_data:
|
| 394 |
+
if isinstance(video_data["data"], dict):
|
| 395 |
+
if "video" in video_data["data"]:
|
| 396 |
+
return video_data["data"]["video"]
|
| 397 |
+
if "url" in video_data["data"]:
|
| 398 |
+
return video_data["data"]["url"]
|
| 399 |
+
if "play" in video_data["data"]:
|
| 400 |
+
return video_data["data"]["play"]
|
| 401 |
+
if "play" in video_data:
|
| 402 |
+
return video_data["play"]
|
| 403 |
+
if "hd_video" in video_data:
|
| 404 |
+
return video_data["hd_video"]
|
| 405 |
+
if "nowatermark" in video_data:
|
| 406 |
+
return video_data["nowatermark"]
|
| 407 |
+
if "images" in video_data and video_data["images"]:
|
| 408 |
+
return video_data["images"][0]
|
| 409 |
+
if "music" in video_data:
|
| 410 |
+
return video_data["music"]
|
| 411 |
+
if "medias" in video_data:
|
| 412 |
+
return video_data["medias"]
|
| 413 |
+
return None
|
| 414 |
+
|
| 415 |
+
def fetch_from_providers(url, platform):
|
| 416 |
+
"""Try multiple API providers"""
|
| 417 |
+
encoded = quote_plus(url)
|
| 418 |
+
|
| 419 |
+
providers = {
|
| 420 |
+
"tiktok": [
|
| 421 |
+
f"https://tikwm.com/api/?url={url}",
|
| 422 |
+
f"https://www.velyn.biz.id/api/downloader/tiktok?url={encoded}",
|
| 423 |
+
f"https://apis.prexzyvilla.site/download/tiktok?url={encoded}",
|
| 424 |
+
f"https://api.davidcyriltech.my.id/tiktok?url={url}"
|
| 425 |
+
],
|
| 426 |
+
"instagram": [
|
| 427 |
+
f"https://api.davidcyriltech.my.id/instagram?url={url}",
|
| 428 |
+
f"https://apis.prexzyvilla.site/download/ig2?url={encoded}",
|
| 429 |
+
f"https://www.velyn.biz.id/api/downloader/instagram?url={encoded}"
|
| 430 |
+
],
|
| 431 |
+
"facebook": [
|
| 432 |
+
f"https://www.velyn.biz.id/api/downloader/facebook?url={encoded}",
|
| 433 |
+
f"https://apis.prexzyvilla.site/download/facebook?url={encoded}",
|
| 434 |
+
f"https://api.davidcyriltech.my.id/facebook?url={url}"
|
| 435 |
+
],
|
| 436 |
+
"youtube": [
|
| 437 |
+
f"https://ytdl.hideme.eu.org/{url}",
|
| 438 |
+
f"https://apis.prexzyvilla.site/download/ytdl?url={encoded}",
|
| 439 |
+
f"https://api.davidcyriltech.my.id/youtube?url={url}"
|
| 440 |
+
],
|
| 441 |
+
"pinterest": [
|
| 442 |
+
f"https://apis.prexzyvilla.site/download/pinterest?url={encoded}",
|
| 443 |
+
f"https://api.davidcyriltech.my.id/pinterest?url={url}"
|
| 444 |
+
],
|
| 445 |
+
"spotify": [
|
| 446 |
+
f"https://spotify-down.apis-bj-devs.workers.dev/?url={url}",
|
| 447 |
+
f"https://apis.prexzyvilla.site/download/spotify?url={encoded}"
|
| 448 |
+
],
|
| 449 |
+
"twitter": [
|
| 450 |
+
f"https://apis.prexzyvilla.site/download/twitter?url={encoded}",
|
| 451 |
+
f"https://www.velyn.biz.id/api/downloader/twitter?url={encoded}"
|
| 452 |
+
],
|
| 453 |
+
"threads": [
|
| 454 |
+
f"https://apis.prexzyvilla.site/download/threads?url={encoded}"
|
| 455 |
+
],
|
| 456 |
+
"capcut": [
|
| 457 |
+
f"https://apis.prexzyvilla.site/download/capcut?url={encoded}"
|
| 458 |
+
],
|
| 459 |
+
"likee": [
|
| 460 |
+
f"https://apis.prexzyvilla.site/download/likee?url={encoded}"
|
| 461 |
+
],
|
| 462 |
+
"reddit": [
|
| 463 |
+
f"https://apis.prexzyvilla.site/download/reddit?url={encoded}"
|
| 464 |
+
]
|
| 465 |
+
}
|
| 466 |
+
|
| 467 |
+
target_providers = providers.get(platform, providers.get("tiktok", []))
|
| 468 |
+
|
| 469 |
+
for api_url in target_providers[:5]:
|
| 470 |
+
try:
|
| 471 |
+
res = requests.get(api_url, headers={"User-Agent": ua.random}, timeout=15)
|
| 472 |
+
if res.status_code == 200:
|
| 473 |
+
data = res.json()
|
| 474 |
+
if data and (data.get("status") or data.get("code") == 0 or data.get("data")):
|
| 475 |
+
return data
|
| 476 |
+
except:
|
| 477 |
+
continue
|
| 478 |
+
|
| 479 |
+
return None
|
| 480 |
+
|
| 481 |
+
@app.route("/api/v1/download")
|
| 482 |
+
def all_in_one_download():
|
| 483 |
+
url = request.args.get("url")
|
| 484 |
+
platform = request.args.get("platform", "auto")
|
| 485 |
+
|
| 486 |
+
if not url:
|
| 487 |
+
return api_response(False, "downloader", error="URL is required")
|
| 488 |
+
|
| 489 |
+
if platform == "auto":
|
| 490 |
+
platform = detect_platform(url)
|
| 491 |
+
|
| 492 |
+
try:
|
| 493 |
+
result = fetch_from_providers(url, platform)
|
| 494 |
+
|
| 495 |
+
if result:
|
| 496 |
+
download_url = extract_download_url(result)
|
| 497 |
+
|
| 498 |
+
if download_url:
|
| 499 |
+
if isinstance(download_url, list):
|
| 500 |
+
return api_response(True, platform, data={
|
| 501 |
+
"url": url,
|
| 502 |
+
"download_urls": download_url,
|
| 503 |
+
"count": len(download_url)
|
| 504 |
+
})
|
| 505 |
+
else:
|
| 506 |
+
return api_response(True, platform, data={
|
| 507 |
+
"url": url,
|
| 508 |
+
"download_url": download_url
|
| 509 |
+
})
|
| 510 |
+
else:
|
| 511 |
+
return api_response(True, platform, data={
|
| 512 |
+
"url": url,
|
| 513 |
+
"raw_data": result
|
| 514 |
+
})
|
| 515 |
+
else:
|
| 516 |
+
return api_response(False, platform, error="Unable to fetch media from any provider")
|
| 517 |
+
except Exception as e:
|
| 518 |
+
return api_response(False, platform, error=str(e))
|
| 519 |
+
|
| 520 |
+
# Platform-specific endpoints
|
| 521 |
+
@app.route("/api/v1/tiktok/download")
|
| 522 |
+
def tiktok_download_v2():
|
| 523 |
+
url = request.args.get("url")
|
| 524 |
+
return tiktok_download() if url else api_response(False, "tiktok", error="URL required")
|
| 525 |
+
|
| 526 |
+
@app.route("/api/v1/instagram/download")
|
| 527 |
+
def instagram_download():
|
| 528 |
+
url = request.args.get("url")
|
| 529 |
+
if not url:
|
| 530 |
+
return api_response(False, "instagram", error="URL required")
|
| 531 |
+
|
| 532 |
+
result = fetch_from_providers(url, "instagram")
|
| 533 |
+
if result:
|
| 534 |
+
download_url = extract_download_url(result)
|
| 535 |
+
return api_response(True, "instagram", data={"url": url, "download_url": download_url or result})
|
| 536 |
+
return api_response(False, "instagram", error="Download failed")
|
| 537 |
+
|
| 538 |
+
@app.route("/api/v1/facebook/download")
|
| 539 |
+
def facebook_download():
|
| 540 |
+
url = request.args.get("url")
|
| 541 |
+
if not url:
|
| 542 |
+
return api_response(False, "facebook", error="URL required")
|
| 543 |
+
|
| 544 |
+
result = fetch_from_providers(url, "facebook")
|
| 545 |
+
if result:
|
| 546 |
+
download_url = extract_download_url(result)
|
| 547 |
+
return api_response(True, "facebook", data={"url": url, "download_url": download_url or result})
|
| 548 |
+
return api_response(False, "facebook", error="Download failed")
|
| 549 |
+
|
| 550 |
+
@app.route("/api/v1/youtube/download")
|
| 551 |
+
def youtube_download():
|
| 552 |
+
url = request.args.get("url")
|
| 553 |
+
if not url:
|
| 554 |
+
return api_response(False, "youtube", error="URL required")
|
| 555 |
+
|
| 556 |
+
result = fetch_from_providers(url, "youtube")
|
| 557 |
+
if result:
|
| 558 |
+
download_url = extract_download_url(result)
|
| 559 |
+
return api_response(True, "youtube", data={"url": url, "download_url": download_url or result})
|
| 560 |
+
return api_response(False, "youtube", error="Download failed")
|
| 561 |
+
|
| 562 |
+
# ============================================================
|
| 563 |
+
# 7. FREE FIRE INFO
|
| 564 |
+
# ============================================================
|
| 565 |
+
@app.route("/api/v1/freefire")
|
| 566 |
+
def freefire_info():
|
| 567 |
+
uid = request.args.get("uid")
|
| 568 |
+
platform = "freefire"
|
| 569 |
+
|
| 570 |
+
if not uid:
|
| 571 |
+
return api_response(False, platform, error="UID is required")
|
| 572 |
+
|
| 573 |
+
try:
|
| 574 |
+
url = f'https://freefirejornal.com/en/perfil-jogador-freefire/{uid}/'
|
| 575 |
+
headers = {"User-Agent": ua.random}
|
| 576 |
+
req = requests.get(url, headers=headers, timeout=10)
|
| 577 |
+
|
| 578 |
+
if req.status_code != 200:
|
| 579 |
+
return api_response(False, platform, error="Failed to fetch data")
|
| 580 |
+
|
| 581 |
+
soup = BeautifulSoup(req.text, 'html.parser')
|
| 582 |
+
div_tag = soup.find("div", class_="jg-player-infos")
|
| 583 |
+
|
| 584 |
+
if not div_tag:
|
| 585 |
+
return api_response(False, platform, error="Invalid UID")
|
| 586 |
+
|
| 587 |
+
data = {}
|
| 588 |
+
for li in div_tag.find_all("li"):
|
| 589 |
+
strong = li.find("strong")
|
| 590 |
+
if strong:
|
| 591 |
+
label = re.sub(r'[^\x00-\x7F]+', '', strong.get_text(strip=True).replace(":", "")).strip()
|
| 592 |
+
value = li.get_text(strip=True).replace(strong.get_text(strip=True), "").strip()
|
| 593 |
+
if label and value:
|
| 594 |
+
if "Likes" in label:
|
| 595 |
+
value = value.split("β")[0].strip()
|
| 596 |
+
data[label] = value
|
| 597 |
+
|
| 598 |
+
return api_response(True, platform, data=data)
|
| 599 |
+
except Exception as e:
|
| 600 |
+
return api_response(False, platform, error=str(e))
|
| 601 |
+
|
| 602 |
+
# ============================================================
|
| 603 |
+
# 8. INSTAGRAM INFO
|
| 604 |
+
# ============================================================
|
| 605 |
+
@app.route("/api/v1/instagram")
|
| 606 |
+
def instagram_info():
|
| 607 |
+
username = request.args.get("username")
|
| 608 |
+
platform = "instagram"
|
| 609 |
+
|
| 610 |
+
if not username:
|
| 611 |
+
return api_response(False, platform, error="Username required")
|
| 612 |
+
|
| 613 |
+
try:
|
| 614 |
+
url = f"https://www.instagram.com/{username}/?__a=1&__d=dis"
|
| 615 |
+
headers = {"User-Agent": ua.random}
|
| 616 |
+
req = requests.get(url, headers=headers, timeout=10)
|
| 617 |
+
|
| 618 |
+
if req.status_code == 200:
|
| 619 |
+
user = req.json().get("graphql", {}).get("user", {})
|
| 620 |
+
return api_response(True, platform, data={
|
| 621 |
+
"username": user.get("username"),
|
| 622 |
+
"full_name": user.get("full_name"),
|
| 623 |
+
"followers": user.get("edge_followed_by", {}).get("count", 0),
|
| 624 |
+
"following": user.get("edge_follow", {}).get("count", 0),
|
| 625 |
+
"posts": user.get("edge_owner_to_timeline_media", {}).get("count", 0),
|
| 626 |
+
"profile_pic": user.get("profile_pic_url_hd", ""),
|
| 627 |
+
"is_private": user.get("is_private", False),
|
| 628 |
+
"is_verified": user.get("is_verified", False),
|
| 629 |
+
"bio": user.get("biography", ""),
|
| 630 |
+
"external_url": user.get("external_url", ""),
|
| 631 |
+
"business_category": user.get("business_category_name", "")
|
| 632 |
+
})
|
| 633 |
+
|
| 634 |
+
# Fallback scrape
|
| 635 |
+
url = f"https://www.instagram.com/{username}/"
|
| 636 |
+
req = requests.get(url, headers=headers, timeout=10)
|
| 637 |
+
soup = BeautifulSoup(req.text, 'html.parser')
|
| 638 |
+
meta_desc = soup.find("meta", property="og:description")
|
| 639 |
+
|
| 640 |
+
if meta_desc:
|
| 641 |
+
desc = meta_desc.get("content", "")
|
| 642 |
+
followers = re.search(r'([\d,]+) Followers', desc)
|
| 643 |
+
following = re.search(r'([\d,]+) Following', desc)
|
| 644 |
+
posts = re.search(r'([\d,]+) Posts', desc)
|
| 645 |
+
|
| 646 |
+
return api_response(True, platform, data={
|
| 647 |
+
"username": username,
|
| 648 |
+
"followers": followers.group(1).replace(',', '') if followers else "0",
|
| 649 |
+
"following": following.group(1).replace(',', '') if following else "0",
|
| 650 |
+
"posts": posts.group(1).replace(',', '') if posts else "0"
|
| 651 |
+
})
|
| 652 |
+
|
| 653 |
+
return api_response(False, platform, error="User not found")
|
| 654 |
+
except Exception as e:
|
| 655 |
+
return api_response(False, platform, error=str(e))
|
| 656 |
+
|
| 657 |
+
# ============================================================
|
| 658 |
+
# 9. TIKTOK INFO
|
| 659 |
+
# ============================================================
|
| 660 |
+
@app.route("/api/v1/tiktok/info")
|
| 661 |
+
def tiktok_info():
|
| 662 |
+
username = request.args.get("username")
|
| 663 |
+
platform = "tiktok"
|
| 664 |
+
|
| 665 |
+
if not username:
|
| 666 |
+
return api_response(False, platform, error="Username required")
|
| 667 |
+
|
| 668 |
+
try:
|
| 669 |
+
url = f"https://www.tiktok.com/@{username}"
|
| 670 |
+
headers = {"User-Agent": ua.random}
|
| 671 |
+
req = scraper.get(url, headers=headers, timeout=10)
|
| 672 |
+
soup = BeautifulSoup(req.text, 'html.parser')
|
| 673 |
+
|
| 674 |
+
data = {"username": username}
|
| 675 |
+
|
| 676 |
+
# Try to parse JSON from script tags
|
| 677 |
+
scripts = soup.find_all("script", {"type": "application/json"})
|
| 678 |
+
for script in scripts:
|
| 679 |
+
if script.string and '"UserModule"' in script.string:
|
| 680 |
+
try:
|
| 681 |
+
json_data = json.loads(script.string)
|
| 682 |
+
if "UserModule" in json_data:
|
| 683 |
+
user = json_data["UserModule"]["users"].get(username, {})
|
| 684 |
+
data = {
|
| 685 |
+
"username": username,
|
| 686 |
+
"nickname": user.get("nickname", ""),
|
| 687 |
+
"followers": user.get("stats", {}).get("followerCount", 0),
|
| 688 |
+
"following": user.get("stats", {}).get("followingCount", 0),
|
| 689 |
+
"likes": user.get("stats", {}).get("heartCount", 0),
|
| 690 |
+
"videos": user.get("stats", {}).get("videoCount", 0),
|
| 691 |
+
"verified": user.get("verified", False),
|
| 692 |
+
"avatar": user.get("avatarMedium", ""),
|
| 693 |
+
"signature": user.get("signature", ""),
|
| 694 |
+
"bio_link": user.get("bioLink", {}).get("link", "")
|
| 695 |
+
}
|
| 696 |
+
break
|
| 697 |
+
except:
|
| 698 |
+
pass
|
| 699 |
+
|
| 700 |
+
# Fallback to meta tags
|
| 701 |
+
if "followers" not in data:
|
| 702 |
+
meta_desc = soup.find("meta", property="og:description")
|
| 703 |
+
if meta_desc:
|
| 704 |
+
desc = meta_desc.get("content", "")
|
| 705 |
+
followers = re.search(r'([\d,]+) Followers', desc)
|
| 706 |
+
likes = re.search(r'([\d,]+) Likes', desc)
|
| 707 |
+
data["followers"] = followers.group(1).replace(',', '') if followers else "0"
|
| 708 |
+
data["likes"] = likes.group(1).replace(',', '') if likes else "0"
|
| 709 |
+
|
| 710 |
+
return api_response(True, platform, data=data)
|
| 711 |
+
except Exception as e:
|
| 712 |
+
return api_response(False, platform, error=str(e))
|
| 713 |
+
|
| 714 |
+
# ============================================================
|
| 715 |
+
# 10. GITHUB INFO
|
| 716 |
+
# ============================================================
|
| 717 |
+
@app.route("/api/v1/github")
|
| 718 |
+
def github_info():
|
| 719 |
+
username = request.args.get("username")
|
| 720 |
+
platform = "github"
|
| 721 |
+
|
| 722 |
+
if not username:
|
| 723 |
+
return api_response(False, platform, error="Username required")
|
| 724 |
+
|
| 725 |
+
try:
|
| 726 |
+
url = f"https://api.github.com/users/{username}"
|
| 727 |
+
headers = {"User-Agent": ua.random}
|
| 728 |
+
req = requests.get(url, headers=headers, timeout=10)
|
| 729 |
+
|
| 730 |
+
if req.status_code != 200:
|
| 731 |
+
return api_response(False, platform, error="User not found")
|
| 732 |
+
|
| 733 |
+
user = req.json()
|
| 734 |
+
return api_response(True, platform, data={
|
| 735 |
+
"username": user.get("login"),
|
| 736 |
+
"name": user.get("name"),
|
| 737 |
+
"followers": user.get("followers", 0),
|
| 738 |
+
"following": user.get("following", 0),
|
| 739 |
+
"public_repos": user.get("public_repos", 0),
|
| 740 |
+
"public_gists": user.get("public_gists", 0),
|
| 741 |
+
"avatar": user.get("avatar_url", ""),
|
| 742 |
+
"bio": user.get("bio", ""),
|
| 743 |
+
"blog": user.get("blog", ""),
|
| 744 |
+
"location": user.get("location", ""),
|
| 745 |
+
"company": user.get("company", ""),
|
| 746 |
+
"twitter": user.get("twitter_username", ""),
|
| 747 |
+
"join_date": user.get("created_at", ""),
|
| 748 |
+
"hireable": user.get("hireable", False)
|
| 749 |
+
})
|
| 750 |
+
except Exception as e:
|
| 751 |
+
return api_response(False, platform, error=str(e))
|
| 752 |
+
|
| 753 |
+
# ============================================================
|
| 754 |
+
# HOME & DOCS
|
| 755 |
+
# ============================================================
|
| 756 |
+
@app.route("/")
|
| 757 |
+
def home():
|
| 758 |
+
return jsonify({
|
| 759 |
+
"name": "π₯ SUPER MULTI-API v2.0",
|
| 760 |
+
"developer": DEVELOPER,
|
| 761 |
+
"telegram": TELEGRAM,
|
| 762 |
+
"version": "2.0.0",
|
| 763 |
+
"total_endpoints": 20,
|
| 764 |
+
"categories": {
|
| 765 |
+
"ai_generation": [
|
| 766 |
+
{"endpoint": "/api/v1/3d-logo", "method": "GET", "params": "prompt"},
|
| 767 |
+
{"endpoint": "/api/v1/ai-video", "method": "GET", "params": "prompt"},
|
| 768 |
+
{"endpoint": "/api/v1/ai-art", "method": "GET", "params": "prompt"},
|
| 769 |
+
{"endpoint": "/api/v1/ai-art/raw", "method": "GET", "params": "prompt", "note": "Returns raw PNG image"}
|
| 770 |
+
],
|
| 771 |
+
"chatgpt": [
|
| 772 |
+
{"endpoint": "/api/v1/chatgpt", "method": "GET", "params": "prompt/q/message"},
|
| 773 |
+
{"endpoint": "/api/v1/chatgpt/models", "method": "GET", "params": "none"}
|
| 774 |
+
],
|
| 775 |
+
"social_downloaders": [
|
| 776 |
+
{"endpoint": "/api/v1/download", "method": "GET", "params": "url", "note": "Auto-detect platform"},
|
| 777 |
+
{"endpoint": "/api/v1/tiktok", "method": "GET", "params": "url"},
|
| 778 |
+
{"endpoint": "/api/v1/tiktok/download", "method": "GET", "params": "url"},
|
| 779 |
+
{"endpoint": "/api/v1/instagram/download", "method": "GET", "params": "url"},
|
| 780 |
+
{"endpoint": "/api/v1/facebook/download", "method": "GET", "params": "url"},
|
| 781 |
+
{"endpoint": "/api/v1/youtube/download", "method": "GET", "params": "url"}
|
| 782 |
+
],
|
| 783 |
+
"social_info": [
|
| 784 |
+
{"endpoint": "/api/v1/freefire", "method": "GET", "params": "uid"},
|
| 785 |
+
{"endpoint": "/api/v1/instagram", "method": "GET", "params": "username"},
|
| 786 |
+
{"endpoint": "/api/v1/tiktok/info", "method": "GET", "params": "username"},
|
| 787 |
+
{"endpoint": "/api/v1/github", "method": "GET", "params": "username"}
|
| 788 |
+
]
|
| 789 |
+
},
|
| 790 |
+
"supported_platforms": [
|
| 791 |
+
"TikTok", "Instagram", "Facebook", "YouTube", "Pinterest",
|
| 792 |
+
"Spotify", "Twitter/X", "Reddit", "Threads", "CapCut",
|
| 793 |
+
"Likee", "Free Fire", "GitHub"
|
| 794 |
+
]
|
| 795 |
+
})
|
| 796 |
+
|
| 797 |
+
@app.route("/docs")
|
| 798 |
+
def docs():
|
| 799 |
+
return jsonify({
|
| 800 |
+
"documentation": "Complete API Documentation",
|
| 801 |
+
"developer": DEVELOPER,
|
| 802 |
+
"telegram": TELEGRAM,
|
| 803 |
+
"base_url": request.host_url.rstrip('/'),
|
| 804 |
+
"example_requests": {
|
| 805 |
+
"3d_logo": f"{request.host_url}api/v1/3d-logo?prompt=iron man 3d cartoon",
|
| 806 |
+
"ai_video": f"{request.host_url}api/v1/ai-video?prompt=a beautiful sunset over ocean",
|
| 807 |
+
"ai_art": f"{request.host_url}api/v1/ai-art?prompt=dragon in sky",
|
| 808 |
+
"chatgpt": f"{request.host_url}api/v1/chatgpt?prompt=what is python",
|
| 809 |
+
"tiktok_download": f"{request.host_url}api/v1/tiktok?url=https://vt.tiktok.com/ZSjXxxxxx/",
|
| 810 |
+
"instagram_info": f"{request.host_url}api/v1/instagram?username=instagram",
|
| 811 |
+
"freefire": f"{request.host_url}api/v1/freefire?uid=123456789"
|
| 812 |
+
}
|
| 813 |
+
})
|
| 814 |
+
|
| 815 |
+
# ============================================================
|
| 816 |
+
# MAIN
|
| 817 |
+
# ============================================================
|
| 818 |
+
if __name__ == "__main__":
|
| 819 |
+
print("""
|
| 820 |
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 821 |
+
β π₯ SUPER MULTI-API v2.0 π₯ β
|
| 822 |
+
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ£
|
| 823 |
+
β Developer: WASIF ALI β
|
| 824 |
+
β Telegram: @THE_FREE_HACKS β
|
| 825 |
+
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ£
|
| 826 |
+
β Active Endpoints: 20+ β
|
| 827 |
+
β AI Generation: 3D Logo, AI Video, AI Art β
|
| 828 |
+
β ChatGPT: Chat, Models β
|
| 829 |
+
β Downloaders: TikTok, IG, FB, YT, Pinterest, Spotify & more β
|
| 830 |
+
β Info APIs: Free Fire, Instagram, TikTok, GitHub β
|
| 831 |
+
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ£
|
| 832 |
+
β Visit /docs for full documentation β
|
| 833 |
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 834 |
+
""")
|
| 835 |
+
app.run(host="0.0.0.0", port=5000, debug=True)
|
requirements.txt
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
flask
|
| 2 |
+
requests
|
| 3 |
+
beautifulsoup4
|
| 4 |
+
fake-useragent
|
| 5 |
+
cloudscraper
|
| 6 |
+
deep-translator
|