
Cortt
Prompt
Build a **fully functional desktop Instagram media downloader application in Python**, inspired by the workflow and clean simplicity of websites such as InDown. Do not copy InDown's branding, logo, proprietary UI, or source code. Create an original application with a polished modern GUI. ## 1. Technology Use: * Python 3.11+ * PySide6 for the GUI * `yt-dlp` for media extraction/downloading where supported * `requests` for HTTP operations * `Pillow` for image processing/thumbnails * SQLite for download history * `pathlib` for filesystem management * `threading` or `QThread` so downloads never freeze the GUI Structure the project professionally: ```text instagram_downloader/ β βββ main.py βββ requirements.txt βββ README.md β βββ gui/ β βββ main_window.py β βββ styles.py β βββ widgets.py β βββ dialogs.py β βββ core/ β βββ downloader.py β βββ extractor.py β βββ thumbnail.py β βββ validator.py β βββ database/ β βββ history.py β βββ utils/ β βββ filesystem.py β βββ settings.py β βββ assets/ β βββ icons/ β βββ downloads/ ``` ## 2. Main GUI Create a modern dark-themed desktop interface. The main window should contain: ### Header * App name: `InstaFetch` * Small subtitle: `Instagram Media Downloader` * Settings button * About button ### URL input section Large rounded input field: `Paste Instagram URL here...` Next to it: `Analyze` Below the field: `Supported: Posts β’ Reels β’ Videos β’ Images` Validate URLs before attempting extraction. Do not request or store Instagram passwords, session cookies, or login credentials. ## 3. Analyze workflow When the user pastes a supported public Instagram URL and clicks **Analyze**: 1. Validate the URL. 2. Start extraction in a background thread. 3. Display an animated loading indicator. 4. Attempt to retrieve available public media information. 5. Display: * Thumbnail * Media type * Title/caption when available * Available quality * File format * Estimated file size when available If extraction fails, show a useful error message instead of crashing. Example: ```text Unable to retrieve this media. Possible reasons: β’ The post is private β’ Instagram changed its response format β’ The URL is invalid β’ The media is unavailable β’ Network connection failed ``` ## 4. Download controls After successful analysis show: ### Quality Dropdown: * Best available * 1080p * 720p * 480p * Audio only (when applicable) ### Format Dropdown: * MP4 * JPG * PNG * Original/Best ### Save location Show: ```text Downloads/Instagram ``` with a `Browse` button. Main action: `Download` ## 5. Download progress Downloads must happen asynchronously. Show: ```text Downloading... ββββββββββββββββββββ 78% 12.4 MB / 15.8 MB 3.2 MB/s Estimated remaining: 1.1 sec ``` Include: * Progress bar * Download speed * Downloaded size * Total size * Cancel button The GUI must remain responsive during downloads. ## 6. Download completion After completion display a success card: ```text β Download completed filename.mp4 15.8 MB [Open File] [Open Folder] ``` Automatically add the download to history. ## 7. Download history Create a separate History panel. Store: * URL * filename * media type * format * quality * file size * download date * local path * download status Provide: * Search history * Sort by newest/oldest * Open file * Open containing folder * Delete history entry * Clear history Deleting history should not automatically delete the actual downloaded file unless the user explicitly chooses that option. ## 8. Multiple URLs Add a **Batch Downloader** mode. Allow the user to paste multiple URLs: ```text https://instagram.com/... https://instagram.com/... https://instagram.com/... ``` Provide: `Analyze All` and: `Download All` Display individual progress for each item. Limit concurrency to a reasonable number so the application does not overwhelm the network or service. ## 9. Settings Create a Settings dialog containing: ### Downloads * Default download folder * Automatically open folder after download * Filename template Example: ```text {username}_{date}_{id} ``` ### Appearance * Dark * Light * System ### Behavior * Remember last download location * Confirm before deleting history * Show desktop notification after download ### Network * Request timeout * Retry count Do not provide options intended to bypass authentication, access controls, rate limits, or private content. ## 10. Error handling Handle errors gracefully. Possible errors: * Invalid URL * Unsupported URL * Private content * Removed content * Network timeout * Connection failure * Extraction failure * Disk full * Permission denied * Unsupported media * yt-dlp failure Never allow an exception to crash the application. Show human-readable error messages and log technical details to: ```text logs/app.log ``` ## 11. Security and privacy The application must: * Never ask for Instagram passwords. * Never collect credentials. * Never upload downloaded media to your own server. * Store settings locally. * Store history locally in SQLite. * Sanitize filenames before saving. * Prevent path traversal through malicious filenames. * Avoid executing downloaded files automatically. Only download content the user is authorized to access and use, and respect Instagram's terms and applicable copyright/privacy laws. ## 12. UI design Make the interface look like a modern professional desktop application rather than a basic Tkinter utility. Design language: * Dark navy/black background * Rounded cards * Subtle borders * Blue/cyan accent * Large URL input * Smooth hover states * Clean typography * Consistent spacing * Minimal icons * Responsive layout Use Qt stylesheets rather than hard-coded styling throughout the application. ## 13. Architecture Separate GUI logic from downloading logic. The GUI must never directly perform long-running network operations. Use signals/slots to communicate between worker threads and the GUI. Example architecture: ```text GUI β βββ URL Validator β βββ Extraction Worker β β β βββ yt-dlp β βββ Download Worker β β β βββ Progress Signals β βββ History Manager β β β βββ SQLite β βββ Settings Manager ``` ## 14. yt-dlp integration Integrate yt-dlp programmatically rather than requiring the user to manually run terminal commands. Capture: * progress * speed * ETA * filename * errors * completion status Use yt-dlp's Python API and progress hooks. Do not expose arbitrary shell-command execution through the GUI. ## 15. Filename handling Automatically generate safe filenames. Example: ```text instagram_2026-09-13_ABC123.mp4 ``` Remove invalid Windows characters: ```text < > : " / \ | ? * ``` Prevent filenames such as: ```text ../../malicious.exe ``` ## 16. First-run experience On first launch display: ```text Welcome to InstaFetch Download publicly accessible Instagram media directly to your computer. Your downloads and history remain local. [Get Started] ``` Then open the main downloader interface. ## 17. About dialog Include: ```text InstaFetch A local desktop media downloader. Built with Python + PySide6 + yt-dlp. This application is an independent project and is not affiliated with Instagram or Meta. ``` ## 18. Requirements Generate a complete: ```text requirements.txt ``` and: ```text README.md ``` README must explain: * Installation * Python version * Installing dependencies * Running the application * Building an executable * Troubleshooting * Privacy * Legal/usage considerations ## 19. Windows executable Provide instructions for packaging the application as: ```text InstaFetch.exe ``` using PyInstaller. The final project should work on Windows 10/11. ## 20. Quality requirements The final implementation must NOT be a mockup. Every major button must perform its intended function. Do not create fake progress bars. Do not use placeholder download functions. Do not hard-code example media. Do not require a web browser for normal downloading. Make the application runnable after installing the dependencies. Before finishing, test the following: 1. Application launches. 2. URL validation works. 3. Invalid URLs produce useful errors. 4. Extraction runs without freezing the GUI. 5. Download progress updates correctly. 6. Download cancellation works. 7. Files are saved correctly. 8. History is persisted after restarting the app. 9. Settings persist after restarting. 10. Network/extraction errors do not crash the application. Finally, provide the complete project code file-by-file and exact commands for installation and execution.