Data Collection and Understanding the Stream Object

Learn how to collect the data from YouTube.

Import the libraries

Import the installed libraries and define aliases where needed:

import streamlit as st
from pytube import YouTube

Header and URL input

We’ll add the header and URL input on the Streamlit web interface.

Displaying header and URL input

We’ll use Streamlit’s title() and subheader() functions to add the text. Both of them take a string as a parameter and display it.

For the user input, use the text_input() function. A label can be passed as a parameter.

st.title("YouTube Video Downloader")
st.subheader("Enter the URL:")
url = st.text_input(label='URL')

We’ll store the URL inside a variable url. Every time the user types in an URL and hits the “Enter” key, the ...

Get hands-on with 1400+ tech skills courses.