import instaloader import os def download_saved_videos(username, password): # Create an Instaloader instance L = instaloader.Instaloader() # Login (optional) L.login(username, password) # Login if you need to access private saved videos # Obtain profile metadata profile = instaloader.Profile.from_username(L.context, username) # Create the download directory if it doesn't exist download_dir = "ig_downloads" os.makedirs(download_dir, exist_ok=True) # Iterate over saved posts for post in profile.get_saved_posts(): # Check if the post is a video and if it's in the "dlq" subfolder if post.typename == "GraphVideo" and "dlq" in post.url: try: # Download the video to the specified directory L.download_post(post, target=download_dir) print(f"Downloaded video: {post.shortcode}") except Exception as e: print(f"Error downloading video {post.shortcode}: {e}") # Replace 'your_username' and 'your_password' with your Instagram username and password respectively # download_saved_videos('your_username', 'your_password') download_saved_videos('luctrudel69', 'k#gn6td6!DBtR7h3EX')