From 662792a7e5932ac9d7aab7f1d7ef1d82a413957d Mon Sep 17 00:00:00 2001 From: schplorg <9088738+schplorg@users.noreply.github.com> Date: Fri, 13 Feb 2026 18:28:09 +0100 Subject: [PATCH] Fix "Could not find the input entity for PeerChannel" --- telegram-scraper.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/telegram-scraper.py b/telegram-scraper.py index 5b5863d..63dc147 100644 --- a/telegram-scraper.py +++ b/telegram-scraper.py @@ -211,7 +211,7 @@ async def update_media_path(self, channel: str, message_id: int, media_path: str async def scrape_channel(self, channel: str, offset_id: int): try: - entity = await self.client.get_entity(PeerChannel(int(channel)) if channel.startswith('-') else channel) + entity = await self.client.get_entity(-int(channel)) result = await self.client.get_messages(entity, offset_id=offset_id, reverse=True, limit=0) total_messages = result.total @@ -349,7 +349,7 @@ async def rescrape_media(self, channel: str): try: if channel.lstrip('-').isdigit(): - entity = await self.client.get_entity(PeerChannel(int(channel))) + entity = await self.client.get_entity(-int(channel)) else: entity = await self.client.get_entity(channel) semaphore = asyncio.Semaphore(self.max_concurrent_downloads) @@ -424,7 +424,7 @@ async def fix_missing_media(self, channel: str): try: if channel.lstrip('-').isdigit(): - entity = await self.client.get_entity(PeerChannel(int(channel))) + entity = await self.client.get_entity(-int(channel)) else: entity = await self.client.get_entity(channel) semaphore = asyncio.Semaphore(self.max_concurrent_downloads)