mirror of
https://github.com/bellingcat/auto-archiver.git
synced 2026-06-12 21:28:29 +03:00
cleanup and docs
This commit is contained in:
@@ -10,7 +10,7 @@ class TelegramArchiver(Archiver):
|
||||
|
||||
def download(self, url, check_if_exists=False):
|
||||
# detect URLs that we definitely cannot handle
|
||||
if 'http://t.me/' not in url and 'https://t.me/' not in url:
|
||||
if 't.me' != self.get_netloc(url):
|
||||
return False
|
||||
|
||||
headers = {
|
||||
@@ -20,7 +20,7 @@ class TelegramArchiver(Archiver):
|
||||
|
||||
original_url = url
|
||||
|
||||
# TODO: check if we can do this more resilient to user-input
|
||||
# TODO: check if we can do this more resilient to variable URLs
|
||||
if url[-8:] != "?embed=1":
|
||||
url += "?embed=1"
|
||||
|
||||
@@ -32,8 +32,8 @@ class TelegramArchiver(Archiver):
|
||||
return False # could not find video
|
||||
|
||||
video_url = video.get('src')
|
||||
key = video_url.split('/')[-1].split('?')[0]
|
||||
key = self.get_key(key)
|
||||
video_id = video_url.split('/')[-1].split('?')[0]
|
||||
key = self.get_key(video_id)
|
||||
|
||||
filename = 'tmp/' + key
|
||||
|
||||
@@ -60,7 +60,7 @@ class TelegramArchiver(Archiver):
|
||||
duration = float(duration)
|
||||
|
||||
# process thumbnails
|
||||
key_thumb, thumb_index = self.get_thumbnails(filename, duration=duration)
|
||||
key_thumb, thumb_index = self.get_thumbnails(filename, key, duration=duration)
|
||||
os.remove(filename)
|
||||
|
||||
return ArchiveResult(status=status, cdn_url=cdn_url, thumbnail=key_thumb, thumbnail_index=thumb_index,
|
||||
|
||||
Reference in New Issue
Block a user