Skip to content

Commit a8aa9ab

Browse files
fix buzzheavier
1 parent fafc4d2 commit a8aa9ab

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

modules/buzzheavier.py

+6-11
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,14 @@ def Uploader(file, proxy_list, user_agents, api_keys):
2626
# Select a random user agent
2727
ua = random.choice(user_agents)
2828
upload_url = sites_data_dict[site]["url"]
29+
download_url_base = sites_data_dict[site]["download_url_base"]
2930

3031
# Get the file size and name
3132
file_name = os.path.basename(file)
3233

3334
# Set the user agent header
3435
headers = {
35-
"User-Agent": "curl/8.4.0",
36+
"User-Agent": ua,
3637
"Accept": "*/*",
3738
"Content-Length": str(os.path.getsize(file))
3839
}
@@ -45,27 +46,21 @@ def Uploader(file, proxy_list, user_agents, api_keys):
4546

4647
# Send the upload request with the form data, headers, and proxies
4748
with open(file, "rb") as file_upload:
48-
raw_req = requests.put(url=f"{upload_url}{file_name}", data=file_upload, headers=headers, proxies=proxies, timeout=300, stream=True)
49+
raw_req = requests.put(url=f"{upload_url}{file_name}?expiry=10368000", data=file_upload, headers=headers, proxies=proxies, timeout=300, stream=True)
4950
file_upload.close()
50-
if raw_req.status_code == 200:
51+
if raw_req.status_code == 201:
5152

5253
try:
5354
raw_req = raw_req.json()
54-
download_url = raw_req.get("url")
55+
download_url = raw_req.get("id")
5556

5657
except Exception as e:
5758
return {"status": "error", "file_name": file_name, "exception": str(e), "extra": raw_req.text}
5859

59-
return {"status": "ok", "file_name": file_name, "file_url": download_url}
60+
return {"status": "ok", "file_name": file_name, "file_url": f"{download_url_base}{download_url}"}
6061
else:
6162
raise Exception(raw_req.status_code)
6263

63-
file_id = raw_req.text
64-
download_url = download_url_base + file_id.replace("&", "_")
65-
66-
# Return successful message with the status, file name, file URL, and site
67-
return {"status": "ok", "file_name": file_name, "file_url": download_url}
68-
6964
except Exception as e:
7065
# Return error message
7166
return {"status": "error", "file_name": file_name, "exception": str(e), "extra": raw_req}

modules/site_data.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,9 @@
292292
},
293293
"Buzzheavier": {
294294
"apiKey": False,
295-
"url": "https://w.buzzheavier.com/f/",
295+
"url": "https://w.buzzheavier.com/",
296296
"api_url": "https://buzzheavier.com/",
297-
"download_url_base": "https://w.buzzheavier.com/f/"
297+
"download_url_base": "https://buzzheavier.com/f/"
298298
},
299299
"Oshi": {
300300
"comment": "Keep this one as low as possible. Its really a slow piece of shit.",

0 commit comments

Comments
 (0)