Python Automation for Media Collection and Instagram ReelsPython Automation for Media Collection and Instagram Reels
The network for creativity
Join 1.25M professional creatives like you
Connect with clients, get discovered, and run your business 100% commission-free
Creatives on Contra have earned over $150M and we are just getting started
Python Automation Project: Media Collection & Instagram Reels Generator
Project Overview
I built a personal Python automation project as a practical learning exercise to explore web scraping, browser automation, file management, and automated video production.
The project combines several Python scripts into a workflow for collecting media, organizing files, creating short-form videos, adding background music, and preparing content for Instagram Reels.
What I Built
1. Media Collection with Python
Developed a Python script to collect photo-page URLs from Pexels using Selenium and Chrome automation, then retrieve and save image files using Requests. The script includes scrolling, duplicate-link filtering, manual CAPTCHA handling when required, and progress logging.
2. Automated File Renaming
Created a file-management script that scans an image directory, identifies supported image formats, sorts filenames, and renames files sequentially. A two-stage renaming process helps avoid filename conflicts when existing files already use numeric names.
3. Automated Video Editing
Developed a Python script using MoviePy to combine multiple source videos into a single short-form video. The workflow selects random sections from source clips, shuffles their order, adjusts clip durations to fit a target runtime, and combines the clips into a continuous video.
4. Background Music Integration
Implemented audio processing to add background music, trim longer audio tracks, and repeat shorter tracks when necessary to match the target video duration.
5. MP4 Export and Output Management
Configured the output resolution, frame rate, video codec, audio codec, and bitrate. The generated videos are saved automatically to a designated output folder.
Technologies Used
Python
Selenium
Undetected ChromeDriver
Requests
MoviePy
OS and file-system operations
Randomization and timing logic
MP4 video and audio processing
What I Learned
This project helped me practise browser automation, extracting links from web pages, downloading files, handling errors, organizing large collections of media, and building reusable automation workflows with Python.
The project was developed for personal learning and experimentation with short-form social media content. It demonstrates my interest in applying Python to practical automation tasks and developing more advanced web-scraping and data-processing solutions.
I am continuing to expand my Python skills through hands-on projects and experiments.
Post image
Johnson's avatar
The two stage renaming process is a smart addition. It prevents the common script failure where a collision with existing numeric filenames causes the entire batch to stop or overwrite critical assets.
Muhammad's avatar
agree on it ,
Back to feed
The network for creativity
Join 1.25M professional creatives like you
Connect with clients, get discovered, and run your business 100% commission-free
Creatives on Contra have earned over $150M and we are just getting started