diff --git a/scripts/status_check.py b/scripts/status_check.py
index d8dab4a..1167a39 100644
--- a/scripts/status_check.py
+++ b/scripts/status_check.py
@@ -8,10 +8,28 @@ from bs4 import BeautifulSoup
from google_play_scraper import app as gplay_app
from google_play_scraper.exceptions import GooglePlayScraperException
+from src.exceptions import APKMirrorScrapperFailure
from src.patches import Patches
from src.utils import handle_response
not_found_icon = "https://img.icons8.com/bubbles/500/android-os.png"
+headers = {
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
+ "AppleWebKit/537.36 (HTML, like Gecko)"
+ " Chrome/96.0.4664.93 Safari/537.36"
+}
+
+
+def apkcombo_scrapper(package_name: str) -> str:
+ """Apkcombo scrapper."""
+ try:
+ apkcombo_url = f"https://apkcombo.com/genericApp/{package_name}"
+ r = requests.get(apkcombo_url, headers=headers, allow_redirects=True)
+ soup = BeautifulSoup(r.text, "html.parser")
+ url = soup.select_one("div.avatar > img")["data-src"]
+ return re.sub(r"=.*$", "", url)
+ except Exception:
+ return not_found_icon
def apkmirror_scrapper(package_name: str) -> str:
@@ -30,11 +48,6 @@ def apkmirror_scrapper(package_name: str) -> str:
).content
)
if response["data"][0]["exists"]:
- headers = {
- "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
- "AppleWebKit/537.36 (KHTML, like Gecko)"
- " Chrome/96.0.4664.93 Safari/537.36"
- }
search_url = f"{apk_mirror_base_url}/?s={package_name}"
r = requests.get(search_url, headers=headers)
soup = BeautifulSoup(r.text, "html.parser")
@@ -51,7 +64,7 @@ def apkmirror_scrapper(package_name: str) -> str:
pattern, f"w={new_width}&h={new_height}&q={new_quality}", sub_url
)
return apk_mirror_url
- return not_found_icon
+ raise APKMirrorScrapperFailure()
def gplay_icon_scrapper(package_name: str) -> str:
@@ -65,7 +78,10 @@ def gplay_icon_scrapper(package_name: str) -> str:
return str(result["icon"])
raise GooglePlayScraperException()
except GooglePlayScraperException:
- return apkmirror_scrapper(package_name)
+ try:
+ return apkmirror_scrapper(package_name)
+ except APKMirrorScrapperFailure:
+ return apkcombo_scrapper(package_name)
except Exception:
return not_found_icon
@@ -75,16 +91,14 @@ def generate_markdown_table(data: List[List[str]]) -> str:
if len(data) == 0:
return "No data to generate table."
- table = "| Package Name | App Icon | PlayStore link | APKMirror link| Supported?|\n"
- table += (
- "|-------------|----------|----------------|---------------|------------|\n"
- )
+ table = "| Package Name | App Icon | PlayStore link | APKMirror link|APKCombo Link| Supported?|\n"
+ table += "|-------------|----------|----------------|---------------|------------------|----------|\n"
for row in data:
- if len(row) != 5:
+ if len(row) != 6:
raise ValueError("Each row must contain 4 columns of data.")
- table += f"| {row[0]} | {row[1]} | {row[2]} | {row[3]} |{row[4]} |\n"
+ table += f"| {row[0]} | {row[1]} | {row[2]} | {row[3]} |{row[4]} |{row[5]} |\n"
return table
@@ -113,6 +127,7 @@ def main() -> None:
f'',
f"[PlayStore Link](https://play.google.com/store/apps/details?id={app})",
f"[APKMirror Link](https://www.apkmirror.com/?s={app})",
+ f"[APKCombo Link](https://apkcombo.com/genericApp/{app})",
"