From 7a1fc74428390ba47ba3dfcb7758f911db643c83 Mon Sep 17 00:00:00 2001 From: Nikhil Badyal Date: Sun, 6 Aug 2023 18:13:23 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20Generate=20issue=20with=20image?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/newapp-check.yml | 8 +++-- scripts/status_check.py | 49 ++++++++++++++++++++++++++++-- 2 files changed, 53 insertions(+), 4 deletions(-) diff --git a/.github/workflows/newapp-check.yml b/.github/workflows/newapp-check.yml index 54e7668..ce87b0e 100644 --- a/.github/workflows/newapp-check.yml +++ b/.github/workflows/newapp-check.yml @@ -25,9 +25,13 @@ jobs: - name: Execute Status Check run: | + EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) output=$(python -m scripts.status_check) - echo "changelog=$output" >>$GITHUB_OUTPUT + echo "changelog<<$EOF" >> $GITHUB_OUTPUT + echo "$output" >> $GITHUB_OUTPUT + echo "$EOF" >> $GITHUB_OUTPUT id: status + - name: Update Check run: echo "${{ steps.status.outputs.changelog }}" @@ -38,4 +42,4 @@ jobs: token: ${{secrets.GITHUB_TOKEN}} assignees: ${{ github.repository_owner }} labels: ๐Ÿ’โ€new-app - body: ${{ steps.status.outputs.changelog }} + body: ${{ steps.status.outputs.changelog }} diff --git a/scripts/status_check.py b/scripts/status_check.py index c8c8fb8..d77e198 100644 --- a/scripts/status_check.py +++ b/scripts/status_check.py @@ -1,10 +1,46 @@ """Status check.""" +from typing import List import requests +from bs4 import BeautifulSoup from src.patches import Patches from src.utils import handle_response +not_found_icon = "https://img.icons8.com/bubbles/500/android-os.png" + + +def gplay_icon_scrapper(package_name: str) -> str: + """Scrap Icon from Gplay.""" + # noinspection PyBroadException + try: + app_url = ( + f"https://play.google.com/store/apps/details?id={package_name}&hl=en&gl=US" + ) + response = requests.get(app_url) + soup = BeautifulSoup(response.text, "html.parser") + icon = soup.select_one("div.Il7kR > img") + return str(icon["srcset"].split(" ")[0]) + except Exception: + return not_found_icon + + +def generate_markdown_table(data: List[List[str]]) -> str: + """Generate table.""" + if len(data) == 0: + return "No data to generate table." + + table = "| Package Name | PlayStore link | APKMirror link| Supported ?|\n" + table += "|-------------|----------------|---------------|------------|\n" + + for row in data: + if len(row) != 3: + raise ValueError("Each row must contain 4 columns of data.") + + table += f"| {row[0]} | {row[1]} | {row[2]} |
  • - [ ]
  • |\n" + + return table + def main() -> None: repo_url = "https://api.revanced.app/v2/patches/latest" @@ -21,9 +57,18 @@ def main() -> None: supported_app = set(Patches.support_app().keys()) missing_support = possible_apps.difference(supported_app) - output = "New app found which aren't supported yet.
    " + output = "New app found which aren't supported yet.\n\n" + data = [] for index, app in enumerate(missing_support): - output += f"{index+1}. [{app}](https://play.google.com/store/apps/details?id={app})
    " + data.append( + [ + f'', + f"[PlayStore Link](https://play.google.com/store/apps/details?id={app})", + f"[APKMirror Link](https://www.apkmirror.com/?s={app})", + ] + ) + table = generate_markdown_table(data) + output += table print(output)