Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -160,11 +160,16 @@ def download_engine(link, task_id):
|
|
| 160 |
no_transfer_count = 0
|
| 161 |
loop_counter = 0
|
| 162 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 163 |
while True:
|
| 164 |
time.sleep(5)
|
| 165 |
output = get_mega_details()
|
| 166 |
lower_output = output.lower()
|
| 167 |
|
|
|
|
| 168 |
if "bandwidth quota exceeded" in lower_output or "paused" in lower_output or "retrying" in lower_output:
|
| 169 |
print("\n🚨 KOTA/IP BAN TESPİT EDİLDİ! Değiştiriliyor...", flush=True)
|
| 170 |
os.system("pkill mega-get")
|
|
@@ -174,6 +179,27 @@ def download_engine(link, task_id):
|
|
| 174 |
time.sleep(60)
|
| 175 |
break
|
| 176 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
if "no active transfers" in lower_output:
|
| 178 |
loop_counter += 1
|
| 179 |
if loop_counter > 3:
|
|
@@ -188,6 +214,7 @@ def download_engine(link, task_id):
|
|
| 188 |
else:
|
| 189 |
no_transfer_count = 0
|
| 190 |
|
|
|
|
| 191 |
lines = output.split('\n')
|
| 192 |
for line in lines:
|
| 193 |
if "TRANSFERRING" in line or "%" in line:
|
|
@@ -219,7 +246,7 @@ def download_engine(link, task_id):
|
|
| 219 |
|
| 220 |
except Exception as e:
|
| 221 |
print(f"🔥 KRİTİK HATA: {e}", flush=True)
|
| 222 |
-
|
| 223 |
@app.route('/process', methods=['POST'])
|
| 224 |
def process():
|
| 225 |
data = request.json
|
|
|
|
| 160 |
no_transfer_count = 0
|
| 161 |
loop_counter = 0
|
| 162 |
|
| 163 |
+
# 🔴 ZOMBİ KORUMASI: Senin "Hız düşerse şokla" fikrinin kodlanmış hali
|
| 164 |
+
previous_output = ""
|
| 165 |
+
stuck_counter = 0
|
| 166 |
+
|
| 167 |
while True:
|
| 168 |
time.sleep(5)
|
| 169 |
output = get_mega_details()
|
| 170 |
lower_output = output.lower()
|
| 171 |
|
| 172 |
+
# 1. Klasik Limit ve Ban Kontrolü
|
| 173 |
if "bandwidth quota exceeded" in lower_output or "paused" in lower_output or "retrying" in lower_output:
|
| 174 |
print("\n🚨 KOTA/IP BAN TESPİT EDİLDİ! Değiştiriliyor...", flush=True)
|
| 175 |
os.system("pkill mega-get")
|
|
|
|
| 179 |
time.sleep(60)
|
| 180 |
break
|
| 181 |
|
| 182 |
+
# 2. Hız Darboğazı ve Zombi Dosya Şoklama (YENİ EKLENEN KISIM)
|
| 183 |
+
if "active" in lower_output:
|
| 184 |
+
# Eğer ekrandaki veri bir önceki saniyeyle tamamen aynıysa (Hız 0'a düştüyse)
|
| 185 |
+
if output == previous_output:
|
| 186 |
+
stuck_counter += 1
|
| 187 |
+
print(f"⚠️ Uyarı: Hız Kesildi! Takılma tespit edildi (Şoka son {6 - stuck_counter} adım)", flush=True)
|
| 188 |
+
if stuck_counter >= 6: # 30 Saniye boyunca milim ilerlemediyse
|
| 189 |
+
print("\n🧟 ZOMBİ DOSYA VURULDU! Mega hızı kesti, IP'ye şok veriliyor...", flush=True)
|
| 190 |
+
os.system("pkill mega-get")
|
| 191 |
+
rotate_warp_ip()
|
| 192 |
+
safe_mega_reset()
|
| 193 |
+
stuck_counter = 0
|
| 194 |
+
break # İç döngüyü kırar, taze IP ile mega-get'i tekrar tetikler
|
| 195 |
+
else:
|
| 196 |
+
# Akış devam ediyorsa sayacı sıfırla
|
| 197 |
+
stuck_counter = 0
|
| 198 |
+
previous_output = output
|
| 199 |
+
else:
|
| 200 |
+
stuck_counter = 0
|
| 201 |
+
|
| 202 |
+
# 3. İndirme Bitiş Kontrolü
|
| 203 |
if "no active transfers" in lower_output:
|
| 204 |
loop_counter += 1
|
| 205 |
if loop_counter > 3:
|
|
|
|
| 214 |
else:
|
| 215 |
no_transfer_count = 0
|
| 216 |
|
| 217 |
+
# Terminale Temiz Log Basma
|
| 218 |
lines = output.split('\n')
|
| 219 |
for line in lines:
|
| 220 |
if "TRANSFERRING" in line or "%" in line:
|
|
|
|
| 246 |
|
| 247 |
except Exception as e:
|
| 248 |
print(f"🔥 KRİTİK HATA: {e}", flush=True)
|
| 249 |
+
|
| 250 |
@app.route('/process', methods=['POST'])
|
| 251 |
def process():
|
| 252 |
data = request.json
|