youtube_to_mp3 / app.py
Ibtehaj10's picture
Upload 2 files
34b3dac
import subprocess
import os
from IPython.display import Audio
import urllib.request
import streamlit as st
import streamlit.components.v1 as components
from PIL import Image
# with open('style.css') as f:
# st.markdown(f'<style>{f.read()}</style>',unsafe_allow_html=True)
def main():
title = "Youtube to audio coversion tool by Proxima PK"
st.title(title)
# image = Image.open('PROXIMA LOGO.png')
# st.image(image, use_column_width=True)
with st.spinner(f'Downloading Audio.... '):
link = st.text_input('youtube link')
st.write('The current vedio link you give is ', link)
yt="https://youtu.be/7wtfhZwyrcc"
b =" youtube-dl --extract-audio --audio-format wav {} ".format(link)
c = "youtube-dl --get-title {}".format(link)
download = subprocess.call(b,shell=True)
name=subprocess.check_output(c)
a = str(name)
x = a.replace("b'", "")
print(x)
v = x.replace("n'", "")
print(v)
finalname = v.replace(v[-1], "")
print(finalname)
st.write(finalname)
if __name__ == '__main__':
main()