mirror of
https://github.com/sotam0316/docker-py-revanced.git
synced 2026-04-25 03:48:37 +09:00
👽️ Updated Revanced API (#353)
This commit is contained in:
@@ -25,6 +25,7 @@ from src.exceptions import (
|
||||
APKMonkIconScrapError,
|
||||
APKPureIconScrapError,
|
||||
BuilderError,
|
||||
ScrapingError,
|
||||
)
|
||||
from src.patches import Patches
|
||||
from src.utils import apkmirror_status_check, bs4_parser, handle_request_response, request_header, request_timeout
|
||||
@@ -161,6 +162,8 @@ def icon_scrapper(package_name: str) -> str:
|
||||
return str(globals()[scraper_name](package_name))
|
||||
except error_type:
|
||||
pass
|
||||
except ScrapingError:
|
||||
pass
|
||||
|
||||
return not_found_icon
|
||||
|
||||
@@ -189,7 +192,7 @@ def main() -> None:
|
||||
response = requests.get(revanced_api, timeout=request_timeout)
|
||||
handle_request_response(response, revanced_api)
|
||||
|
||||
patches = response.json()
|
||||
patches = response.json()["patches"]
|
||||
|
||||
possible_apps = set()
|
||||
for patch in patches:
|
||||
|
||||
@@ -16,7 +16,7 @@ PLAY_STORE_APK_URL = f"{PLAY_STORE_BASE_URL}/store/apps/details?id=" + "{}"
|
||||
APK_COMBO_BASE_URL = "https://apkcombo.com"
|
||||
APK_COMBO_GENERIC_URL = APK_COMBO_BASE_URL + "/genericApp/{}"
|
||||
not_found_icon = "https://img.icons8.com/bubbles/500/android-os.png"
|
||||
revanced_api = "https://releases.revanced.app/patches"
|
||||
revanced_api = "https://api.revanced.app/v2/patches/latest"
|
||||
APK_MONK_BASE_URL = "https://www.apkmonk.com"
|
||||
APK_MONK_APK_URL = APK_MONK_BASE_URL + "/app/{}/"
|
||||
APK_MONK_ICON_URL = "https://cdn.apkmonk.com/logos/{}"
|
||||
|
||||
+9
-5
@@ -17,8 +17,8 @@ class BuilderError(Exception):
|
||||
return self.message
|
||||
|
||||
|
||||
class APKMirrorIconScrapError(BuilderError):
|
||||
"""Exception raised when the icon cannot be scraped from apkmirror."""
|
||||
class ScrapingError(BuilderError):
|
||||
"""Exception raised when the url cannot be scraped."""
|
||||
|
||||
def __init__(self: Self, *args: Any, **kwargs: Any) -> None:
|
||||
"""Initialize the APKMirrorIconScrapFailure exception.
|
||||
@@ -33,15 +33,19 @@ class APKMirrorIconScrapError(BuilderError):
|
||||
self.url = kwargs.get("url", None)
|
||||
|
||||
|
||||
class APKComboIconScrapError(APKMirrorIconScrapError):
|
||||
class APKMirrorIconScrapError(ScrapingError):
|
||||
"""Exception raised when the icon cannot be scraped from apkmirror."""
|
||||
|
||||
|
||||
class APKComboIconScrapError(ScrapingError):
|
||||
"""Exception raised when the icon cannot be scraped from apkcombo."""
|
||||
|
||||
|
||||
class APKPureIconScrapError(APKMirrorIconScrapError):
|
||||
class APKPureIconScrapError(ScrapingError):
|
||||
"""Exception raised when the icon cannot be scraped from apkpure."""
|
||||
|
||||
|
||||
class APKMonkIconScrapError(APKMirrorIconScrapError):
|
||||
class APKMonkIconScrapError(ScrapingError):
|
||||
"""Exception raised when the icon cannot be scraped from apkmonk."""
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -13,7 +13,7 @@ from requests import Response
|
||||
from src.config import RevancedConfig
|
||||
from src.downloader.sources import APK_MIRROR_APK_CHECK
|
||||
from src.downloader.utils import status_code_200
|
||||
from src.exceptions import DownloadError
|
||||
from src.exceptions import ScrapingError
|
||||
|
||||
default_build = [
|
||||
"youtube",
|
||||
@@ -115,7 +115,7 @@ def handle_request_response(response: Response, url: str) -> None:
|
||||
response_code = response.status_code
|
||||
if response_code != status_code_200:
|
||||
msg = f"Unable to downloaded assets. Reason - {response.text}"
|
||||
raise DownloadError(msg, url=url)
|
||||
raise ScrapingError(msg, url=url)
|
||||
|
||||
|
||||
def slugify(string: str) -> str:
|
||||
|
||||
Reference in New Issue
Block a user