kopia lustrzana https://github.com/bellingcat/auto-archiver
handle deleted telegram
rodzic
81ce27bdb3
commit
81eb00a767
|
@ -29,7 +29,7 @@ class TelethonArchiver(Archiver):
|
|||
Returns a list of [post] where each post has media and is in the same grouped_id
|
||||
"""
|
||||
if getattr_or(original_post, "grouped_id") is None:
|
||||
return [original_post] if getattr_or(original_post, "media") is not None else []
|
||||
return [original_post] if getattr_or(original_post, "media") else []
|
||||
|
||||
search_ids = [i for i in range(original_post.id - max_amp, original_post.id + max_amp + 1)]
|
||||
posts = self.client.get_messages(chat, ids=search_ids)
|
||||
|
@ -67,6 +67,8 @@ class TelethonArchiver(Archiver):
|
|||
logger.error(f"Could not fetch telegram {url}. This error can be fixed if you setup a bot_token in addition to api_id and api_hash: {e}")
|
||||
return False
|
||||
|
||||
if post is None: return False
|
||||
|
||||
media_posts = self._get_media_posts_in_group(chat, post)
|
||||
logger.debug(f'got {len(media_posts)=} for {url=}')
|
||||
|
||||
|
@ -111,4 +113,4 @@ class TelethonArchiver(Archiver):
|
|||
return ArchiveResult(status=status, cdn_url=cdn_url, title=post.message, thumbnail=key_thumb, thumbnail_index=thumb_index, timestamp=post.date, hash=hash, screenshot=screenshot)
|
||||
|
||||
page_cdn, page_hash, _ = self.generate_media_page_html(url, [], html.escape(str(post)))
|
||||
return ArchiveResult(status=status, cdn_url=page_cdn, title=getattr_or(post, "message", ""), timestamp=getattr_or(post, "date"), hash=page_hash, screenshot=screenshot)
|
||||
return ArchiveResult(status=status, cdn_url=page_cdn, title=post.message, timestamp=getattr_or(post, "date"), hash=page_hash, screenshot=screenshot)
|
||||
|
|
Ładowanie…
Reference in New Issue