Mr. T
0
Q:

how to download youtube videos in python

from __future__ import unicode_literals
import youtube_dl

ydl_opts = {}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
    ydl.download(['VideoURL'])
4
# run python -m pip install git+https://github.com/nficano/pytube
# VERY IMPORTANT, IT WILL NOT WORK IF YOU DON'T RUN THAT

import pytube

url = 'https://www.youtube.com/YoutubeLinkGoesHere'
video = pytube.YouTube(url)
stream = video.streams.get_by_itag(22)
stream.download(filename='video')
1
from pytube import YouTube #pip install pytube3
yt=YouTube(YouTubeVideoLink)
stream=yt.streams.first()
stream.download()
-3

New to Communities?

Join the community