From fba4626c10ba1b9050f008a1c513491641411c4d Mon Sep 17 00:00:00 2001 From: "Il'ya (Marshal)" Date: Fri, 18 Mar 2022 21:23:38 +0100 Subject: [PATCH] Revert "add crawling of strings from telegram beta for android" This reverts commit ddff7c464f95e7b346d71635f8b40cd71e527d35. --- make_files_tree.py | 50 ---------------------------------------------- 1 file changed, 50 deletions(-) diff --git a/make_files_tree.py b/make_files_tree.py index eeea2fb3fb..cbc08f4e8a 100644 --- a/make_files_tree.py +++ b/make_files_tree.py @@ -2,7 +2,6 @@ import asyncio import logging import os import re -import subprocess from asyncio.exceptions import TimeoutError from string import punctuation, whitespace from time import time @@ -40,52 +39,6 @@ logging.basicConfig(format='%(message)s', level=logging.DEBUG) logger = logging.getLogger(__name__) -async def download_apk_and_extract_resources(session: aiohttp.ClientSession): - api_base = 'https://install.appcenter.ms/api/v0.1' - parameterized_url = 'apps/drklo-2kb-ghpo/telegram-beta-2/distribution_groups/all-users-of-telegram-beta-2' - url = f'{api_base}/{parameterized_url}' - - latest_id = download_url = None - - async with session.get(f'{url}/public_releases') as response: - if response.status != 200: return - json = await response.json(encoding='UTF-8') - if json and json[0]: - latest_id = json[0]['id'] - - if not latest_id: - return - - async with session.get(f'{url}/releases/{latest_id}') as response: - if response.status != 200: return - json = await response.json(encoding='UTF-8') - if not json: return - download_url = json['download_url'] - - if not download_url: - return - - async def download_file(url, path): - async with session.get(url) as response: - if response.status != 200: return - async with aiofiles.open(path, mode='wb') as f: - await f.write(await response.read()) - - await download_file('https://bitbucket.org/iBotPeaches/apktool/downloads/apktool_2.6.1.jar', 'tool.apk') - await download_file(download_url, 'app.apk') - - # synced but I don't have about it ;d - subprocess.call(['java', '-jar', 'tool.apk', 'd', '-s', '-f', 'app.apk']) - - path_to_strings = 'res/values/strings.xml' - - filename = os.path.join(OUTPUT_FOLDER, 'telegram-beta-android', path_to_strings) - os.makedirs(os.path.dirname(filename), exist_ok=True) - async with aiofiles.open(filename, 'w') as f: - async with aiofiles.open(os.path.join('app', path_to_strings), 'r') as ff: - await f.write(await ff.read()) - - async def collect_translations_paginated_content(url: str, session: aiohttp.ClientSession) -> str: headers = {'X-Requested-With': 'XMLHttpRequest'} content = list() @@ -160,9 +113,6 @@ async def start(url_list: set[str]): async with aiohttp.ClientSession(connector=CONNECTOR) as session: await asyncio.gather(*[crawl(url, session) for url in url_list]) - # yeap it will be called each run, and what? ;d - await download_apk_and_extract_resources(session) - if __name__ == '__main__': with open(INPUT_FILENAME, 'r') as f: