def download_video(url, save_path):
loader = instaloader.Instaloader()
try:
post = instaloader.Post.from_shortcode(loader.context, url.split("/")[-2])
video_url = post.video_url
response = requests.get(video_url, stream=True)
if response.status_code == 200:
with open(save_path, 'wb') as file:
response.raw.decode_content = True
shutil.copyfileobj(response.raw, file)
print("Video downloaded successfully!")
else:
print("Failed to download the video.")
except Exception as e:
print("Failed to download the video:", str(e))
I created this function to download Instagram video from its url, I add this on my website. Problem: Its was working fine when I wasn't using on my website, I want it available for everyone online
Error : Failed to download the video:
[Errno 13] Permission denied.
How can I fix it so that it can download in users downloads folder and on mobile?