From 90b44c99621abb2fb2e009678ffd754213685afa Mon Sep 17 00:00:00 2001 From: Nikhil Badyal Date: Mon, 15 Aug 2022 12:24:26 +0530 Subject: [PATCH 1/3] =?UTF-8?q?=E2=9C=A8=20Added=20tiktok?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/main.py b/main.py index 8fe7644..7f9c39b 100644 --- a/main.py +++ b/main.py @@ -18,8 +18,13 @@ from tqdm import tqdm temp_folder = Path("apks") session = Session() session.headers["User-Agent"] = "anything" -apps = ["youtube", "youtube-music", "twitter", "reddit"] +apps = ["youtube", "youtube-music", "twitter", "reddit", "tiktok"] apk_mirror = "https://www.apkmirror.com" +apk_mirror_urls = { + "reddit": f"{apk_mirror}/apk/redditinc/reddit/", + "twitter": f"{apk_mirror}/apk/twitter-inc/twitter/", + "tiktok": f"{apk_mirror}/apk/tiktok-pte-ltd/tik-tok-including-musical-ly/", +} class Downloader: @@ -94,11 +99,8 @@ class Downloader: @classmethod def apkmirror_reddit_twitter(cls, app: str) -> str: logger.debug(f"Trying to download {app} apk from apkmirror in rt") - if app == "reddit": - page = f"{apk_mirror}/apk/redditinc/reddit/" - elif app == "twitter": - page = f"{apk_mirror}/apk/twitter-inc/twitter/" - else: + page = apk_mirror_urls.get(app) + if not page: logger.debug("Invalid app") sys.exit(1) parser = LexborHTMLParser(session.get(page).text) @@ -164,7 +166,7 @@ class Patches: available_patches.extend(app_patches[2:]) - youtube, music, twitter, reddit = [], [], [], [] + youtube, music, twitter, reddit, tiktok = [], [], [], [], [] for n, d, a, v in available_patches: patch = {"name": n, "description": d, "app": a, "version": v} if "twitter" in a: @@ -175,14 +177,18 @@ class Patches: music.append(patch) elif "youtube" in a: youtube.append(patch) + elif "trill" in a: + tiktok.append(patch) self._yt = youtube self._ytm = music self._twitter = twitter self._reddit = reddit + self._tiktok = tiktok logger.debug(f"Total patches in youtube are {len(youtube)}") logger.debug(f"Total patches in youtube-music are {len(music)}") logger.debug(f"Total patches in twitter are {len(twitter)}") logger.debug(f"Total patches in reddit are {len(reddit)}") + logger.debug(f"Total patches in tiktok are {len(tiktok)}") def get(self, app: str) -> Tuple[List[Dict[str, str]], str]: logger.debug("Getting patches for %s" % app) @@ -194,6 +200,8 @@ class Patches: patches = self._ytm elif "youtube" == app: patches = self._yt + elif "tiktok" == app: + patches = self._tiktok else: logger.debug("Invalid app name") sys.exit(-1) @@ -315,10 +323,10 @@ def main() -> None: is_experimental = True version = env_version - if app == "reddit" or app == "twitter": - version = downloader.apkmirror_reddit_twitter(app) - else: + if "youtube" in app: downloader.apkmirror(app, version) + else: + version = downloader.apkmirror_reddit_twitter(app) get_patches() # downloader.report() logger.debug(f"Download completed {app}") From 9ec47a15e2db5e25688c7ff9b649bdc0285cd5ca Mon Sep 17 00:00:00 2001 From: Nikhil Badyal Date: Mon, 15 Aug 2022 12:25:03 +0530 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=91=B7=20Added=20new=20on=20push=20ti?= =?UTF-8?q?rgger?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-apk.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-apk.yml b/.github/workflows/build-apk.yml index 67e50ad..2093c77 100644 --- a/.github/workflows/build-apk.yml +++ b/.github/workflows/build-apk.yml @@ -7,6 +7,7 @@ on: push: branches: - main + - new-apk* # paths: # - '*.py' # - requirements.txt From ea3125b707a6f1b073e59967742085fb104ccd0e Mon Sep 17 00:00:00 2001 From: Nikhil Badyal Date: Mon, 15 Aug 2022 12:32:05 +0530 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=90=9B=20Removed=20resource=20patchin?= =?UTF-8?q?g=20from=20tiktok?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index 7f9c39b..a26720f 100644 --- a/main.py +++ b/main.py @@ -243,7 +243,7 @@ class ArgParser: if is_experimental: logger.debug("Using experimental features") args.append("--experimental") - if app == "reddit": + if app in ("reddit", "tiktok"): args.append("-r") args.remove("-m") args.remove("integrations.apk")