Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
Update gofile_crawler.py
Jacob526a5b81f222
diff --git a/cyberdrop_dl/scraper/crawlers/gofile_crawler.py b/cyberdrop_dl/scraper/crawlers/gofile_crawler.pyindex c04cc50f3..a9c2e70ff 100644--- a/cyberdrop_dl/scraper/crawlers/gofile_crawler.py+++ b/cyberdrop_dl/scraper/crawlers/gofile_crawler.py@@ -3,8 +3,8 @@ from __future__ import annotationsimport httpimport refrom copy import deepcopy-from typing import TYPE_CHECKINGfrom hashlib import sha256+from typing import TYPE_CHECKINGfrom aiolimiter import AsyncLimiterfrom yarl import URL@@ -50,7 +50,7 @@ class GoFileCrawler(Crawler):scrape_item.album_id = content_idscrape_item.part_of_album = True- password = scrape_item.url.query.get("password","")+ password = scrape_item.url.query.get("password", "")scrape_item.url = scrape_item.url.with_query(None)if password:password = sha256(password.encode()).hexdigest()@@ -58,8 +58,9 @@ class GoFileCrawler(Crawler):try:async with self.request_limiter:JSON_Resp = await self.client.get_json(self.domain,- (self.api_address / "contents" / content_id).with_query(- {"wt": self.websiteToken, "password": password }), headers_inc=self.headers, origin = scrape_item)+ (self.api_address / "contents" / content_id).with_query(+ {"wt": self.websiteToken, "password": password}),+ headers_inc=self.headers, origin=scrape_item)except DownloadFailure as e:if e.status == http.HTTPStatus.UNAUTHORIZED:self.websiteToken = ""@@ -67,22 +68,23 @@ class GoFileCrawler(Crawler):await self.get_website_token(self.js_address, self.client)async with self.request_limiter:JSON_Resp = await self.client.get_json(self.domain,- (self.api_address / "contents" / content_id).with_query(- {"wt": self.websiteToken, "password": password}), headers_inc=self.headers, origin = scrape_item)+ (self.api_address / "contents" / content_id).with_query(+ {"wt": self.websiteToken, "password": password}),+ headers_inc=self.headers, origin=scrape_item)else:- raise ScrapeFailure(e.status, e.message, origin= scrape_item)-+ raise ScrapeFailure(e.status, e.message, origin=scrape_item)+if JSON_Resp["status"] == "error-notFound":- raise ScrapeFailure(404, "Album not found", origin= scrape_item)+ raise ScrapeFailure(404, "Album not found", origin=scrape_item)JSON_Resp = JSON_Resp['data']if "password" in JSON_Resp:- if JSON_Resp['passwordStatus'] in {'passwordRequired','passwordWrong'} or not password:- raise PasswordProtected(origin = scrape_item)+ if JSON_Resp['passwordStatus'] in {'passwordRequired', 'passwordWrong'} or not password:+ raise PasswordProtected(origin=scrape_item)if JSON_Resp["canAccess"] is False:- raise ScrapeFailure(403, "Album is private", origin= scrape_item)+ raise ScrapeFailure(403, "Album is private", origin=scrape_item)title = await self.create_title(JSON_Resp["name"], content_id, None)@@ -92,7 +94,7 @@ class GoFileCrawler(Crawler):if content["type"] == "folder":new_scrape_item = await self.create_scrape_item(scrape_item,self.primary_base_domain / "d" / content["code"], title,- True, add_parent = scrape_item.url)+ True, add_parent=scrape_item.url)self.manager.task_group.create_task(self.run(new_scrape_item))continueif content["link"] == "overloaded":