Skip to content

Commit a8bec31

Browse files
committed
Catch error in the right place...
1 parent 3df74c9 commit a8bec31

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

processors/visualisation/download-telegram-images.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ async def get_images(self):
218218
await client.download_media(message, str(path), thumb=-1)
219219
msg_id = message.id
220220
success = True
221-
except (AttributeError, RuntimeError, ValueError, TypeError, TimedOutError, BadRequestError) as e:
221+
except (AttributeError, RuntimeError, ValueError, TypeError, TimedOutError) as e:
222222
filename = f"{entity}-index-{media_done}"
223223
msg_id = str(message.id) if hasattr(message, "id") else f"with index {media_done:,}"
224224
self.dataset.log(f"Could not download image for message {msg_id} ({e})")
@@ -232,6 +232,10 @@ async def get_images(self):
232232
"post_ids": [msg_id]
233233
}
234234

235+
except BadRequestError:
236+
self.dataset.log(f"Couldn't retrieve images for {entity} - the channel is no longer accessible ({e})")
237+
self.flawless = False
238+
235239
except telethon.errors.FloodError as e:
236240
later = "later"
237241
if hasattr(e, "seconds"):

0 commit comments

Comments
 (0)