From 70c91e000e75f1342c0c607cdd60aca548ce1bfd Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Sat, 17 Sep 2016 20:51:17 +0200 Subject: [PATCH] Targets :feed-all and :feed-liked to load feed Closes #14. --- README.md | 5 +++++ instaloader.py | 17 +++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index eaecd81..dbb0ab5 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,11 @@ If you want to **download all followees of a given profile**, call ./instaloader.py --login=your_username @profile ``` +To **download all the pictures which you have liked**, call +``` +./instaloader.py --login=your_username :feed-liked +``` + The `--quiet` option makes it also **suitable as a cron job**. To get a list of other helpful flags, run `./instaloader.py --help`. diff --git a/instaloader.py b/instaloader.py index 5b18fbf..ad99e28 100755 --- a/instaloader.py +++ b/instaloader.py @@ -563,6 +563,17 @@ def download_profiles(profilelist, username=None, password=None, sessionfile=Non log("Retrieving followees of %s..." % pentry[1:], quiet=quiet) followees = get_followees(pentry[1:], session) targets.update([followee['username'] for followee in followees]) + elif pentry == ":feed-all" and username is not None: + log("Retrieving pictures from your feed...", quiet=quiet) + download_feed_pics(session, fast_update=fast_update, + download_videos=download_videos, shorter_output=shorter_output, + sleep=sleep, quiet=quiet) + elif pentry == ":feed-liked" and username is not None: + log("Retrieving pictures you liked from your feed...", quiet=quiet) + download_feed_pics(session, fast_update=fast_update, + filter_func=lambda node: not node["likes"]["viewer_has_liked"], + download_videos=download_videos, shorter_output=shorter_output, + sleep=sleep, quiet=quiet) else: targets.add(pentry) if len(targets) == 0: @@ -590,8 +601,10 @@ def main(): parser = ArgumentParser(description='Simple downloader to fetch all Instagram pics and '\ 'captions from a given profile') parser.add_argument('profile', nargs='*', - help='Name of profile to download, or @ to download all followees of '\ - '') + help='Name of profile to download; @ to download all followees of ' + '; or the special targets :feed-all or :feed-liked to ' + 'download pictures from your feed if --login is given (using ' + '--fast-update is recommended).') parser.add_argument('--version', action='version', version='1.0.1') parser.add_argument('-l', '--login', metavar='YOUR-USERNAME',