Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
404 for gofile proper handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Jules-WinnfieldX committed Apr 8, 2024
1 parent 3632edd commit fd975ce
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cyberdrop_dl/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "5.2.18"
__version__ = "5.2.19"
12 changes: 10 additions & 2 deletions cyberdrop_dl/managers/client_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

import aiohttp
import certifi
from aiohttp import ClientResponse
from aiohttp import ClientResponse, ContentTypeError
from aiolimiter import AsyncLimiter

from cyberdrop_dl.clients.download_client import DownloadClient
from cyberdrop_dl.clients.errors import DownloadFailure, DDOSGuardFailure
from cyberdrop_dl.clients.errors import DownloadFailure, DDOSGuardFailure, ScrapeFailure
from cyberdrop_dl.clients.scraper_client import ScraperClient
from cyberdrop_dl.utils.utilities import CustomHTTPStatus

Expand Down Expand Up @@ -84,6 +84,14 @@ async def check_http_status(self, response: ClientResponse, download: bool = Fal

if HTTPStatus.OK <= status < HTTPStatus.BAD_REQUEST:
return

if "gofile" in response.url.host.lower():
try:
JSON_Resp = await response.json()
if "notFound" in JSON_Resp["status"]:
raise ScrapeFailure(404, "Does Not Exist")
except ContentTypeError:
pass

try:
phrase = HTTPStatus(status).phrase
Expand Down
3 changes: 0 additions & 3 deletions cyberdrop_dl/scraper/crawlers/gofile_crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ async def album(self, scrape_item: ScrapeItem) -> None:
else:
raise ScrapeFailure(e.status, e.message)

if JSON_Resp["status"] != "ok":
raise ScrapeFailure(404, "Does Not Exist")

JSON_Resp = JSON_Resp['data']
title = await self.create_title(JSON_Resp["name"], content_id, None)

Expand Down
6 changes: 3 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "cyberdrop-dl"
version = "5.2.18"
version = "5.2.19"
description = "Bulk downloader for multiple file hosts"
authors = ["Jules Winnfield <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit fd975ce

Please sign in to comment.