This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import aiohttp | |
import asyncio | |
import logging | |
import traceback | |
import uuid | |
from chardet import detect | |
from typing import Any, Optional, Tuple | |
logger = logging.getLogger(__name__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
access_hash = await db.fetchval( | |
''' | |
SELECT extra ->> 'access_hash' | |
FROM scanning.accounts | |
WHERE channel = $1 | |
''', | |
'tg' | |
) | |
tg = TelegramStreaming( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def collect_article(self, blocks) -> str: | |
article = [] | |
for block in blocks: | |
text = self.obtain_text(block) | |
if text: | |
article.append(text) | |
return '\n'.join(article) |