Member-only story

Python script to download and cut youtube video.

krishankant singhal
4 min readAug 21, 2023

--

Recently i was willing to download and cut youtube video. however i was not able to find any tool which can download and cut the youtube video. so decided to look into it and create a python script which can download and cut the video for duration specified.

Below script creates a GUI application that allows users to enter a YouTube URL, select start and end times, choose video format and resolution, preview the video, and cut/download the video using ffmpeg. The script demonstrates the use of the tkinter library for creating a user interface and the pytube library for interacting with YouTube videos.

Scipt

import tkinter as tk
from pytube import YouTube
import subprocess
from tkinter import ttk
from tkinter import filedialog


class YouTubeDownloaderCutterApp:
def __init__(self, root):
self.root = root
self.root.title("YouTube Downloader and Cutter")

self.url_label = tk.Label(root, text="YouTube URL:")
self.url_label.pack()

self.url_entry = tk.Entry(root)
self.url_entry.pack()
self.url_entry.bind("<FocusOut>", self.update_options_and_metadata)

self.start_label = tk.Label(root, text="Start Time (HH:MM:SS):")
self.start_label.pack()

self.start_entry = tk.Entry(root)
self.start_entry.pack()

self.end_label = tk.Label(root, text="End Time (HH:MM:SS):")
self.end_label.pack()

self.end_entry = tk.Entry(root)
self.end_entry.pack()

self.format_label…

--

--

krishankant singhal
krishankant singhal

Written by krishankant singhal

Angular,Vuejs,Android,Java,Git developer. i am nerd who want to learn new technologies, goes in depth.

Responses (1)