Spaces:
Runtime error
Runtime error
Update scraping.py
Browse files- scraping.py +10 -5
scraping.py
CHANGED
|
@@ -15,16 +15,21 @@ def get_mp3(song_title):
|
|
| 15 |
os.makedirs(download_directory, exist_ok=True)
|
| 16 |
|
| 17 |
# Set up Chrome options
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
"download.prompt_for_download": False,
|
| 22 |
"download.directory_upgrade": True,
|
| 23 |
-
"
|
|
|
|
| 24 |
})
|
| 25 |
|
| 26 |
# Set up the Selenium WebDriver (e.g., Chrome)
|
| 27 |
-
driver = webdriver.Chrome(options=
|
| 28 |
|
| 29 |
# Navigate to the website
|
| 30 |
driver.get("https://suno.com/me")
|
|
|
|
| 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 |
})
|
| 30 |
|
| 31 |
# Set up the Selenium WebDriver (e.g., Chrome)
|
| 32 |
+
driver = webdriver.Chrome(options=options)
|
| 33 |
|
| 34 |
# Navigate to the website
|
| 35 |
driver.get("https://suno.com/me")
|