Update download.py
This commit is contained in:
parent
4451fb81e6
commit
75dfd73a34
@ -1,4 +1,3 @@
|
||||
|
||||
import requests
|
||||
import re
|
||||
import os
|
||||
@ -17,15 +16,13 @@ def get_folders():
|
||||
response = requests.get(BASE_URL, timeout=10)
|
||||
response.raise_for_status()
|
||||
|
||||
# Parse HTML to find directory links
|
||||
soup = BeautifulSoup(response.text, 'html.parser')
|
||||
folders = []
|
||||
|
||||
# Look for links that end with '/' (directories)
|
||||
for link in soup.find_all('a', href=True):
|
||||
href = link['href']
|
||||
if href.endswith('/') and href not in ['/', '../']:
|
||||
# Decode URL-encoded folder names
|
||||
|
||||
folder_name = unquote(href)
|
||||
folders.append(folder_name)
|
||||
|
||||
@ -78,13 +75,11 @@ def download_folder(folder):
|
||||
urljoin(BASE_URL, folder)
|
||||
]
|
||||
|
||||
# Run wget
|
||||
result = subprocess.run(cmd, capture_output=True, text=True)
|
||||
|
||||
if result.returncode == 0:
|
||||
print(f"✓ Completed download of: {clean_folder}")
|
||||
|
||||
# Change ownership of downloaded folder
|
||||
if os.path.exists(clean_folder):
|
||||
change_ownership(clean_folder)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user