Spaces:
Runtime error
Runtime error
Update scraping.py
Browse files- scraping.py +6 -6
scraping.py
CHANGED
|
@@ -11,19 +11,19 @@ import tempfile
|
|
| 11 |
|
| 12 |
def get_mp3(song_title):
|
| 13 |
# Set the download directory to the "music" subfolder within the current directory
|
| 14 |
-
download_directory = os.path.join(os.getcwd(), "music")
|
| 15 |
-
os.makedirs(download_directory, exist_ok=True)
|
| 16 |
|
| 17 |
# Set up Chrome options
|
| 18 |
options = Options()
|
| 19 |
options.add_argument("--headless")
|
| 20 |
options.add_argument("--no-sandbox") # Bypass OS security model, necessary on certain platforms
|
| 21 |
options.add_argument("--disable-dev-shm-usage") # Overcome limited resource problems
|
| 22 |
-
options.add_argument(f"download.default_directory={download_dir}") # Set download directory
|
| 23 |
options.add_experimental_option("prefs", {
|
| 24 |
-
"download.default_directory": download_dir,
|
| 25 |
-
"download.prompt_for_download": False,
|
| 26 |
-
"download.directory_upgrade": True,
|
| 27 |
"plugins.always_open_pdf_externally": True, # Auto-download PDFs
|
| 28 |
"safebrowsing.enabled": True # Enable safe browsing to avoid triggering the browser's security warnings
|
| 29 |
})
|
|
|
|
| 11 |
|
| 12 |
def get_mp3(song_title):
|
| 13 |
# Set the download directory to the "music" subfolder within the current directory
|
| 14 |
+
# download_directory = os.path.join(os.getcwd(), "music")
|
| 15 |
+
# os.makedirs(download_directory, exist_ok=True)
|
| 16 |
|
| 17 |
# Set up Chrome options
|
| 18 |
options = Options()
|
| 19 |
options.add_argument("--headless")
|
| 20 |
options.add_argument("--no-sandbox") # Bypass OS security model, necessary on certain platforms
|
| 21 |
options.add_argument("--disable-dev-shm-usage") # Overcome limited resource problems
|
| 22 |
+
#options.add_argument(f"download.default_directory={download_dir}") # Set download directory
|
| 23 |
options.add_experimental_option("prefs", {
|
| 24 |
+
# "download.default_directory": download_dir,
|
| 25 |
+
# "download.prompt_for_download": False,
|
| 26 |
+
# "download.directory_upgrade": True,
|
| 27 |
"plugins.always_open_pdf_externally": True, # Auto-download PDFs
|
| 28 |
"safebrowsing.enabled": True # Enable safe browsing to avoid triggering the browser's security warnings
|
| 29 |
})
|