diff --git a/src/auto_archiver/archivers/instagram_api_archiver.py b/src/auto_archiver/archivers/instagram_api_archiver.py index 5f68f59..d8acfd2 100644 --- a/src/auto_archiver/archivers/instagram_api_archiver.py +++ b/src/auto_archiver/archivers/instagram_api_archiver.py @@ -186,12 +186,13 @@ class InstagramAPIArchiver(Archiver): def download_stories(self, result: Metadata, username: str) -> Metadata: now = datetime.now().strftime("%Y-%m-%d_%H-%M") stories = self._download_stories_reusable(result, username) + if stories == []: return result.success("insta no story") result.set_title(f"stories {username} at {now}").set("#stories", len(stories)) return result.success(f"insta stories {now}") def _download_stories_reusable(self, result: Metadata, username: str) -> list[dict]: stories = self.call_api(f"v1/user/stories/by/username", {"username": username}) - assert stories, f"Stories for {username} not found" + if not stories or not len(stories): return [] stories = stories[::-1] # newest to oldest for s in tqdm(stories, desc="downloading stories", unit="story"): diff --git a/src/auto_archiver/archivers/instagram_tbot_archiver.py b/src/auto_archiver/archivers/instagram_tbot_archiver.py index 580b8ac..4fcdc9b 100644 --- a/src/auto_archiver/archivers/instagram_tbot_archiver.py +++ b/src/auto_archiver/archivers/instagram_tbot_archiver.py @@ -42,7 +42,7 @@ class InstagramTbotArchiver(Archiver): # make a copy of the session that is used exclusively with this archiver instance new_session_file = os.path.join("secrets/", f"instabot-{time.strftime('%Y-%m-%d')}{random_str(8)}.session") shutil.copy(self.session_file + ".session", new_session_file) - self.session_file = new_session_file + self.session_file = new_session_file.replace(".session", "") try: self.client = TelegramClient(self.session_file, self.api_id, self.api_hash) diff --git a/src/auto_archiver/archivers/telethon_archiver.py b/src/auto_archiver/archivers/telethon_archiver.py index 9144c61..6e803e7 100644 --- a/src/auto_archiver/archivers/telethon_archiver.py +++ b/src/auto_archiver/archivers/telethon_archiver.py @@ -49,7 +49,7 @@ class TelethonArchiver(Archiver): # make a copy of the session that is used exclusively with this archiver instance new_session_file = os.path.join("secrets/", f"telethon-{time.strftime('%Y-%m-%d')}{random_str(8)}.session") shutil.copy(self.session_file + ".session", new_session_file) - self.session_file = new_session_file + self.session_file = new_session_file.replace(".session", "") # initiate the client self.client = TelegramClient(self.session_file, self.api_id, self.api_hash) diff --git a/src/auto_archiver/archivers/youtubedl_archiver.py b/src/auto_archiver/archivers/youtubedl_archiver.py index ab65bcc..3b2f17f 100644 --- a/src/auto_archiver/archivers/youtubedl_archiver.py +++ b/src/auto_archiver/archivers/youtubedl_archiver.py @@ -56,7 +56,8 @@ class YoutubeDLArchiver(Archiver): return False # this time download - ydl = yt_dlp.YoutubeDL({**ydl_options, "getcomments": self.comments}) + ydl = yt_dlp.YoutubeDL({**ydl_options, "getcomments": self.comments}) + #TODO: for playlist or long lists of videos, how to download one at a time so they can be stored before the next one is downloaded? info = ydl.extract_info(url, download=True) if "entries" in info: diff --git a/src/auto_archiver/version.py b/src/auto_archiver/version.py index 8daf032..5a5a1c9 100644 --- a/src/auto_archiver/version.py +++ b/src/auto_archiver/version.py @@ -3,7 +3,7 @@ _MAJOR = "0" _MINOR = "10" # On main and in a nightly release the patch should be one ahead of the last # released build. -_PATCH = "0" +_PATCH = "1" # This is mainly for nightly builds which have the suffix ".dev$DATE". See # https://semver.org/#is-v123-a-semantic-version for the semantics. _SUFFIX = ""