diff options
author | Biswakalyan Bhuyan <biswa@surgot.in> | 2024-06-27 21:49:37 +0530 |
---|---|---|
committer | Biswakalyan Bhuyan <biswa@surgot.in> | 2024-06-27 21:49:37 +0530 |
commit | b06cf01e232e797abceabba08aec2c0752db95ad (patch) | |
tree | 5ddc055ad7157b30b3c4a861f28826fb937f5e70 /download_script.py | |
parent | f4df54899dd40072d55c96edcd43795a232f9f85 (diff) | |
download | insta-local-b06cf01e232e797abceabba08aec2c0752db95ad.tar.gz insta-local-b06cf01e232e797abceabba08aec2c0752db95ad.tar.bz2 insta-local-b06cf01e232e797abceabba08aec2c0752db95ad.zip |
update
Diffstat (limited to 'download_script.py')
-rw-r--r-- | download_script.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/download_script.py b/download_script.py new file mode 100644 index 0000000..be29fcc --- /dev/null +++ b/download_script.py @@ -0,0 +1,24 @@ + +import instaloader +import os + +L = instaloader.Instaloader() +L.login('xtester2', 'teTeD7QojvhOdvEGa50u6FFJo') +PROFILES = ["aao.remote.ho.jaye"] +BASE_DIR = "/home/genos/imp/work/project/insta/downloads/2024-06-27" + +os.makedirs(BASE_DIR, exist_ok=True) + +def download_posts(profile): + profile_dir = os.path.join(BASE_DIR, profile) + os.makedirs(profile_dir, exist_ok=True) + L.dirname_pattern = profile_dir + posts = instaloader.Profile.from_username(L.context, profile).get_posts() + for post in posts: + if post.typename == 'GraphVideo': # Only download videos + L.download_post(post, target=profile) + elif post.typename == 'GraphImage': # Only download images + L.download_post(post, target=profile) + +for profile in PROFILES: + download_posts(profile) |