Questions tagged [pytube]

For issues relating to the pytube Python library.

pytube is a lightweight, dependency-free library (and command-line utility) for downloading Videos.

Features

  • Support for Both Progressive & DASH Streams
  • Easily Register on_download_progress & on_download_complete callbacks
  • Command-line Interfaced Included
  • Caption Track Support
  • Outputs Caption Tracks to .srt format (SubRip Subtitle)
  • Ability to Capture Thumbnail URL.
  • Extensively Documented Source Code
  • No Third-Party Dependencies

Where to learn more

256 questions
11
votes
8 answers

Download video in mp3 format using pytube

I have been using pytube to download youtube videos in python. So far I have been able to download in mp4 format. yt = pytube.YouTube("https://www.youtube.com/watch?v=WH7xsW5Os10") vids= yt.streams.all() for i in range(len(vids)): print(i,'.…
Muhammad Khan
  • 687
  • 1
  • 9
  • 25
8
votes
2 answers

Python download youtube with specific filename

I'm trying to download youtube videos with pytube this way: from pytube import YouTube YouTube('http://youtube.com/watch?v=9bZkp7q19f0').streams.first().download() but the file will have the same name as the original video name. How do I specify a…
ehsan shirzadi
  • 4,138
  • 12
  • 57
  • 99
7
votes
1 answer

How to add tqdm to show progress bar when downloading you tube video with pytube?

I am learning pytube to download Youtube video and tried tqdm on top of it to show progress bar but it shows various error and also I could not understand what is happening when I download video with pytube and showing progress bar which is the…
5
votes
1 answer

getting Http error 404 in Pytube. What is reason for this?

This code used to work 4 days back now it is showing error. I tried using pytube3 but that does not help. from pytube import YouTube** YouTube('https://www.youtube.com/watch?v=JbBsqmKclXE').streams** HTTPError …
shadow5893
  • 131
  • 2
  • 8
5
votes
11 answers

Pytube only works periodically (KeyError: 'assets')

Five out of ten times Pytube will send me this error when attempting to run my small testing script. Here's the script: import pytube import urllib.request from pytube import YouTube yt =…
theboy
  • 215
  • 2
  • 9
5
votes
1 answer

PyTube3 Playlist returns empty list

It seems that sometime in the past 2 or 3 weeks, the Playlist class seems to have stopped working for me. I've tried the following code snippet adapted from their GitHub: from pytube import Playlist playlist =…
Maelstrom
  • 958
  • 3
  • 13
5
votes
3 answers

ImportError: cannot import name 'quote'

I have learned basics of python, so tried this code below from pytube import YouTube Save_path="E:\python\youtube downloader" link="https://www.youtube.com/watch?v=xWOoBJUqlbI" try: yt=YouTube(link) except: print("Connection…
5
votes
5 answers

Why my YouTube video downloader only downloads some videos and for other videos it shows keyerror like URL and cipher?

I am trying to make a YouTube video downloader using Python pytube3 but it doesn't download all the videos. Some videos download very easily but some videos won't download and instead of download it shows error: Exception in Tkinter…
Tarun
  • 53
  • 1
  • 5
5
votes
3 answers

KeyError: 'url_encoded_fmt_stream_map'

I am trying to make a code which can download the entire playlist from YouTube. It worked for some playlist but not working for few playlists. One of the playlist I have shown in my code below. Also feel free to add more features on this code. If…
vardhan.negi
  • 362
  • 1
  • 4
  • 15
5
votes
5 answers

Using Pytube to download playlist from YouTube

I am looking to download a YouTube playlist using the PyTube library. Currently, I am able to download a single video at a time. I cannot download more than one video at once. Currently, my implimentation is import pytube link = input('Please enter…
Anish Mazumdar
  • 115
  • 1
  • 1
  • 7
5
votes
2 answers

AttributeError: 'YouTube' object has no attribute 'get_videos'

While trying to download a YouTube video from python, I come across this error AttributeError: 'YouTube' object has no attribute 'get_videos'. Last line causes the error. import pytube link = "" yt = pytube.YouTube(link) videos =…
user9594573
  • 79
  • 1
  • 5
5
votes
1 answer

Download audio from YouTube using pytube

I'm using pytube and Python 3.5 to download videos from YouTube but I need to convert the videos to audio with an .avi extension. Here is my code that I'm currently working with: from pytube import YouTube yt = YouTube(str(input("Enter the video…
omar harchich
  • 59
  • 1
  • 5
5
votes
5 answers

How to add progress bar?

Is there a way to add progress bar in pytube? I don't know how to use the following method: pytube.Stream().on_progress(chunk, file_handler, bytes_remaining) My code: from pytube import YouTube # from pytube import Stream from general import…
Gayan Jeewantha
  • 115
  • 1
  • 1
  • 7
4
votes
3 answers

Getting KeyError: 'url' with PyTube

I get the error sometimes when downloading a video. For example, I can attempt to download the video and it will download, the next time I run the script that video will not download and the error will be thrown. def…
mruss24
  • 339
  • 1
  • 4
  • 13
4
votes
6 answers

Getting Error with Pytube: signature = cipher.get_signature(js, stream['s']) KeyError: 's'

I have been this error when running my Pytube script: signature = cipher.get_signature(js, stream['s']) KeyError: 's' My code is like this: url = 'https://www.youtube.com/watch?v=' train_List = [] i = 0 while i <…
topplethepat
  • 419
  • 4
  • 18
1
2 3
17 18