Upload 2 files
Browse files
main.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import pandas as pd
|
3 |
+
from pytube import YouTube
|
4 |
+
import base64
|
5 |
+
from io import BytesIO
|
6 |
+
|
7 |
+
|
8 |
+
def main():
|
9 |
+
path = st.text_input('Enter URL of any youtube video')
|
10 |
+
option = st.selectbox(
|
11 |
+
'Select type of download',
|
12 |
+
('audio', 'highest_resolution', 'lowest_resolution'))
|
13 |
+
|
14 |
+
matches = ['audio', 'highest_resolution', 'lowest_resolution']
|
15 |
+
if st.button("download"):
|
16 |
+
video_object = YouTube(path)
|
17 |
+
st.write("Title of Video: " + str(video_object.title))
|
18 |
+
st.write("Number of Views: " + str(video_object.views))
|
19 |
+
if option == 'audio':
|
20 |
+
video_object.streams.get_audio_only().download() # base64.b64encode("if file is too large").decode()
|
21 |
+
elif option == 'highest_resolution':
|
22 |
+
video_object.streams.get_highest_resolution().download()
|
23 |
+
elif option == 'lowest_resolution':
|
24 |
+
video_object.streams.get_lowest_resolution().download()
|
25 |
+
if st.button("view"):
|
26 |
+
st.video(path)
|
27 |
+
|
28 |
+
main()
|
puka.txt
ADDED
Binary file (2.48 kB). View file
|
|