Instagram

import requests import os def download_instagram_video(url, save_path): try: response = requests.get(url) if response.status_code == 200: video_url = response.json()['graphql']['shortcode_media']['video_url'] video_response = requests.get(video_url) if video_response.status_code == 200: with open(save_path, 'wb') as f: f.write(video_response.content) print("Video downloaded successfully!") else: print("Failed to download video. Status code:", video_response.status_code) else: print("Failed to fetch video details. Status code:", response.status_code) except Exception as e: print("An error occurred:", str(e)) # Example usage: if __name__ == "__main__": instagram_post_url = "https://www.instagram.com/p/CVhDqA1JaBr/" save_location = "downloaded_video.mp4" download_instagram_video(instagram_post_url, save_location)

Comments

Popular posts from this blog

Free Uc from bgmi