summaryrefslogtreecommitdiffstats
path: root/server/download_script.py
diff options
context:
space:
mode:
authorLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2024-06-28 12:31:31 +0530
committerLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2024-06-28 12:31:31 +0530
commitc2025cfdf07a56859c447a4eac7e1546f4a168ae (patch)
treebb5c26c620f28059f1c447fb22473ab4e2f4f4ef /server/download_script.py
parentaf92d9f12534021ccb35e0328daec8fdc72c0ba2 (diff)
downloadinsta-local-c2025cfdf07a56859c447a4eac7e1546f4a168ae.tar.gz
insta-local-c2025cfdf07a56859c447a4eac7e1546f4a168ae.tar.bz2
insta-local-c2025cfdf07a56859c447a4eac7e1546f4a168ae.zip
arranged dir
Diffstat (limited to 'server/download_script.py')
-rw-r--r--server/download_script.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/server/download_script.py b/server/download_script.py
new file mode 100644
index 0000000..d6e03bc
--- /dev/null
+++ b/server/download_script.py
@@ -0,0 +1,25 @@
+
+import instaloader
+import os
+
+L = instaloader.Instaloader()
+L.login('xtester2', 'teTeD7QojvhOdvEGa50u6FFJo')
+PROFILES = ["aao.remote.ho.jaye"]
+BASE_DIR = "/home/genos/imp/work/project/insta/server/downloads"
+
+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)
+ \ No newline at end of file