Skip to content
forked from pytube/pytube

A fork of PyTube that uses domain fronting technique to access YouTube in censored places

License

Notifications You must be signed in to change notification settings

gxosty/pytube-masked

 
 

Repository files navigation

pytube-masked

pytube is a genuine, lightweight, dependency-free Python library (and command-line utility) for downloading YouTube videos. This repository is fork of pytube and aims to circumvent censorship where YouTube is blocked. The idea behind it is to use Domain Fronting, probably the most optimal choice to access YouTube.

Installation

pytube-masked requires an installation of Python 3.6 or greater, as well as pip. (Pip is typically bundled with Python installations.)

To install from the source with pip:

$ python -m pip install git+https://github.com/gxosty/pytube-masked

Using pytube-masked in a Python script

To download a video using the library in a script, you'll need to import the YouTube class from the library and pass an argument of the video URL. From there, you can access the streams and download them.

 >>> from pytube import YouTube
 >>> YouTube('https://youtu.be/2lAe1cqCOXo').streams.first().download()
 >>> yt = YouTube('http://youtube.com/watch?v=2lAe1cqCOXo')
 >>> yt.streams
  ... .filter(progressive=True, file_extension='mp4')
  ... .order_by('resolution')
  ... .desc()
  ... .first()
  ... .download()

Using the command-line interface

Using the CLI is remarkably straightforward as well. To download a video at the highest progressive quality, you can use the following command:

$ pytubem https://youtube.com/watch?v=2lAe1cqCOXo

You can also do the same for a playlist:

$ pytubem https://www.youtube.com/playlist?list=PLS1QulWo1RIaJECMeUT4LFwJ-ghgoSH6n

About

A fork of PyTube that uses domain fronting technique to access YouTube in censored places

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.5%
  • Other 0.5%