| | from flask import Flask, request, jsonify, send_file |
| | import time |
| | import random |
| | import undetected_chromedriver as uc |
| |
|
| | app = Flask(__name__) |
| |
|
| | |
| | def get_random_proxy(): |
| | try: |
| | with open('proxy.txt', 'r') as f: |
| | proxies = [line.strip() for line in f if line.strip()] |
| | return random.choice(proxies) |
| | except: |
| | return None |
| |
|
| | @app.route('/') |
| | def index(): |
| | return send_file('index.html') |
| |
|
| | @app.route('/inject', methods=['POST']) |
| | def inject(): |
| | data = request.get_json() |
| | link = data.get('link') |
| | jumlah = int(data.get('jumlah')) |
| |
|
| | for _ in range(jumlah): |
| | options = uc.ChromeOptions() |
| | options.add_argument('--no-sandbox') |
| | options.add_argument('--disable-dev-shm-usage') |
| | options.add_argument('--disable-blink-features=AutomationControlled') |
| | options.add_argument( |
| | 'user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114 Safari/537.36' |
| | ) |
| |
|
| | |
| | proxy = get_random_proxy() |
| | if proxy: |
| | options.add_argument(f'--proxy-server=http://{proxy}') |
| | print(f'[+] Pakai proxy: {proxy}') |
| |
|
| | driver = uc.Chrome(options=options, headless=True) |
| |
|
| | try: |
| | driver.get(link) |
| | time.sleep(4) |
| |
|
| | |
| | try: |
| | driver.execute_script(""" |
| | const video = document.querySelector('video'); |
| | if(video){ video.play(); } |
| | """) |
| | time.sleep(10) |
| | except Exception as e: |
| | print("[!] Gagal play:", e) |
| |
|
| | except Exception as e: |
| | print("[!] Gagal buka link:", e) |
| | finally: |
| | driver.quit() |
| |
|
| | return jsonify({"status": "success", "sent": jumlah}) |
| |
|
| | if __name__ == '__main__': |
| | app.run(host='0.0.0.0', port=7860) |