Workpam commited on
Commit
51cbc6a
·
verified ·
1 Parent(s): 21f9a10

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -2
app.py CHANGED
@@ -9,16 +9,41 @@ import shutil
9
  from io import BytesIO
10
  import threading
11
  from datetime import datetime
12
- from concurrent.futures import ThreadPoolExecutor, as_completed
13
  import time
14
  import random
15
  import cloudscraper
16
  from urllib.parse import urlparse
 
17
  from selenium import webdriver
18
  from selenium.webdriver.chrome.options import Options
19
  from selenium.webdriver.chrome.service import Service
20
- from webdriver_manager.chrome import ChromeDriverManage
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
 
22
  # --- Utility Functions ---
23
  def process_url_images(data, fmt, w, h):
24
  return process_and_zip(data, fmt, w, h)
 
9
  from io import BytesIO
10
  import threading
11
  from datetime import datetime
12
+ from concurrent.futures import ThreadPoolExecutor
13
  import time
14
  import random
15
  import cloudscraper
16
  from urllib.parse import urlparse
17
+ from concurrent.futures import ThreadPoolExecutor, as_completed
18
  from selenium import webdriver
19
  from selenium.webdriver.chrome.options import Options
20
  from selenium.webdriver.chrome.service import Service
21
+ from webdriver_manager.chrome import ChromeDriverManager
22
+
23
+ driver = webdriver.Chrome(
24
+ service=Service(ChromeDriverManager().install()),
25
+ options=chrome_opts
26
+ )
27
+
28
+ stop_event = threading.Event()
29
+ cpu_cores = os.cpu_count() or 4
30
+
31
+ USER_AGENTS = [
32
+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
33
+ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)",
34
+ "Mozilla/5.0 (Linux; Android 10)",
35
+ "Mozilla/5.0 (iPhone; CPU iPhone OS 14_6 like Mac OS X)"
36
+ ]
37
+
38
+ PROXY_LIST = [
39
+ "http://user:pass@proxy1:port",
40
+ "http://user:pass@proxy2:port",
41
+ ]
42
+
43
+ FAILED_LOG_PATH = "failed_downloads.txt"
44
+ BLOCKED_SITES = ["bigw.com.au"]
45
 
46
+ session = requests.Session()
47
  # --- Utility Functions ---
48
  def process_url_images(data, fmt, w, h):
49
  return process_and_zip(data, fmt, w, h)