From 95c90722ee6bbeee9f9044bcb9884c9226cc44a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Thu, 19 Dec 2019 17:15:41 +0100 Subject: [PATCH] [instagram] implement 'videos' option (closes #521) --- docs/configuration.rst | 9 +++++++++ docs/gallery-dl.conf | 3 ++- gallery_dl/extractor/instagram.py | 7 ++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index b4d7e605..bffeeddb 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -770,6 +770,15 @@ Description Include *Story Highlights* when downloading a user profile. =========== ===== +extractor.instagram.videos +-------------------------- +=========== ===== +Type ``bool`` +Default ``true`` +Description Download video files. +=========== ===== + + extractor.kissmanga.captcha --------------------------- =========== ===== diff --git a/docs/gallery-dl.conf b/docs/gallery-dl.conf index 7fd6f9ec..a0f59d7c 100644 --- a/docs/gallery-dl.conf +++ b/docs/gallery-dl.conf @@ -72,7 +72,8 @@ }, "instagram": { - "highlights": false + "highlights": false, + "videos": true }, "kissmanga": { diff --git a/gallery_dl/extractor/instagram.py b/gallery_dl/extractor/instagram.py index c0050c58..05adac1e 100644 --- a/gallery_dl/extractor/instagram.py +++ b/gallery_dl/extractor/instagram.py @@ -31,6 +31,7 @@ class InstagramExtractor(Extractor): self.login() yield Message.Version, 1 + videos = self.config("videos", True) metadata = self.get_metadata() for data in self.instagrams(): data.update(metadata) @@ -41,7 +42,11 @@ class InstagramExtractor(Extractor): data['_extractor'] = InstagramStoriesExtractor yield Message.Queue, url, data else: - url = data.get('video_url') or data['display_url'] + url = data.get('video_url') + if not url: + url = data['display_url'] + elif not videos: + continue yield Message.Url, url, text.nameext_from_url(url, data) def login(self):