mirror of
https://github.com/MarshalX/telegram-crawler.git
synced 2025-03-22 08:15:39 +01:00
Revert "add crawling of strings from telegram beta for android"
This reverts commit ddff7c464f
.
This commit is contained in:
parent
ddff7c464f
commit
fba4626c10
1 changed files with 0 additions and 50 deletions
|
@ -2,7 +2,6 @@ import asyncio
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import subprocess
|
|
||||||
from asyncio.exceptions import TimeoutError
|
from asyncio.exceptions import TimeoutError
|
||||||
from string import punctuation, whitespace
|
from string import punctuation, whitespace
|
||||||
from time import time
|
from time import time
|
||||||
|
@ -40,52 +39,6 @@ logging.basicConfig(format='%(message)s', level=logging.DEBUG)
|
||||||
logger = logging.getLogger(__name__)
|
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:
|
async def collect_translations_paginated_content(url: str, session: aiohttp.ClientSession) -> str:
|
||||||
headers = {'X-Requested-With': 'XMLHttpRequest'}
|
headers = {'X-Requested-With': 'XMLHttpRequest'}
|
||||||
content = list()
|
content = list()
|
||||||
|
@ -160,9 +113,6 @@ async def start(url_list: set[str]):
|
||||||
async with aiohttp.ClientSession(connector=CONNECTOR) as session:
|
async with aiohttp.ClientSession(connector=CONNECTOR) as session:
|
||||||
await asyncio.gather(*[crawl(url, session) for url in url_list])
|
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__':
|
if __name__ == '__main__':
|
||||||
with open(INPUT_FILENAME, 'r') as f:
|
with open(INPUT_FILENAME, 'r') as f:
|
||||||
|
|
Loading…
Add table
Reference in a new issue