Registry / http-networking / pafy
library0.5.5pypypiunverified

pafy is a Python library to retrieve YouTube content and metadata, such as video titles, descriptions, thumbnails, and download URLs. Current version is 0.5.5, with no set release cadence; the project appears to be in maintenance mode with infrequent updates.

pip install pafy
INSTALL
IMPORT
SIG · PAFY
P
pafy
http-networkingpythonv0.5.5
Install
2.2s avg
Import
855ms
Disk
29MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.5.5 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.894s · 30.5MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 2.2s · import 0.816s · 31MB
29MB installed
● package 29MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pafy
import pafy

Fetch metadata from a YouTube video using pafy and print title, views, duration, and best stream URL.

import pafy url = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ' video = pafy.new(url) print(video.title) print(video.viewcount) print(video.duration) stream = video.getbest() print(stream.url)
Debug
Known issues
deprecatedpafy uses youtube-dl as its backend, which is no longer actively maintained and may break with YouTube changes. Consider using yt-dlp as a replacement.
fix
Switch to yt-dlp with pafy: pip install yt-dlp and set pafy.backend = 'youtube-dl' (though yt-dlp is not natively supported). Better to use yt-dlp directly.
affects: all
gotchapafy.new blocks on network calls; calling it in a GUI or async context may freeze the application.
fix
Run pafy.new in a thread or use an async-compatible library instead.
affects: all
breakingAs of pafy 0.5.5, the default backend relies on youtube-dl, which may frequently break due to YouTube API changes. Ensure youtube-dl is up to date.
fix
Update youtube-dl frequently: pip install --upgrade youtube-dl. Or switch to yt-dlp based forks.
affects: 0.5.5
Upgrade
Version history
0.5.5latest on PyPI · released Nov 22, 2019
Audit
Dependencies
youtube-dloptionalDefault backend for downloading video streams and metadata
Agent activity
10 hits · last 30 days
node
10
Resources
pafy — pip install pafy · libregistry