HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
tfdahlin
pytube
Python2021–2021
tfdahlin / pytube

pytube

A lightweight, dependency-free Python library (and command-line utility) for downloading YouTube Videos.

2Distinct people
2Mentions
0Explicit recommenders
4GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

A lightweight, dependency-free Python library (and command-line utility) for downloading YouTube Videos.

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 5:04:57 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by week2 dated mentions

Observed mentions: 2021-11-01 10:17:27 UTC to 2021-12-19 13:05:44 UTC. Weeks start Monday, UTC.

012021-11-01 00:00:00 UTC to 2021-11-08 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 commentsNov 12021-11-08 00:00:00 UTC to 2021-11-15 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-11-15 00:00:00 UTC to 2021-11-22 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-11-22 00:00:00 UTC to 2021-11-29 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 commentsNov 222021-11-29 00:00:00 UTC to 2021-12-06 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-12-06 00:00:00 UTC to 2021-12-13 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-12-13 00:00:00 UTC to 2021-12-20 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 commentsDec 13

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
Nov 12021-11-01 00:00:00 UTC2021-11-08 00:00:00 UTC101
Nov 82021-11-08 00:00:00 UTC2021-11-15 00:00:00 UTC000
Nov 152021-11-15 00:00:00 UTC2021-11-22 00:00:00 UTC000
Nov 222021-11-22 00:00:00 UTC2021-11-29 00:00:00 UTC000
Nov 292021-11-29 00:00:00 UTC2021-12-06 00:00:00 UTC000
Dec 62021-12-06 00:00:00 UTC2021-12-13 00:00:00 UTC000
Dec 132021-12-13 00:00:00 UTC2021-12-20 00:00:00 UTC101

What Hacker News says

2 sources
Quicker explanation of how Youtube is doing it is at the source code of pytube: https://github.com/tfdahlin/pytube/blob/bb890af3b271a616bbe1... This is linked from the description of PR 30184 of youtube-dl but @varenc linked to a specific comment (talking about patching Windows builds, AFAICT) which might confuse some people. I'll even save you the click: > YouTube's strategy to restrict downloading videos is to send a ciphered version of the signature to the client, along with the decryption algorithm obfuscated in JavaScript. For the clients to play the videos, JavaScript must take the ciphered version, cycle it through a series of "transform functions," and then signs the media URL with the output. There are still a lot of things I don't understand here but gotta give Youtube a slow-clap moment for their devious ingenuity.
In Move myself to inactive
There are workarounds (detailed very nicely in dirkf’s pull request for youtube-dl): https://github.com/ytdl-org/youtube-dl/pull/30184 Pasting the content here for convenience: Since summer 2021, YouTube has started serving media URLs with a query parameter such as …&n=SXiXBH-xzrjeioPN&…. This now appears to be the default behaviour. Unless the value of this parameter is transformed according to an algorithm delivered in the site player JS, the download speed for the URL is throttled to ~50kB/s. Solutions for this include: • implementing a more complete JS interpreter, eg based on PR [jsinterp] Actual JS interpreter¹ #11272; • using an external JS interpreter (PhantomJS, now unmaintained, is used by some extractors); • spoofing the Android or iOS client to acquire unthrottled links, as successfully implemented in yt-dlp². This PR takes a
Read the rest
different approach derived from the successful solution used in VLC's youtube.lua (also implemented differently in pytube³). The approach relies on the fact that the challenge algorithm is served in a mini-language within the minified player JS and therefore the specific algorithm can be extracted and executed by interpreting the mini-language without actually running the JS itself. [In parallel with this PR, a separate implementation of this approach was added to yt-dlp⁴.] The implementation of the mini-language interpreter is directly translated from VLC's n_descramble() Lua function⁵. The result sufficiently resembles the original that it should be straightforward to share changes between the two implementations. ―――――― ¹ — https://github.com/ytdl-org/youtube-dl/pull/11272 ² — https://github.com/yt-dlp/yt-dlp/commit/c888ffb95ab0ab4f4cd1... ³ — https://github.com/tfdahlin/pytube/blob/bb890af3b271a616bbe1... ⁴ — https://github.com/yt-dlp/yt-dlp/commit/404f611f1c4aa516fbc4... ⁵ — https://code.videolan.org/videolan/vlc/-/blob/4fb284e5af69aa...
In A cross platform front-end GUI of the popular YouTube-dl written in wxPython

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.