fix gofile downloads by adding custom headers to both direct dl and api request

still needs work: 1. fix restart causing the download to instantly jump to 100%
This commit is contained in:
2026-03-11 22:15:00 +01:00
parent c3efa39b09
commit 7df7d87928
5 changed files with 38 additions and 22 deletions
+16 -6
View File
@@ -8,24 +8,34 @@ def scrape_gofile(url):
filetoken = re.findall(r"(?<=https...gofile.io\/d\/).*", url)[0]
session = requests.Session()
acc = session.post("https://api.gofile.io/accounts")
token = acc.json()["data"]["token"]
headers = {
"Authorization": f"Bearer {token}",
"X-Website-Token": "4fd6sg89d7s6", # Maybe make this dynamic in the future
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:148.0) Gecko/20100101 Firefox/148.0",
"Accept": "*/*",
"Accept-Language": "en-US,en;q=0.9",
"Accept-Encoding": "gzip, deflate, br, zstd",
"Referer": "https://gofile.io/",
"Authorization": f"Bearer lUUtRAccOuRUoZhelNSslDFSlpOgKLDj",
"X-Website-Token": "ffd9ffa831c50b9e68ca5e65cbbbd1a50e9a32e63022e17c7c6748388a1ed73b",
"X-BL": "en-US",
"Origin": "https://gofile.io",
"Sec-GPC": "1",
"Connection": "keep-alive",
"TE": "trailers"
}
r = session.get(
f"https://api.gofile.io/contents/{filetoken}",
headers=headers,
)
try:
temp: dict = r.json()["data"]["children"]
child = [key for key in temp.keys()]
return temp[child[0]]["link"]
link = temp[child[0]]["link"]
return link, headers
except:
consoleLog("gofile didnt auth you, either the api has changed\n or you sent to many requests, please try again later.\n If it still doesnt work please open an issue on Github.")
return None, None
+6 -8
View File
@@ -68,10 +68,6 @@ def scrape_steamrip_game_downloads(gamelink):
download_links[0] = "https:" + pure
if pure[2] == "g":
download_links[1] = "https:" + pure
if pure[2] == "v":
download_links[2] = "https:" + pure
if pure[2] == "m":
download_links[3] = "https:" + pure
ret = []
@@ -93,13 +89,15 @@ def get_download_link(post: Dict):
break
if links.index(best) == 0:
return scrape_buzzheavier(best)
link = scrape_buzzheavier(best)
return link
elif links.index(best) == 1:
return scrape_gofile(best)
link, headers = scrape_gofile(best)
return link, headers
else:
consoleLog("Unable to retrieve download link due to captcha, launching browser...")
webbrowser.open(best)
return None
return None, None
def filter_steamrip(query: str):
games = scrape_steamrip_links()
@@ -120,4 +118,4 @@ Metadata = {
}
def init_steamrip():
state.trackers.update({Metadata["name"] : Metadata})
state.trackers.update({Metadata["name"] : Metadata})