How to write your code fast for YouTube shorts, Instagram reels and Tiktok

How to write your code fast for YouTube shorts, Instagram reels and Tiktok

ยท

2 min read

Hi coders ๐Ÿ˜Ž, Python is probably one of the coolest languages. And the fascinating thing about it is that you can automate day-to-day tasks.

One such task we do every day is to create reels for the Instagram.

Although this task is as simple as without touching a keyboard, write a code faster. Definitely, you can by using a python library.

The best part of programming is the triumph of seeing the machine do something useful. Automate the Boring Stuff with Python frames all of programming as these small triumphs; it makes the boring fun. - Hilary Mason

Note : this automation works only on notepad and nano editor.

Step 1 : Install python library

pip install PyAutoGUI
pip install keyboard

Open up a terminal and run the following command.

Step 2 : create python file

Write this code

import time
import sys
import os
import pyautogui
from keyboard import *

animation = "|/-\\"
default = 0

print("--- Automation ---\n\n")
print("1. Notepad\n2. Nano\n3. Exit\n")

option = input("select option : ") or '3'

if option in '1':
    path_file = input("Enter File Path : ")
    timing = float(input("Enter timing ex(0.2) : ") or default)
    path_file.replace("\\", "/")

    if len(path_file)==0:
        print("Error")
    else:
        work = open(path_file, 'r')
        op = work.read()

        for i in range(50):
            time.sleep(0.1)
            sys.stdout.write("\rwait 3s " + animation[i % len(animation)])
            sys.stdout.flush()

        write(op,timing)
        work.close()

elif option in '2':
    path_file = input("Enter File Path : ")
    timing = float(input("Enter timing ex(0.2) : ") or default)
    path_file.replace("\\", "/")

    if len(path_file)==0:
        print("Error")
    else:
        work = open(path_file, 'r')
        op = work.read()

        for i in range(50):
            time.sleep(0.1)
            sys.stdout.write("\rwait 3s " + animation[i % len(animation)])
            sys.stdout.flush()

        write(op,timing)
        work.close()
        time.sleep(2)
        pyautogui.hotkey('ctrl','x')
        pyautogui.hotkey('y')
        pyautogui.hotkey('enter')

elif option in '3':
    exit()
else:
    print("Error")

print("\n\nDone")

You can also modify this code.

Demo

Final

Alright, guys! I hope this article was helpful for you if you leave your comments below. I will meet you in another article until then KEEP CODING ๐Ÿ›ธ.

Did you find this article valuable?

Support Amit Gajare by becoming a sponsor. Any amount is appreciated!

ย