mirror of
https://github.com/sotam0316/docker-py-revanced.git
synced 2026-04-25 03:48:37 +09:00
✨ Added tiktok
This commit is contained in:
@@ -18,8 +18,13 @@ from tqdm import tqdm
|
|||||||
temp_folder = Path("apks")
|
temp_folder = Path("apks")
|
||||||
session = Session()
|
session = Session()
|
||||||
session.headers["User-Agent"] = "anything"
|
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 = "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:
|
class Downloader:
|
||||||
@@ -94,11 +99,8 @@ class Downloader:
|
|||||||
@classmethod
|
@classmethod
|
||||||
def apkmirror_reddit_twitter(cls, app: str) -> str:
|
def apkmirror_reddit_twitter(cls, app: str) -> str:
|
||||||
logger.debug(f"Trying to download {app} apk from apkmirror in rt")
|
logger.debug(f"Trying to download {app} apk from apkmirror in rt")
|
||||||
if app == "reddit":
|
page = apk_mirror_urls.get(app)
|
||||||
page = f"{apk_mirror}/apk/redditinc/reddit/"
|
if not page:
|
||||||
elif app == "twitter":
|
|
||||||
page = f"{apk_mirror}/apk/twitter-inc/twitter/"
|
|
||||||
else:
|
|
||||||
logger.debug("Invalid app")
|
logger.debug("Invalid app")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
parser = LexborHTMLParser(session.get(page).text)
|
parser = LexborHTMLParser(session.get(page).text)
|
||||||
@@ -164,7 +166,7 @@ class Patches:
|
|||||||
|
|
||||||
available_patches.extend(app_patches[2:])
|
available_patches.extend(app_patches[2:])
|
||||||
|
|
||||||
youtube, music, twitter, reddit = [], [], [], []
|
youtube, music, twitter, reddit, tiktok = [], [], [], [], []
|
||||||
for n, d, a, v in available_patches:
|
for n, d, a, v in available_patches:
|
||||||
patch = {"name": n, "description": d, "app": a, "version": v}
|
patch = {"name": n, "description": d, "app": a, "version": v}
|
||||||
if "twitter" in a:
|
if "twitter" in a:
|
||||||
@@ -175,14 +177,18 @@ class Patches:
|
|||||||
music.append(patch)
|
music.append(patch)
|
||||||
elif "youtube" in a:
|
elif "youtube" in a:
|
||||||
youtube.append(patch)
|
youtube.append(patch)
|
||||||
|
elif "trill" in a:
|
||||||
|
tiktok.append(patch)
|
||||||
self._yt = youtube
|
self._yt = youtube
|
||||||
self._ytm = music
|
self._ytm = music
|
||||||
self._twitter = twitter
|
self._twitter = twitter
|
||||||
self._reddit = reddit
|
self._reddit = reddit
|
||||||
|
self._tiktok = tiktok
|
||||||
logger.debug(f"Total patches in youtube are {len(youtube)}")
|
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 youtube-music are {len(music)}")
|
||||||
logger.debug(f"Total patches in twitter are {len(twitter)}")
|
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 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]:
|
def get(self, app: str) -> Tuple[List[Dict[str, str]], str]:
|
||||||
logger.debug("Getting patches for %s" % app)
|
logger.debug("Getting patches for %s" % app)
|
||||||
@@ -194,6 +200,8 @@ class Patches:
|
|||||||
patches = self._ytm
|
patches = self._ytm
|
||||||
elif "youtube" == app:
|
elif "youtube" == app:
|
||||||
patches = self._yt
|
patches = self._yt
|
||||||
|
elif "tiktok" == app:
|
||||||
|
patches = self._tiktok
|
||||||
else:
|
else:
|
||||||
logger.debug("Invalid app name")
|
logger.debug("Invalid app name")
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
@@ -315,10 +323,10 @@ def main() -> None:
|
|||||||
is_experimental = True
|
is_experimental = True
|
||||||
version = env_version
|
version = env_version
|
||||||
|
|
||||||
if app == "reddit" or app == "twitter":
|
if "youtube" in app:
|
||||||
version = downloader.apkmirror_reddit_twitter(app)
|
|
||||||
else:
|
|
||||||
downloader.apkmirror(app, version)
|
downloader.apkmirror(app, version)
|
||||||
|
else:
|
||||||
|
version = downloader.apkmirror_reddit_twitter(app)
|
||||||
get_patches()
|
get_patches()
|
||||||
# downloader.report()
|
# downloader.report()
|
||||||
logger.debug(f"Download completed {app}")
|
logger.debug(f"Download completed {app}")
|
||||||
|
|||||||
Reference in New Issue
Block a user