import os
import requests
from flask import Flask, request, render_template_string, jsonify
# ------ SETTINGS ------
API_KEYS = {
'doodstream': '204936hck7bjv63ovp1n22', # DoodStream API KEY
'mixdrop_email': 'samguku05@gmail.com', # MixDrop Email
'mixdrop_key': 'nJZU2JaGJHMANjc7j2iz', # MixDrop API KEY
'voe': 'VCbNAQXtkxmBURB18IwXSTXbOeeMEMM1OVgRQWKRki2HY0qw4Od0deOnJJAXFw4i', # VOE API KEY
'netu': '6b48198719479ed1233e87f623a1b7e3', # Netu API KEY
'earnvids': '40213e1efmlkqe6idr08', # EarnVids API KEY
}
# ----------------------
app = Flask(__name__)
HTML = """
Remote Video Uploader
Remote video từng host
"""
@app.route('/')
def index():
return render_template_string(HTML)
@app.route('/remote', methods=['POST'])
def remote():
data = request.get_json()
host = data.get('host')
link = data.get('url')
try:
if host == 'doodstream':
key = API_KEYS.get('doodstream')
api = f"https://doodapi.co/api/upload/url?key={key}&url={link}"
res = requests.get(api, timeout=15)
obj = res.json()
filecode = obj.get('result', {}).get('filecode')
if filecode:
return jsonify(success=True, result=f"https://dood.to/d/{filecode}")
return jsonify(success=False, error=obj.get('msg', 'Lỗi'))
elif host == 'mixdrop':
email = API_KEYS.get('mixdrop_email')
key = API_KEYS.get('mixdrop_key')
api = f"https://api.mixdrop.ag/remoteupload?email={email}&key={key}&url={link}"
res = requests.get(api, timeout=15)
obj = res.json()
url = obj.get('result', {}).get('url')
if url:
return jsonify(success=True, result=url)
return jsonify(success=False, error=obj.get('msg', 'Lỗi'))
elif host == 'voe':
key = API_KEYS.get('voe')
api = f"https://voe.sx/api/upload/url?key={key}&url={link}"
res = requests.get(api, timeout=15)
obj = res.json()
filecode = obj.get('result', {}).get('file_code')
if filecode:
return jsonify(success=True, result=f"https://voe.sx/{filecode}")
return jsonify(success=False, error=obj.get('msg', 'Lỗi'))
elif host == 'netu':
key = API_KEYS.get('netu')
# Step 1: remote upload
api = f"https://netu.tv/api/file/remotedl?key={key}&url={link}"
res = requests.post(api, timeout=15)
obj = res.json()
id_map = obj.get('result', {}).get('id')
if id_map:
rid = list(id_map.keys())[0]
# Step 2: poll status
import time
for _ in range(12): # Poll 12 lần, mỗi lần cách 3s
time.sleep(3)
status_api = f"https://netu.tv/api/file/status_remotedl?key={key}&id={rid}"
sres = requests.get(status_api, timeout=15)
sobj = sres.json()
fobj = sobj.get('result', {}).get('files', {}).get(rid)
if fobj and fobj.get('status') == 'successful' and fobj.get('file_code'):
return jsonify(success=True, result=f"https://waaw.to/f/{fobj['file_code']}")
return jsonify(success=False, error="Timeout chờ remote Netu!")
return jsonify(success=False, error=obj.get('msg', 'Lỗi'))
elif host == 'earnvids':
key = API_KEYS.get('earnvids')
api = f"https://earnvidsapi.com/api/upload/url?key={key}&url={link}"
res = requests.get(api, timeout=15)
obj = res.json()
filecode = obj.get('result', {}).get('filecode')
if filecode:
return jsonify(success=True, result=f"https://xvs.tt/{filecode}.html")
return jsonify(success=False, error=obj.get('msg', 'Lỗi'))
else:
return jsonify(success=False, error='Không đúng host!')
except Exception as e:
return jsonify(success=False, error=str(e))
if __name__ == '__main__':
app.run(host="0.0.0.0", port=5000, debug=True)