Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

pytube mp3

# Pytube dosent accept .mp3 format so the better way to do it is doing a 
# function with os

from pytube import YouTube, Playlist
import os

yt_url = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'

def donwload_mp3():

  	audio = YouTube(yt_url).streams.get_audio_only()
    audio_download = audio.download(output_path='your path')
    base, ext = os.path.splitext(audio_download)
    new_file = base + '.mp3'
    os.rename(audio_download, new_file)
Comment

mp3 download with pytube

import pytube
from pytube import YouTube

print("Give URL:")
url = input()

pytube.YouTube(url).streams.get_highest_resolution().download()
Comment

PREVIOUS NEXT
Code Example
Python :: learn python the hard way pdf 
Python :: how to refresh windows 10 with python 
Python :: python server http one line 
Python :: les librairies python a maitriser pour faire du machine learning 
Python :: train test split stratify 
Python :: standardize columns in pandas 
Python :: plotly grid lines color 
Python :: python pip install from script 
Python :: add column as index pandas 
Python :: python read file csv 
Python :: how to multi random pick from list python 
Python :: split string in the middle python 
Python :: how to install flask 
Python :: how to increase height of entry in tkinter 
Python :: cv2 hconcat 
Python :: pandas groupby count as new column 
Python :: python get all images in directory 
Python :: get python version in code 
Python :: python for loop jump by 2 
Python :: f string curency format 
Python :: draw bounding box on image python cv2 
Python :: create text in python if not exists 
Python :: seaborn increace figure size 
Python :: csrf token exempt django 
Python :: ctrl c selenium python 
Python :: django admin slug auto populate 
Python :: send image discord.py 
Python :: python first two numbers 
Python :: run flask application in development mode stack overflow 
Python :: python read dictionary from file 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =