Questions tagged [pafy]

pafy is used to retrieve YouTube content such as video, audio, and metadata such as viewcount, duration, rating, author, resolution, bitrate, format, filesize, thumbnail, keywords, etc.

Features

  • Retrieve metadata such as viewcount, duration, rating, author, thumbnail, keywords
  • Download video or audio at requested resolution / bitrate / format / filesize
  • Command line tool (ytdl) for downloading directly from the command line
  • Retrieve the URL to stream the video in a player such as vlc or mplayer
  • Works with age-restricted videos and non-embeddable videos
  • Small, standalone, single importable module file (pafy.py)
  • Select highest quality stream for download or streaming
  • Download video only (no audio) in m4v or webm format
  • Download audio only (no video) in ogg or m4a format
  • Retrieve playlists and playlist metadata
  • Works with Python 2.6+ and 3.3+
  • Optionally depends on youtube-dl (recommended; more stable)

Full documentation is available at http://pythonhosted.org/pafy

91 questions
0
votes
2 answers

error: (-215:Assertion failed) error when trying to capture youtube video using pafy and openCv

I am trying to access youtube video using opencv and pafy. I followed the instruction given here Is it possible to stream video from https:// (e.g. YouTube) into python with OpenCV? . But after following the instructions i got below mentioned error…
Shantanu Nandan
  • 1,438
  • 8
  • 30
  • 56
0
votes
1 answer

Is there a way to get YT url or video ID from playlist with pafy?

I am trying to make a program that takes YT playlist and play all it's content. I've installed all components needed for pafy to run with python3. Everything I've tried works as it's expected, except the bellow part of the code. plurl =…
krokstr
  • 3
  • 1
0
votes
1 answer

How to remove 'pafy' after installing it using sudo pip install from ubuntu 18.04 running python 3.6?

I installed the pafy's package as super user, but I run python as normal user. So I can't actually use the module. How can I remove it in order to re-install using pip install as normal user? thank you in advance.
0
votes
1 answer

How to force download files through pafy and youtube-dl in Django webapp

I have made a youtube video downloader app with django and pafy. The problem in the final link which I am getting is something like https://r5---sn-gwpa-jj0z-blah-blah. These links are opening files in the browser how to make them downloadable on…
Abhijeet Pal
  • 448
  • 1
  • 8
  • 21
0
votes
0 answers

Unable to display video from Youtube with Python and OpenCV

I am trying to get video from Youtube using Python 3.5, OpenCV 3.4.3 and Pafy 0.5.4. The problem is that cv2.VideoCapture(video_from_url) does not see the video from url. I also have seen this topic previously. Here is the code that works well if…
enoted
  • 577
  • 7
  • 21
0
votes
1 answer

Python slow for-loop in async func

I am trying to and Song-Objects to my Queue-Object, to get the actual songs I loop over a Playlist-Object from the libary Pafy. playlist = pafy.get_playlist("playlist url here") counter = 0 for s in playlist["items"]: counter += 1 s =…
stego
  • 193
  • 2
  • 11
0
votes
1 answer

close current and open a new openCV window if file modified Python

I was wondering if anyone could help me out a bit with this problem I cannot solve. I am using Pafy to search Youtube from a text file that has a song name written in it and that gets a new song every few minutes. I am using Watchdog to watch for…
Luka mikic
  • 23
  • 1
  • 6
0
votes
1 answer

Failed to download file using pafy

I am using Python 2.7 and pafy to download audio file from youtube import pafy video = pafy.new("https://www.youtube.com/watch?v=dcNlEn1LrrE") print video.m4astreams filename = video.m4astreams[0].download(quiet=False) I get the following…
Vadym
  • 136
  • 1
  • 2
0
votes
2 answers

Use a variable from one function within another function with Python

I have a program that downloads video files Here it is in full, don't worry its a short program. import pafy def download(): url = raw_input('Please enter the path to the video\n') video = pafy.new(url) vid_title = video.title best…
Mark Kelly
  • 27
  • 1
  • 9
0
votes
1 answer

Python-Download video from youtube and convert it to mp3

This code downloads the video and convert it to mp3 file. However, the mp3 audio will become 2 times longer than normal video. How can I solve this problem? import pafy import os import moviepy.editor as mp print "[+] Welcome to Youtube…
Less-Owl-4025
  • 33
  • 1
  • 8
0
votes
1 answer

Using pafy for other sites

Does anyone know if there's a way to manipulate the code so you can use pafy on other websites or if there's a different package that works similarly to pafy?
Teddy T
  • 51
  • 1
  • 1
  • 3
0
votes
0 answers

Taking a function stdout output to shell and print it tkinter

I am using the pafy module to download YouTube videos, but in one of the pafy functions, called download it prints to the screen the progress of the download, I would like to take that output and put it in my tkinter window. Here is the pafy…
-1
votes
1 answer

not able to play youtube media using vlc in python

I'm trying to play a random youtube video using pafy and vlc. But when I'm executing the script : import vlc import cv2 url = "Youtube_URL" video = pafy.new(url) best =…
-1
votes
2 answers

Python: How can I stream a audio file (m4a/webm) instead of simply downloading it?

I used pafy module to get the YouTube video's audio download links in m4a and webm formats and i want to steam without simply downloading it. How can i achieve it?? for example: for this link https://www.youtube.com/watch?v=3tmd-ClpJxA [Taylor…
Harry
  • 33
  • 1
  • 9
-1
votes
1 answer

python script for downloading youtube video

I am trying to download a youtube video using python.Below is my code.But it is giving me ValueError: Attempted relative import in non-package.Can anyone help me solving this issue.I am new to python ...Someone please help import pafy url =…
Sharmili Nag
  • 663
  • 2
  • 8
  • 10