Spaces:
Runtime error
Runtime error
| #!/usr/bin/env python3 | |
| """ | |
| π₯ SUPER MULTI-API - 20+ Features in One | |
| Developer: WASIF ALI | |
| Telegram: @THE_FREE_HACKS | |
| """ | |
| from flask import Flask, request, jsonify, Response | |
| import requests | |
| import json | |
| import time | |
| import re | |
| import cloudscraper | |
| from datetime import datetime | |
| from fake_useragent import UserAgent | |
| from urllib.parse import urlparse, quote_plus | |
| from concurrent.futures import ThreadPoolExecutor | |
| from bs4 import BeautifulSoup | |
| import base64 | |
| app = Flask(__name__) | |
| ua = UserAgent() | |
| scraper = cloudscraper.create_scraper() | |
| executor = ThreadPoolExecutor(max_workers=5) | |
| # ============================================================ | |
| # DEVELOPER INFO | |
| # ============================================================ | |
| DEVELOPER = "WASIF ALI" | |
| TELEGRAM = "@THE_FREE_HACKS" | |
| def api_response(success, platform, data=None, message=None, error=None, extra=None): | |
| """Standardized API response for all endpoints""" | |
| response = { | |
| "success": success, | |
| "platform": platform, | |
| "timestamp": datetime.now().isoformat(), | |
| "developer": DEVELOPER, | |
| "telegram": TELEGRAM | |
| } | |
| if data is not None: | |
| response["data"] = data | |
| if message: | |
| response["message"] = message | |
| if error: | |
| response["error"] = error | |
| if extra: | |
| response.update(extra) | |
| return jsonify(response) | |
| # ============================================================ | |
| # 1. 3D LOGO GENERATOR | |
| # ============================================================ | |
| def generate_3d_logo(): | |
| prompt = request.args.get("prompt") | |
| platform = "3d-logo-generator" | |
| if not prompt: | |
| return api_response(False, platform, error="Prompt is required") | |
| try: | |
| api_url = "https://viscodev.x10.mx/3D_CARTOON/api.php" | |
| res = requests.post(api_url, json={"prompt": prompt}, timeout=30) | |
| if res.status_code != 200: | |
| return api_response(False, platform, error="External API failed") | |
| data = res.json() | |
| if not data.get("success"): | |
| return api_response(False, platform, error=data.get("message", "Generation failed")) | |
| images = data.get("images_with_background") or data.get("images") or data.get("with_background") or [] | |
| return api_response(True, platform, data={ | |
| "prompt": prompt, | |
| "images": images, | |
| "count": len(images) | |
| }) | |
| except Exception as e: | |
| return api_response(False, platform, error=str(e)) | |
| # ============================================================ | |
| # 2. AI VIDEO GENERATOR (Text2Video) | |
| # ============================================================ | |
| TEXT2VIDEO_HEADERS = { | |
| 'User-Agent': "okhttp/5.1.0", | |
| 'Accept-Encoding': "gzip", | |
| 'authorization': "eyJzdWIiOiIyMzQyZmczNHJ0MzR0MzQiLCJuYW1lIjoiSm9obiIsImV4cCI6MTczNTY4OTYwMH0=", | |
| 'sign': "68d6165b72a7f2d8d17b0dc6fe9691abdf77c583", | |
| 'pt': "", | |
| 'v': "72", | |
| 'deviceid': "1b5336ed0297604a" | |
| } | |
| def generate_ai_video(): | |
| prompt = request.args.get("prompt") | |
| platform = "ai-video-generator" | |
| if not prompt: | |
| return api_response(False, platform, error="Prompt is required") | |
| # NSFW Check | |
| try: | |
| nsfw_res = requests.post( | |
| "https://text2video.aritek.app/nsfw", | |
| data={'prompt': prompt, 'ctry_target': 'others', 'versionCode': '72', | |
| 'deviceID': '1b5336ed0297604a', 'isPremium': '0'}, | |
| headers=TEXT2VIDEO_HEADERS, | |
| timeout=15 | |
| ) | |
| nsfw_data = nsfw_res.json() | |
| if nsfw_data.get('code') != 0 or not nsfw_data.get('success'): | |
| return api_response(False, platform, error="NSFW check failed") | |
| if nsfw_data.get('data', [{}])[0].get('nsfw'): | |
| return api_response(False, platform, error="Prompt flagged as NSFW") | |
| except Exception as e: | |
| return api_response(False, platform, error=f"NSFW error: {str(e)}") | |
| # Generate Video Key | |
| try: | |
| headers_json = TEXT2VIDEO_HEADERS.copy() | |
| headers_json['content-type'] = "application/json; charset=utf-8" | |
| payload = { | |
| "ai_sound": 1, | |
| "aspect_ratio": "auto", | |
| "ctry_target": "others", | |
| "deviceID": "1b5336ed0297604a", | |
| "isPremium": 0, | |
| "prompt": prompt, | |
| "used": [], | |
| "versionCode": 72 | |
| } | |
| res = requests.post( | |
| "https://text2video.aritek.app/txt2videov3", | |
| data=json.dumps(payload), | |
| headers=headers_json, | |
| timeout=15 | |
| ) | |
| data = res.json() | |
| if data.get('code') != 0: | |
| return api_response(False, platform, error="Video generation failed") | |
| video_key = data.get("key") | |
| if not video_key: | |
| return api_response(False, platform, error="No video key received") | |
| except Exception as e: | |
| return api_response(False, platform, error=f"Key generation error: {str(e)}") | |
| # Fetch Video URL | |
| for attempt in range(10): | |
| try: | |
| video_res = requests.post( | |
| "https://text2video.aritek.app/video", | |
| data=json.dumps({"keys": [video_key]}), | |
| headers=headers_json, | |
| timeout=15 | |
| ) | |
| video_data = video_res.json() | |
| if video_data.get("code") == 0 and video_data.get("datas"): | |
| video_info = video_data["datas"][0] | |
| video_url = video_info.get("url") | |
| if video_url: | |
| return api_response(True, platform, data={ | |
| "prompt": prompt, | |
| "video_url": video_url, | |
| "filename": urlparse(video_url).path.split("/")[-1], | |
| "safe": video_info.get("safe", "unknown"), | |
| "attempts": attempt + 1 | |
| }) | |
| time.sleep(3) | |
| except: | |
| continue | |
| return api_response(False, platform, error="Video generation timeout") | |
| # ============================================================ | |
| # 3. MAGIC STUDIO AI ART GENERATOR | |
| # ============================================================ | |
| def generate_ai_art(): | |
| prompt = request.args.get("prompt") | |
| platform = "ai-art-generator" | |
| if not prompt: | |
| return api_response(False, platform, error="Prompt is required") | |
| try: | |
| magic_url = "https://ai-api.magicstudio.com/api/ai-art-generator" | |
| magic_headers = { | |
| "user-agent": ua.random, | |
| "accept": "application/json, text/plain, */*", | |
| "origin": "https://magicstudio.com", | |
| "referer": "https://magicstudio.com/ai-art-generator/" | |
| } | |
| magic_data = { | |
| "prompt": prompt, | |
| "output_format": "bytes", | |
| "user_profile_id": "null", | |
| "anonymous_user_id": "8c8fe58b-f1dd-40b8-86ac-a91ea7d7b4c2", | |
| "user_is_subscribed": "false", | |
| "client_id": "pSgX7WgjukXCBoYwDM8G8GLnRRkvAoJlqa5eAVvj95o" | |
| } | |
| res = requests.post(magic_url, data=magic_data, headers=magic_headers, timeout=30) | |
| if res.status_code == 200: | |
| # Convert to base64 for JSON response | |
| img_base64 = base64.b64encode(res.content).decode('utf-8') | |
| return api_response(True, platform, data={ | |
| "prompt": prompt, | |
| "image_base64": img_base64, | |
| "format": "png" | |
| }) | |
| else: | |
| return api_response(False, platform, error=f"API error: {res.status_code}") | |
| except Exception as e: | |
| return api_response(False, platform, error=str(e)) | |
| # RAW IMAGE endpoint | |
| def generate_ai_art_raw(): | |
| prompt = request.args.get("prompt") | |
| if not prompt: | |
| return jsonify({"error": "Prompt required"}), 400 | |
| try: | |
| magic_url = "https://ai-api.magicstudio.com/api/ai-art-generator" | |
| magic_headers = { | |
| "user-agent": ua.random, | |
| "origin": "https://magicstudio.com", | |
| "referer": "https://magicstudio.com/ai-art-generator/" | |
| } | |
| magic_data = { | |
| "prompt": prompt, | |
| "output_format": "bytes", | |
| "anonymous_user_id": "8c8fe58b-f1dd-40b8-86ac-a91ea7d7b4c2", | |
| "client_id": "pSgX7WgjukXCBoYwDM8G8GLnRRkvAoJlqa5eAVvj95o" | |
| } | |
| res = requests.post(magic_url, data=magic_data, headers=magic_headers, timeout=30) | |
| return Response(res.content, mimetype="image/png") | |
| except Exception as e: | |
| return jsonify({"error": str(e)}), 500 | |
| # ============================================================ | |
| # 4. CHATGPT API (with Authentication) | |
| # ============================================================ | |
| CHATGPT_BASE = "https://api.souimagery.fun/v1" | |
| CHATGPT_KEY = "sk-Nm3CRnIJjnHgBc8U9lHgN6ZSGU7UXPh3ROLrlPbAvy6N77AS" | |
| def chatgpt(): | |
| prompt = request.args.get("prompt") or request.args.get("q") or request.args.get("message") | |
| platform = "chatgpt" | |
| if not prompt: | |
| return api_response(False, platform, error="Prompt is required") | |
| try: | |
| headers = { | |
| "Authorization": f"Bearer {CHATGPT_KEY}", | |
| "Content-Type": "application/json", | |
| "User-Agent": ua.random | |
| } | |
| payload = { | |
| "model": "gpt-3.5-turbo", | |
| "messages": [{"role": "user", "content": prompt}], | |
| "temperature": 0.7, | |
| "max_tokens": 2000 | |
| } | |
| res = requests.post( | |
| f"{CHATGPT_BASE}/chat/completions", | |
| headers=headers, | |
| json=payload, | |
| timeout=60 | |
| ) | |
| if res.status_code == 200: | |
| data = res.json() | |
| response_text = data.get("choices", [{}])[0].get("message", {}).get("content", "") | |
| return api_response(True, platform, data={ | |
| "prompt": prompt, | |
| "response": response_text, | |
| "model": data.get("model"), | |
| "usage": data.get("usage") | |
| }) | |
| else: | |
| return api_response(False, platform, error=f"API error: {res.status_code}", extra={"details": res.text}) | |
| except Exception as e: | |
| return api_response(False, platform, error=str(e)) | |
| def chatgpt_models(): | |
| try: | |
| headers = {"Authorization": f"Bearer {CHATGPT_KEY}"} | |
| res = requests.get(f"{CHATGPT_BASE}/models", headers=headers, timeout=10) | |
| return api_response(True, "chatgpt", data=res.json()) | |
| except Exception as e: | |
| return api_response(False, "chatgpt", error=str(e)) | |
| # ============================================================ | |
| # 5. TIKTOK DOWNLOADER (Single) | |
| # ============================================================ | |
| def tiktok_download(): | |
| url = request.args.get("url") | |
| platform = "tiktok" | |
| if not url: | |
| return api_response(False, platform, error="URL is required") | |
| try: | |
| api_url = f"https://tikwm.com/api/?url={url}" | |
| res = requests.get(api_url, headers={"User-Agent": ua.random}, timeout=15) | |
| data = res.json() | |
| if data.get("code") != 0 or not data.get("data"): | |
| return api_response(False, platform, error=data.get("msg", "Failed to fetch")) | |
| video_data = data["data"] | |
| return api_response(True, platform, data={ | |
| "title": video_data.get("title"), | |
| "cover": video_data.get("cover"), | |
| "duration": video_data.get("duration"), | |
| "play_count": video_data.get("play_count"), | |
| "digg_count": video_data.get("digg_count"), | |
| "comment_count": video_data.get("comment_count"), | |
| "share_count": video_data.get("share_count"), | |
| "download_count": video_data.get("download_count"), | |
| "author": video_data.get("author"), | |
| "video_no_watermark": video_data.get("play"), | |
| "video_watermark": video_data.get("wmplay"), | |
| "music": video_data.get("music"), | |
| "music_title": video_data.get("music_info", {}).get("title"), | |
| "music_author": video_data.get("music_info", {}).get("author"), | |
| "images": video_data.get("images", []) | |
| }) | |
| except Exception as e: | |
| return api_response(False, platform, error=str(e)) | |
| # ============================================================ | |
| # 6. ALL-IN-ONE SOCIAL MEDIA DOWNLOADER | |
| # ============================================================ | |
| def detect_platform(url): | |
| url = url.lower() | |
| if "tiktok.com" in url: | |
| return "tiktok" | |
| if "instagram.com" in url: | |
| return "instagram" | |
| if "facebook.com" in url or "fb.watch" in url or "fb.com" in url: | |
| return "facebook" | |
| if "youtube.com" in url or "youtu.be" in url: | |
| return "youtube" | |
| if "snapchat.com" in url: | |
| return "snapchat" | |
| if "pinterest.com" in url or "pin.it" in url: | |
| return "pinterest" | |
| if "spotify.com" in url: | |
| return "spotify" | |
| if "twitter.com" in url or "x.com" in url: | |
| return "twitter" | |
| if "reddit.com" in url: | |
| return "reddit" | |
| if "likee.com" in url or "likee.video" in url: | |
| return "likee" | |
| if "capcut.com" in url: | |
| return "capcut" | |
| if "threads.net" in url: | |
| return "threads" | |
| return "unknown" | |
| def extract_download_url(video_data): | |
| """Extract direct download URL from various API responses""" | |
| if isinstance(video_data, dict): | |
| if "video" in video_data: | |
| return video_data["video"] | |
| if "url" in video_data: | |
| return video_data["url"] | |
| if "data" in video_data: | |
| if isinstance(video_data["data"], dict): | |
| if "video" in video_data["data"]: | |
| return video_data["data"]["video"] | |
| if "url" in video_data["data"]: | |
| return video_data["data"]["url"] | |
| if "play" in video_data["data"]: | |
| return video_data["data"]["play"] | |
| if "play" in video_data: | |
| return video_data["play"] | |
| if "hd_video" in video_data: | |
| return video_data["hd_video"] | |
| if "nowatermark" in video_data: | |
| return video_data["nowatermark"] | |
| if "images" in video_data and video_data["images"]: | |
| return video_data["images"][0] | |
| if "music" in video_data: | |
| return video_data["music"] | |
| if "medias" in video_data: | |
| return video_data["medias"] | |
| return None | |
| def fetch_from_providers(url, platform): | |
| """Try multiple API providers""" | |
| encoded = quote_plus(url) | |
| providers = { | |
| "tiktok": [ | |
| f"https://tikwm.com/api/?url={url}", | |
| f"https://www.velyn.biz.id/api/downloader/tiktok?url={encoded}", | |
| f"https://apis.prexzyvilla.site/download/tiktok?url={encoded}", | |
| f"https://api.davidcyriltech.my.id/tiktok?url={url}" | |
| ], | |
| "instagram": [ | |
| f"https://api.davidcyriltech.my.id/instagram?url={url}", | |
| f"https://apis.prexzyvilla.site/download/ig2?url={encoded}", | |
| f"https://www.velyn.biz.id/api/downloader/instagram?url={encoded}" | |
| ], | |
| "facebook": [ | |
| f"https://www.velyn.biz.id/api/downloader/facebook?url={encoded}", | |
| f"https://apis.prexzyvilla.site/download/facebook?url={encoded}", | |
| f"https://api.davidcyriltech.my.id/facebook?url={url}" | |
| ], | |
| "youtube": [ | |
| f"https://ytdl.hideme.eu.org/{url}", | |
| f"https://apis.prexzyvilla.site/download/ytdl?url={encoded}", | |
| f"https://api.davidcyriltech.my.id/youtube?url={url}" | |
| ], | |
| "pinterest": [ | |
| f"https://apis.prexzyvilla.site/download/pinterest?url={encoded}", | |
| f"https://api.davidcyriltech.my.id/pinterest?url={url}" | |
| ], | |
| "spotify": [ | |
| f"https://spotify-down.apis-bj-devs.workers.dev/?url={url}", | |
| f"https://apis.prexzyvilla.site/download/spotify?url={encoded}" | |
| ], | |
| "twitter": [ | |
| f"https://apis.prexzyvilla.site/download/twitter?url={encoded}", | |
| f"https://www.velyn.biz.id/api/downloader/twitter?url={encoded}" | |
| ], | |
| "threads": [ | |
| f"https://apis.prexzyvilla.site/download/threads?url={encoded}" | |
| ], | |
| "capcut": [ | |
| f"https://apis.prexzyvilla.site/download/capcut?url={encoded}" | |
| ], | |
| "likee": [ | |
| f"https://apis.prexzyvilla.site/download/likee?url={encoded}" | |
| ], | |
| "reddit": [ | |
| f"https://apis.prexzyvilla.site/download/reddit?url={encoded}" | |
| ] | |
| } | |
| target_providers = providers.get(platform, providers.get("tiktok", [])) | |
| for api_url in target_providers[:5]: | |
| try: | |
| res = requests.get(api_url, headers={"User-Agent": ua.random}, timeout=15) | |
| if res.status_code == 200: | |
| data = res.json() | |
| if data and (data.get("status") or data.get("code") == 0 or data.get("data")): | |
| return data | |
| except: | |
| continue | |
| return None | |
| def all_in_one_download(): | |
| url = request.args.get("url") | |
| platform = request.args.get("platform", "auto") | |
| if not url: | |
| return api_response(False, "downloader", error="URL is required") | |
| if platform == "auto": | |
| platform = detect_platform(url) | |
| try: | |
| result = fetch_from_providers(url, platform) | |
| if result: | |
| download_url = extract_download_url(result) | |
| if download_url: | |
| if isinstance(download_url, list): | |
| return api_response(True, platform, data={ | |
| "url": url, | |
| "download_urls": download_url, | |
| "count": len(download_url) | |
| }) | |
| else: | |
| return api_response(True, platform, data={ | |
| "url": url, | |
| "download_url": download_url | |
| }) | |
| else: | |
| return api_response(True, platform, data={ | |
| "url": url, | |
| "raw_data": result | |
| }) | |
| else: | |
| return api_response(False, platform, error="Unable to fetch media from any provider") | |
| except Exception as e: | |
| return api_response(False, platform, error=str(e)) | |
| # Platform-specific endpoints | |
| def tiktok_download_v2(): | |
| url = request.args.get("url") | |
| return tiktok_download() if url else api_response(False, "tiktok", error="URL required") | |
| def instagram_download(): | |
| url = request.args.get("url") | |
| if not url: | |
| return api_response(False, "instagram", error="URL required") | |
| result = fetch_from_providers(url, "instagram") | |
| if result: | |
| download_url = extract_download_url(result) | |
| return api_response(True, "instagram", data={"url": url, "download_url": download_url or result}) | |
| return api_response(False, "instagram", error="Download failed") | |
| def facebook_download(): | |
| url = request.args.get("url") | |
| if not url: | |
| return api_response(False, "facebook", error="URL required") | |
| result = fetch_from_providers(url, "facebook") | |
| if result: | |
| download_url = extract_download_url(result) | |
| return api_response(True, "facebook", data={"url": url, "download_url": download_url or result}) | |
| return api_response(False, "facebook", error="Download failed") | |
| def youtube_download(): | |
| url = request.args.get("url") | |
| if not url: | |
| return api_response(False, "youtube", error="URL required") | |
| result = fetch_from_providers(url, "youtube") | |
| if result: | |
| download_url = extract_download_url(result) | |
| return api_response(True, "youtube", data={"url": url, "download_url": download_url or result}) | |
| return api_response(False, "youtube", error="Download failed") | |
| # ============================================================ | |
| # 7. FREE FIRE INFO | |
| # ============================================================ | |
| def freefire_info(): | |
| uid = request.args.get("uid") | |
| platform = "freefire" | |
| if not uid: | |
| return api_response(False, platform, error="UID is required") | |
| try: | |
| url = f'https://freefirejornal.com/en/perfil-jogador-freefire/{uid}/' | |
| headers = {"User-Agent": ua.random} | |
| req = requests.get(url, headers=headers, timeout=10) | |
| if req.status_code != 200: | |
| return api_response(False, platform, error="Failed to fetch data") | |
| soup = BeautifulSoup(req.text, 'html.parser') | |
| div_tag = soup.find("div", class_="jg-player-infos") | |
| if not div_tag: | |
| return api_response(False, platform, error="Invalid UID") | |
| data = {} | |
| for li in div_tag.find_all("li"): | |
| strong = li.find("strong") | |
| if strong: | |
| label = re.sub(r'[^\x00-\x7F]+', '', strong.get_text(strip=True).replace(":", "")).strip() | |
| value = li.get_text(strip=True).replace(strong.get_text(strip=True), "").strip() | |
| if label and value: | |
| if "Likes" in label: | |
| value = value.split("β")[0].strip() | |
| data[label] = value | |
| return api_response(True, platform, data=data) | |
| except Exception as e: | |
| return api_response(False, platform, error=str(e)) | |
| # ============================================================ | |
| # 8. INSTAGRAM INFO | |
| # ============================================================ | |
| def instagram_info(): | |
| username = request.args.get("username") | |
| platform = "instagram" | |
| if not username: | |
| return api_response(False, platform, error="Username required") | |
| try: | |
| url = f"https://www.instagram.com/{username}/?__a=1&__d=dis" | |
| headers = {"User-Agent": ua.random} | |
| req = requests.get(url, headers=headers, timeout=10) | |
| if req.status_code == 200: | |
| user = req.json().get("graphql", {}).get("user", {}) | |
| return api_response(True, platform, data={ | |
| "username": user.get("username"), | |
| "full_name": user.get("full_name"), | |
| "followers": user.get("edge_followed_by", {}).get("count", 0), | |
| "following": user.get("edge_follow", {}).get("count", 0), | |
| "posts": user.get("edge_owner_to_timeline_media", {}).get("count", 0), | |
| "profile_pic": user.get("profile_pic_url_hd", ""), | |
| "is_private": user.get("is_private", False), | |
| "is_verified": user.get("is_verified", False), | |
| "bio": user.get("biography", ""), | |
| "external_url": user.get("external_url", ""), | |
| "business_category": user.get("business_category_name", "") | |
| }) | |
| # Fallback scrape | |
| url = f"https://www.instagram.com/{username}/" | |
| req = requests.get(url, headers=headers, timeout=10) | |
| soup = BeautifulSoup(req.text, 'html.parser') | |
| meta_desc = soup.find("meta", property="og:description") | |
| if meta_desc: | |
| desc = meta_desc.get("content", "") | |
| followers = re.search(r'([\d,]+) Followers', desc) | |
| following = re.search(r'([\d,]+) Following', desc) | |
| posts = re.search(r'([\d,]+) Posts', desc) | |
| return api_response(True, platform, data={ | |
| "username": username, | |
| "followers": followers.group(1).replace(',', '') if followers else "0", | |
| "following": following.group(1).replace(',', '') if following else "0", | |
| "posts": posts.group(1).replace(',', '') if posts else "0" | |
| }) | |
| return api_response(False, platform, error="User not found") | |
| except Exception as e: | |
| return api_response(False, platform, error=str(e)) | |
| # ============================================================ | |
| # 9. TIKTOK INFO | |
| # ============================================================ | |
| def tiktok_info(): | |
| username = request.args.get("username") | |
| platform = "tiktok" | |
| if not username: | |
| return api_response(False, platform, error="Username required") | |
| try: | |
| url = f"https://www.tiktok.com/@{username}" | |
| headers = {"User-Agent": ua.random} | |
| req = scraper.get(url, headers=headers, timeout=10) | |
| soup = BeautifulSoup(req.text, 'html.parser') | |
| data = {"username": username} | |
| # Try to parse JSON from script tags | |
| scripts = soup.find_all("script", {"type": "application/json"}) | |
| for script in scripts: | |
| if script.string and '"UserModule"' in script.string: | |
| try: | |
| json_data = json.loads(script.string) | |
| if "UserModule" in json_data: | |
| user = json_data["UserModule"]["users"].get(username, {}) | |
| data = { | |
| "username": username, | |
| "nickname": user.get("nickname", ""), | |
| "followers": user.get("stats", {}).get("followerCount", 0), | |
| "following": user.get("stats", {}).get("followingCount", 0), | |
| "likes": user.get("stats", {}).get("heartCount", 0), | |
| "videos": user.get("stats", {}).get("videoCount", 0), | |
| "verified": user.get("verified", False), | |
| "avatar": user.get("avatarMedium", ""), | |
| "signature": user.get("signature", ""), | |
| "bio_link": user.get("bioLink", {}).get("link", "") | |
| } | |
| break | |
| except: | |
| pass | |
| # Fallback to meta tags | |
| if "followers" not in data: | |
| meta_desc = soup.find("meta", property="og:description") | |
| if meta_desc: | |
| desc = meta_desc.get("content", "") | |
| followers = re.search(r'([\d,]+) Followers', desc) | |
| likes = re.search(r'([\d,]+) Likes', desc) | |
| data["followers"] = followers.group(1).replace(',', '') if followers else "0" | |
| data["likes"] = likes.group(1).replace(',', '') if likes else "0" | |
| return api_response(True, platform, data=data) | |
| except Exception as e: | |
| return api_response(False, platform, error=str(e)) | |
| # ============================================================ | |
| # 10. GITHUB INFO | |
| # ============================================================ | |
| def github_info(): | |
| username = request.args.get("username") | |
| platform = "github" | |
| if not username: | |
| return api_response(False, platform, error="Username required") | |
| try: | |
| url = f"https://api.github.com/users/{username}" | |
| headers = {"User-Agent": ua.random} | |
| req = requests.get(url, headers=headers, timeout=10) | |
| if req.status_code != 200: | |
| return api_response(False, platform, error="User not found") | |
| user = req.json() | |
| return api_response(True, platform, data={ | |
| "username": user.get("login"), | |
| "name": user.get("name"), | |
| "followers": user.get("followers", 0), | |
| "following": user.get("following", 0), | |
| "public_repos": user.get("public_repos", 0), | |
| "public_gists": user.get("public_gists", 0), | |
| "avatar": user.get("avatar_url", ""), | |
| "bio": user.get("bio", ""), | |
| "blog": user.get("blog", ""), | |
| "location": user.get("location", ""), | |
| "company": user.get("company", ""), | |
| "twitter": user.get("twitter_username", ""), | |
| "join_date": user.get("created_at", ""), | |
| "hireable": user.get("hireable", False) | |
| }) | |
| except Exception as e: | |
| return api_response(False, platform, error=str(e)) | |
| # ============================================================ | |
| # HOME & DOCS | |
| # ============================================================ | |
| def home(): | |
| return jsonify({ | |
| "name": "π₯ SUPER MULTI-API v2.0", | |
| "developer": DEVELOPER, | |
| "telegram": TELEGRAM, | |
| "version": "2.0.0", | |
| "total_endpoints": 20, | |
| "categories": { | |
| "ai_generation": [ | |
| {"endpoint": "/api/v1/3d-logo", "method": "GET", "params": "prompt"}, | |
| {"endpoint": "/api/v1/ai-video", "method": "GET", "params": "prompt"}, | |
| {"endpoint": "/api/v1/ai-art", "method": "GET", "params": "prompt"}, | |
| {"endpoint": "/api/v1/ai-art/raw", "method": "GET", "params": "prompt", "note": "Returns raw PNG image"} | |
| ], | |
| "chatgpt": [ | |
| {"endpoint": "/api/v1/chatgpt", "method": "GET", "params": "prompt/q/message"}, | |
| {"endpoint": "/api/v1/chatgpt/models", "method": "GET", "params": "none"} | |
| ], | |
| "social_downloaders": [ | |
| {"endpoint": "/api/v1/download", "method": "GET", "params": "url", "note": "Auto-detect platform"}, | |
| {"endpoint": "/api/v1/tiktok", "method": "GET", "params": "url"}, | |
| {"endpoint": "/api/v1/tiktok/download", "method": "GET", "params": "url"}, | |
| {"endpoint": "/api/v1/instagram/download", "method": "GET", "params": "url"}, | |
| {"endpoint": "/api/v1/facebook/download", "method": "GET", "params": "url"}, | |
| {"endpoint": "/api/v1/youtube/download", "method": "GET", "params": "url"} | |
| ], | |
| "social_info": [ | |
| {"endpoint": "/api/v1/freefire", "method": "GET", "params": "uid"}, | |
| {"endpoint": "/api/v1/instagram", "method": "GET", "params": "username"}, | |
| {"endpoint": "/api/v1/tiktok/info", "method": "GET", "params": "username"}, | |
| {"endpoint": "/api/v1/github", "method": "GET", "params": "username"} | |
| ] | |
| }, | |
| "supported_platforms": [ | |
| "TikTok", "Instagram", "Facebook", "YouTube", "Pinterest", | |
| "Spotify", "Twitter/X", "Reddit", "Threads", "CapCut", | |
| "Likee", "Free Fire", "GitHub" | |
| ] | |
| }) | |
| def docs(): | |
| return jsonify({ | |
| "documentation": "Complete API Documentation", | |
| "developer": DEVELOPER, | |
| "telegram": TELEGRAM, | |
| "base_url": request.host_url.rstrip('/'), | |
| "example_requests": { | |
| "3d_logo": f"{request.host_url}api/v1/3d-logo?prompt=iron man 3d cartoon", | |
| "ai_video": f"{request.host_url}api/v1/ai-video?prompt=a beautiful sunset over ocean", | |
| "ai_art": f"{request.host_url}api/v1/ai-art?prompt=dragon in sky", | |
| "chatgpt": f"{request.host_url}api/v1/chatgpt?prompt=what is python", | |
| "tiktok_download": f"{request.host_url}api/v1/tiktok?url=https://vt.tiktok.com/ZSjXxxxxx/", | |
| "instagram_info": f"{request.host_url}api/v1/instagram?username=instagram", | |
| "freefire": f"{request.host_url}api/v1/freefire?uid=123456789" | |
| } | |
| }) | |
| # ============================================================ | |
| # MAIN | |
| # ============================================================ | |
| if __name__ == "__main__": | |
| print(""" | |
| ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| β π₯ SUPER MULTI-API v2.0 π₯ β | |
| β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ£ | |
| β Developer: WASIF ALI β | |
| β Telegram: @THE_FREE_HACKS β | |
| β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ£ | |
| β Active Endpoints: 20+ β | |
| β AI Generation: 3D Logo, AI Video, AI Art β | |
| β ChatGPT: Chat, Models β | |
| β Downloaders: TikTok, IG, FB, YT, Pinterest, Spotify & more β | |
| β Info APIs: Free Fire, Instagram, TikTok, GitHub β | |
| β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ£ | |
| β Visit /docs for full documentation β | |
| ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| """) | |
| app.run(host="0.0.0.0", port=5000, debug=True) |