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
5
votes
4 answers

Read every nth frame from youtube live video for object detection

I am currently using a custom trained yolov5 model to run object detection inference on live youtube videos, the problem is that the videos are streamed at 30 FPS , I actually don't want to process each frame for object detection and just process…
5
votes
4 answers

I have a problem with dislike error when creating an pafy.new url, perhaps it's because youtube hid numer of dislikes

import pafy import vlc url = "https://www.youtube.com/watch?v=h_D3VFfhvs4" video = pafy.new(url) KeyError: 'dislike_count'
lol you
  • 61
  • 1
  • 1
  • 2
5
votes
1 answer

Is there a way to directly stream audio from a youtube video using youtube-dl or pafy library in python 3.7?

Instead of again and again downloading the audio from a youtube video, I want to stream the audio and directly access the raw audio bytes from the buffer. In other words, I want to store the raw audio bytes in RAM and use them in my python script…
4
votes
8 answers

backend_youtube_dl.py", line 54, in _fetch_basic self._dislikes = self._ydl_info['dislike_count'] KeyError: 'dislike_count'

I have the below code that has been used to download youtube videos. I automatically detect if it's a playlist or single video. However all the sudden it is giving the above error. What can be the problem? import pafy from log import * import…
lewis machilika
  • 819
  • 2
  • 11
  • 25
3
votes
0 answers

How to prevent 'HTTPS NOT SUPPORTED' Error in youtube-dl by validating video Ids?

I'm using the pafy module to retrieve URLs for audio of youtube videos. Pafy itself uses the youtube-dl module to connect to youtube. The video Id is in the url part: '/watch?v=videoID' I store the videoId of those videos but from time to time a…
Astrionn
  • 65
  • 5
3
votes
1 answer

Alexa youtube skill in python flask-ask

I am using the flask-ask framework in Python to develop an Alexa-Skill which shall play just the audio-stream of an YouTube video without downloading it. Therefore I used pafy Following function gets the audio-url out of the YouTube video: def…
user6451039
3
votes
2 answers

Pafy Youtube URL Error

I am trying Pafy library but seem to have encountered a problem. This is my code: a = pafy.new("http://www.youtube.com/watch?v=W2AF8jH84o0") And this is the error I am getting: https://i.stack.imgur.com/NRKZg.png
user5107706
3
votes
1 answer

YouTube Data API

I would like to retrieve captions from a number of YouTube clips and figured I could do this using the YouTube Data API. I would also like to specify the language (e.g. English, German). I believe this would have been possible with v2 but after some…
lsh12345
  • 31
  • 1
2
votes
2 answers

Error in python script using python-vlc and pafy

Recently I have created a python script to play youtube videos using pafy and python-vlc. The below code is the script: # importing vlc module import vlc # importing pafy module import pafy # url of the video url =…
BOSS
  • 23
  • 3
2
votes
0 answers

mmdevice audio output error: cannot initialize COM (error 0x80010106)

I was trying to make a audio player using Pafy, vlc, and PyQt6. When I ran the code below, it worked perfect. import pafy,vlc url="https://www.youtube.com/watch?v=6Duo89XuYIM&list=RDMMIoCoIxkGkVw&index=20" video=pafy.new(url) best =…
Adi_Hsiao_0410
  • 111
  • 2
  • 9
2
votes
2 answers

Trouble with VLC Module

I am trying to make an audio-only player using python for a small project. The script I am using is as follows: #!/usr/bin/env python …
lucian
  • 350
  • 4
  • 18
2
votes
0 answers

pafy and vlc audio only in python

I am trying to write a small python program to play audio only from youtube links. The idea is that I want to make a small player for my son that doesn't need a tv, just some speakers. I can create playlists for him and then load them up in this…
lucian
  • 350
  • 4
  • 18
2
votes
1 answer

how i can make thread for progress bar with pafy

i'm trying to fix problem in my program and this problem is when i start download video the program not responding and i can't see also progress bar move so i tried used threading module but i can't fix problem so how i can fix problem From this…
2
votes
3 answers

Can't get a full playlist with pafy

I'm trying to get all the urls of the videos in a playlist. The playlist contains 700+ videos. When I create a playlist with pafy.get_playlist it only creates an array with 194 videos, not all of them. So is there a size limit for the playlist with…
Drakalex
  • 1,488
  • 3
  • 19
  • 39
2
votes
1 answer

Python pafy global not working across a function-call boundary

Okay, I was trying to make a simple script to download youtube videos using pafy. Currently I have a problem with the global variable video which I use to store what pafy.new('url') returns. Here's the two functions I use: video = {}; def…
DimChtz
  • 4,043
  • 2
  • 21
  • 39
1
2 3 4 5 6 7