Skip to content

Commit cee0e18

Browse files
committed
add timeout to mp3 downloads
1 parent f81a082 commit cee0e18

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

2025/national-jukebox/download_all.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def download_page(page_number):
8181

8282

8383
if __name__ == "__main__":
84-
page_number = 4
84+
page_number = 30 # 4
8585
while True:
8686
print(f"Page {page_number}")
8787
try:

2025/national-jukebox/download_mp3s.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def download_mp3(base_url):
3030
time.sleep(3)
3131

3232
try:
33-
response = requests.get(base_url)
33+
response = requests.get(base_url, timeout=60)
3434
response.raise_for_status() # Raise an exception for HTTP errors (4xx or 5xx)
3535
except requests.exceptions.RequestException as e:
3636
print(f"Error fetching URL: {e}")

0 commit comments

Comments
 (0)