08 Apr 2023, 15:11
It looks like the server at erotic-hypnosis.com is rate limiting downloading to 3 MB / minute, in 3 MB bursts.
If you have a very slow connection it's fine but if you have a fast connection your browser will download 3 MB and then timeout, marking the download as failed.
I made a python script that would log into the website and download the file.
You'll need to edit the script and add username, password and download url.
For the download url, you have to log in to the site, go to the downloads page, right click on the download button and copy the link.
If you don't have beautifulsoup and requests installed :
If you have a very slow connection it's fine but if you have a fast connection your browser will download 3 MB and then timeout, marking the download as failed.
I made a python script that would log into the website and download the file.
You'll need to edit the script and add username, password and download url.
For the download url, you have to log in to the site, go to the downloads page, right click on the download button and copy the link.
Code:
import time
import requests
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
from bs4 import BeautifulSoup
email = "username or email"
password = "your password"
login_url = "https://erotic-hypnosis.com/my-account"
download_url = "the url of the file"
output_file = "my.mp3"
# Create a session to maintain cookies and authentication
session = requests.Session()
# Set up retries with backoff factor
retries = Retry(
total=5,
backoff_factor=1,
status_forcelist=[429, 500, 502, 503, 504],
method_whitelist=["HEAD", "GET", "OPTIONS", "POST"],
)
adapter = HTTPAdapter(max_retries=retries)
session.mount("http://", adapter)
session.mount("https://", adapter)
# Set the timeout for the session
session_timeout = 120 # Timeout in seconds
session.timeout = session_timeout
# Fetch the login page to retrieve the CSRF token
print("Fetching CSRF token...")
response = session.get(login_url)
soup = BeautifulSoup(response.text, "html.parser")
csrf_token = soup.find("input", {"name": "woocommerce-login-nonce"})["value"]
print("Logging in...")
# Log in to the WooCommerce site
login_data = {
"username": email,
"password": password,
"woocommerce-login-nonce": csrf_token,
"login": "Log in"
}
response = session.post(login_url, data=login_data, timeout=session_timeout)
if response.status_code == 200:
print("Login successful")
else:
print(f"Login failed with status code: {response.status_code}")
exit(1)
print("Downloading file...")
# Download the MP3 file
response = session.get(download_url, stream=True, timeout=session_timeout)
response.raise_for_status()
# Limit download speed
chunk_size = 8192
bandwidth_limit = 3 * 1024 * 1024 / 60 # 3 MB/minute
delay = chunk_size / bandwidth_limit
bytes_downloaded = 0
# Save the downloaded file
with open(output_file, "wb") as f:
for chunk in response.iter_content(chunk_size=chunk_size):
f.write(chunk)
bytes_downloaded += len(chunk)
print(f"Downloaded {bytes_downloaded} bytes")
time.sleep(delay)
print(f"File downloaded successfully as {output_file}")
If you don't have beautifulsoup and requests installed :
Code:
pip install beautifulsoup4
pip install requests