From 6c4da393726d88384b391807826361b079e5f6f0 Mon Sep 17 00:00:00 2001 From: Thomas <71355143+thomas694@users.noreply.github.com> Date: Wed, 17 Feb 2021 16:07:18 +0100 Subject: [PATCH 1/6] Update the query_hash for post downloads (#1026) - It's necessary because for the old query_hash IG isn't returning the full structure any more. - So the old query_hash is replaced with the current one. --- instaloader/structures.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instaloader/structures.py b/instaloader/structures.py index 045d636..9b448ce 100644 --- a/instaloader/structures.py +++ b/instaloader/structures.py @@ -835,7 +835,7 @@ class Profile: self._obtain_metadata() return NodeIterator( self._context, - '472f257a40c653c64c666ce877d59d2b', + '003056d32c2554def87228bc3fd9668a', lambda d: d['data']['user']['edge_owner_to_timeline_media'], lambda n: Post(self._context, n, self), {'id': self.userid}, From f85e49d521ca6a838c23213b42acc8c83e9a7e6e Mon Sep 17 00:00:00 2001 From: Alexander Graf <17130992+aandergr@users.noreply.github.com> Date: Wed, 17 Feb 2021 16:31:00 +0100 Subject: [PATCH 2/6] Spare unnecessary full metadata fetch This fetch was done for sidecar posts that contain a video when going through a profile. The fetched information is already present with the new profile query introduced in the last commit, making this full metadata fetch query unnecessary. Instaloader now better evaluates if that fetch must be done or not. The fetch was also (eventually unnecessarily) made when accessing get_sidecar_posts() on a Post that has been loaded with load_structure_from_file(). --- instaloader/structures.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instaloader/structures.py b/instaloader/structures.py index 9b448ce..ad21ad8 100644 --- a/instaloader/structures.py +++ b/instaloader/structures.py @@ -273,7 +273,7 @@ class Post: """ if self.typename == 'GraphSidecar': edges = self._field('edge_sidecar_to_children', 'edges') - if any(edge['node']['is_video'] for edge in edges): + if any(edge['node']['is_video'] and 'video_url' not in edge['node'] for edge in edges): # video_url is only present in full metadata, issue #558. edges = self._full_metadata['edge_sidecar_to_children']['edges'] if end < 0: From 9fb112faa8bcb3dd1b1f9d4fd8e610c02044e8ba Mon Sep 17 00:00:00 2001 From: Thomas <71355143+thomas694@users.noreply.github.com> Date: Sat, 20 Feb 2021 10:17:57 +0100 Subject: [PATCH 3/6] Fix issue 892 Save content using original filenames (PR 893) (#1025) - When a post contained sidecars, the filename for caption, json etc. was changed. It was no longer the original filename like before. - If the post contains sidecars, a local variable is used to build the filenames for the sidecar media. --- instaloader/instaloader.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/instaloader/instaloader.py b/instaloader/instaloader.py index 90ff125..dcada87 100644 --- a/instaloader/instaloader.py +++ b/instaloader/instaloader.py @@ -563,23 +563,20 @@ class Instaloader: post.get_sidecar_nodes(self.slide_start, self.slide_end), start=post.mediacount if self.slide_start < 0 else self.slide_start + 1 ): + suffix = str(edge_number) # type: Optional[str] + if '{filename}' in self.filename_pattern: + suffix = None if self.download_pictures and (not sidecar_node.is_video or self.download_video_thumbnails): - suffix = str(edge_number) - if '{filename}' in self.filename_pattern: - suffix = '' # pylint:disable=cell-var-from-loop - filename = self.__prepare_filename(filename_template, lambda: sidecar_node.display_url) + sidecar_filename = self.__prepare_filename(filename_template, lambda: sidecar_node.display_url) # Download sidecar picture or video thumbnail (--no-pictures implies --no-video-thumbnails) - downloaded &= self.download_pic(filename=filename, url=sidecar_node.display_url, + downloaded &= self.download_pic(filename=sidecar_filename, url=sidecar_node.display_url, mtime=post.date_local, filename_suffix=suffix) if sidecar_node.is_video and self.download_videos: - suffix = str(edge_number) - if '{filename}' in self.filename_pattern: - suffix = '' # pylint:disable=cell-var-from-loop - filename = self.__prepare_filename(filename_template, lambda: sidecar_node.video_url) + sidecar_filename = self.__prepare_filename(filename_template, lambda: sidecar_node.video_url) # Download sidecar video if desired - downloaded &= self.download_pic(filename=filename, url=sidecar_node.video_url, + downloaded &= self.download_pic(filename=sidecar_filename, url=sidecar_node.video_url, mtime=post.date_local, filename_suffix=suffix) elif post.typename == 'GraphImage': # Download picture From dfdd744804efda39ec36cb8cf8ec436104f13894 Mon Sep 17 00:00:00 2001 From: Alexander Graf <17130992+aandergr@users.noreply.github.com> Date: Wed, 24 Feb 2021 16:00:28 +0100 Subject: [PATCH 4/6] Minor fixes to top-level README.md --- README.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 4dbd5b5..c8e1388 100644 --- a/README.rst +++ b/README.rst @@ -29,7 +29,7 @@ .. |downloads| image:: https://pepy.tech/badge/instaloader/month :alt: PyPI Download Count - :target: https://pepy.tech/project/instaloader/month + :target: https://pepy.tech/project/instaloader .. badges-end @@ -84,7 +84,9 @@ To later **update your local copy** of that profiles, you may run instaloader --fast-update profile [profile ...] If ``--fast-update`` is given, Instaloader stops when arriving at the -first already-downloaded picture. When updating profiles, Instaloader +first already-downloaded picture. + +When updating profiles, Instaloader automatically **detects profile name changes** and renames the target directory accordingly. From a4bb3534219ce0236684c98c3b27b4dd506cf791 Mon Sep 17 00:00:00 2001 From: Alexander Graf <17130992+aandergr@users.noreply.github.com> Date: Wed, 24 Feb 2021 16:01:22 +0100 Subject: [PATCH 5/6] docs: Enhance description of --resume-prefix --- docs/cli-options.rst | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/cli-options.rst b/docs/cli-options.rst index 3f7a4bb..ea21517 100644 --- a/docs/cli-options.rst +++ b/docs/cli-options.rst @@ -220,12 +220,20 @@ How to Download used to save the information to resume an interrupted download. The default prefix is ``iterator``. - Resuming an interrupted download is supported for most, but not all targets. + Resuming an interrupted download is supported for the following targets: + - Profile posts, + - Profile IGTV posts (:option:`--igtv`), + - Profile tagged posts (:option:`--tagged`), + - Saved posts (``:saved``). + + This feature is enabled by default for targets where it is supported; + :option:`--resume-prefix` only changes the name of the iterator files. + + To turn this feature off, use :option:`--no-resume`. + JSON files with resume information are always compressed, regardless of :option:`--no-compress-json`. - This feature is turned off entirely with :option:`--no-resume`. - .. versionadded:: 4.5 .. option:: --no-resume From 0f11ef1bddfb652a5f7cd93600a21031e97ed4ff Mon Sep 17 00:00:00 2001 From: Alexander Graf <17130992+aandergr@users.noreply.github.com> Date: Wed, 24 Feb 2021 16:01:33 +0100 Subject: [PATCH 6/6] Release of version 4.6.2 --- instaloader/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instaloader/__init__.py b/instaloader/__init__.py index 15d438f..2badb88 100644 --- a/instaloader/__init__.py +++ b/instaloader/__init__.py @@ -1,7 +1,7 @@ """Download pictures (or videos) along with their captions and other metadata from Instagram.""" -__version__ = '4.6.1' +__version__ = '4.6.2' try: