diff --git a/docs/configuration.rst b/docs/configuration.rst index a206c5fa..816a008e 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -3428,6 +3428,39 @@ Description Do not download videos +extractor.instagram.warn-images +------------------------------- +Type + * ``bool`` + * ``string`` +Default + ``true`` +Description + Show a warning when downloading images + with a resolution smaller than the `original`. + + ``true`` + Show a warning when at least one dimension + is smaller than the reported `original` resolution + ``"all"`` | ``"both"`` + Show a warning only when both ``width`` and ``height`` + are smaller than the reported `original` resolution + ``false`` + Do not show a warning + + +extractor.instagram.warn-videos +------------------------------- +Type + ``bool`` +Default + ``true`` +Description + Show a warning when downloading videos with a + `User-Agent `__ + header causing potentially lowered video quality. + + extractor.instagram.stories.split --------------------------------- Type diff --git a/docs/gallery-dl.conf b/docs/gallery-dl.conf index 5a1b6041..ec4eb591 100644 --- a/docs/gallery-dl.conf +++ b/docs/gallery-dl.conf @@ -455,6 +455,8 @@ "order-posts": "asc", "previews" : false, "videos" : true, + "warn-images": true, + "warn-videos": true, "stories": { "split": false diff --git a/gallery_dl/extractor/instagram.py b/gallery_dl/extractor/instagram.py index 00e06b5a..1c7d2467 100644 --- a/gallery_dl/extractor/instagram.py +++ b/gallery_dl/extractor/instagram.py @@ -39,7 +39,6 @@ class InstagramExtractor(Extractor): self.www_claim = "0" self.csrf_token = util.generate_token() self._find_tags = util.re(r"#\w+").findall - self._warn_video_ua = True self._logged_in = True self._cursor = None self._user = None @@ -52,6 +51,12 @@ class InstagramExtractor(Extractor): else: self.api = InstagramRestAPI(self) + self._warn_video = True if self.config("warn-videos", True) else False + self._warn_image = ( + 9 if not (wi := self.config("warn-images", True)) else + 1 if wi in ("all", "both") else + 0) + def items(self): self.login() @@ -239,8 +244,8 @@ class InstagramExtractor(Extractor): manifest = item.get("video_dash_manifest") media = video - if self._warn_video_ua: - self._warn_video_ua = False + if self._warn_video: + self._warn_video = False pattern = text.re( r"Chrome/\d{3,}\.\d+\.\d+\.\d+(?!\d* Mobile)") if not pattern.search(self.session.headers["User-Agent"]): @@ -250,8 +255,9 @@ class InstagramExtractor(Extractor): video = manifest = None media = image - if image["width"] < item.get("original_width", 0) or \ - image["height"] < item.get("original_height", 0): + if self._warn_image < ( + (image["width"] < item.get("original_width", 0)) + + (image["height"] < item.get("original_height", 0))): self.log.warning( "%s: Available image resolutions lower than the " "original (%sx%s < %sx%s). "