import os import sys sys.stdout.reconfigure(encoding='utf-8') def list_mkv_files(directory): """Lấy danh sách các file .mkv trong thư mục.""" mkv_files = [] for root, _, files in os.walk(directory): for file in files: if file.endswith('.mkv'): mkv_files.append(f'python3 leech.py https://www.fshare.vn/file/{file}') return mkv_files # Đặt thư mục cần kiểm tra directory = os.path.join(os.getcwd(), "downloaded") print(directory) # Hoặc: directory = os.path.join(os.getcwd(), "downloaded") # Lấy danh sách file .mkv mkv_files = list_mkv_files(directory) # In danh sách file if mkv_files: print("Danh sách file .mkv:") for file in mkv_files: print(file) else: print("Không tìm thấy file .mkv nào trong thư mục.")