Spaces:
Runtime error
Runtime error
Update app.py
Browse files20 unmodified lines21222324242525262728293031323320 unmodified lines for link in soup.find_all('a'): file_url = urllib.parse.urljoin(base_url, link.get('href')) local_filename = urllib.parse.urlparse(file_url).path.split('/')[-1] if local_filename: # add this line link['href'] = local_filename download_file(file_url, local_filename) link['href'] = local_filename download_file(file_url, local_filename) with open("index.html", "w") as file: file.write(str(soup))
def list_files(directory_path='.'): return [f for f in os.listdir(directory_path) if os.path.isfile(os.path.join(directory_path, f))]app.py+4-2