Skip to content

Bulk asynchronous downloader for multiple file hosts

refactor: improve error detection (ok.ru)

NTFSvolumeb149bce52327
diff --git a/cyberdrop_dl/crawlers/odnoklassniki.py b/cyberdrop_dl/crawlers/odnoklassniki.py
index 758d24881..3a472de97 100644
--- a/cyberdrop_dl/crawlers/odnoklassniki.py
+++ b/cyberdrop_dl/crawlers/odnoklassniki.py
@@ -170,9 +170,13 @@ def _get_best_src(metadata: dict[str, Any]) -> tuple[Resolution, str]:
def _check_video_is_available(soup: BeautifulSoup) -> None:
- soup_text = soup.text
- if "Access to this video is restricted" in soup_text:
- raise ScrapeError(503)
-
- if "This video is not available in your region" in soup_text:
- raise ScrapeError(403)
+ content = soup.get_text()
+
+ for text, code in {
+ "Video has not been found": 404,
+ "This video has been deleted": 410,
+ "Access to this video is restricted": 503,
+ "This video is not available in your region": 403,
+ }.items():
+ if text in content:
+ raise ScrapeError(code)