From 27086e66025e403d46f09ccf44f3779620c7ce63 Mon Sep 17 00:00:00 2001 From: Kaya <95276965+kytpbs@users.noreply.github.com> Date: Tue, 27 Aug 2024 23:32:22 +0300 Subject: [PATCH] add other throwable errors into except getting post can throw other errors --- src/instagram.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/instagram.py b/src/instagram.py index 1500d8c..9b95289 100644 --- a/src/instagram.py +++ b/src/instagram.py @@ -5,7 +5,7 @@ from pathlib import Path from dotenv import load_dotenv -from instaloader import ConnectionException, LoginException +from instaloader import ConnectionException, LoginException, QueryReturnedBadRequestException from instaloader.instaloader import Instaloader from instaloader.structures import Post @@ -101,7 +101,7 @@ def _get_post_from_url(url: str) -> Post | None: return None try: return Post.from_shortcode(downloader.context, shortcode) - except ConnectionException as e: # probably graphql error + except (ConnectionException, QueryReturnedBadRequestException) as e: # probably graphql error logging.exception(e) return None