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

528 questions
6
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 =…
Chris du Plessis
  • 1,250
  • 7
  • 13
6
votes
5 answers

Getting the title of youtube video in pytube3?

I am trying to build an app to download YouTube videos in python using pytube3. But I am unable to retrieve the title of the video. Here goes my code: from pytube import YouTube yt = YouTube(link) print(yt.title) No matter whatever is the link I…
satyamdalai
  • 61
  • 1
  • 2
  • 3
6
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
  • 367
  • 2
  • 6
  • 14
5
votes
1 answer

pytube.exceptions.RegexMatchError: get_transform_object: could not find match for var for={(.*?)};

While downloading a video using the PyTube library using this code: yt.streams.get_highest_resolution().download("PATH", f"PATH.mp4") I get an error: raise RegexMatchError(caller="get_transform_object",…
Hajo Brandt
  • 113
  • 7
5
votes
2 answers

"fmpeg" has no attribute "input"

I had previously built this youtube downloader but when I tested it recently; it stopped working. from pytube import YouTube import ffmpeg import os raw = 'C:\ProgramData\ytChache' path1 = 'C:\ProgramData\ytChache\Video\\' path2 =…
Robin Singh
  • 51
  • 1
  • 3
5
votes
1 answer

Pytube Error: get_throttling_function_name: could not find match for multiple

I am trying to download YouTube playlist from url "https://www.youtube.com/watch?v=uyVYfSNb_Pc&list=PLBxwSeQlMDNiNt72UmSvKBLsxPgGY_Jy-", but getting the error 'get_throttling_function_name: could not find match for multiple'. Code block is: ` from…
kishore naidu
  • 141
  • 3
  • 11
5
votes
4 answers

xml to srt conversion not working after installing pytube

I have installed pytube to extract captions from some youtube videos. Both the following code give me the xml captions. from pytube import YouTube yt = YouTube('https://www.youtube.com/watch?v=4ZQQofkz9eE') caption =…
Sandra
  • 91
  • 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
  • 353
  • 2
  • 10
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…
zircon
  • 742
  • 1
  • 10
  • 22
4
votes
1 answer

pytube takes too long to stream a video in Android

I am using pytube to stream a video in Android, with the help of chaquopy. videofile.py from pytube import YouTube def video(link): yt = YouTube(f'https://www.youtube.com/watch?v=' + link) stream_url =…
George
  • 255
  • 8
4
votes
1 answer

pytube: AttributeError: 'NoneType' object has no attribute 'span' cipher.py

Yesterday this works fine, today i'm getting error on my local machine, colab notebook, even on my VPS. /usr/local/lib/python3.9/dist-packages/pytube/cipher.py in get_throttling_plan(js) 409 match = plan_regex.search(raw_code) 410 -->…
4
votes
1 answer

If statement does not work properly unless I use a debugger to step through it. Using pytube

I'm using pytube to convert a url that is for sure a link to a YouTube playlist into a pytube.Playlist() if "/playlist?list=" in url: playlist = Playlist(url) if len(playlist.video_urls._elements) == 0: print("Some…
MyPing0
  • 63
  • 4
4
votes
2 answers

Why do I get HTTP error 410 when trying to download YouTube videos with pytube?

I want to download YouTube videos with Python. I tried opencv with Python, but there was always a problem. I am trying to use pytube3 and Python 3. I tried this program (that I found on StackOverflow): from pytube import…
Ryan358
  • 51
  • 1
  • 2
4
votes
1 answer

Download a file without storing it

I'm building a Youtube Video Downloader using PyTube and Flask. What I want to do is the end user receives the video file, but I never store it into the server. Currently the code looks like this: def download_video(): if request.method == "POST": …
4
votes
1 answer

Extract audio from YouTube video

I'm trying to extract the audio from a pytube video, then convert it into wav format. For extracting the audio from the video, I tried to use moviepy, but I can't find a way to open a video file from bytes with VideoFileClip. I don't want to keep…
MmBaguette
  • 340
  • 3
  • 13
1
2
3
34 35