Coder Social home page Coder Social logo

akashtrivedig / pytube Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pytube/pytube

0.0 0.0 0.0 17.84 MB

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

Home Page: https://pytube.io

License: The Unlicense

Python 99.45% Makefile 0.55%

pytube's Introduction

pytube logo

pypi

Actively soliciting contributers!

Have ideas for how pytube can be improved? Feel free to open an issue or a pull request!

pytube

pytube is a very serious, lightweight, dependency-free Python library (and command-line utility) for downloading YouTube Videos.

Documentation

Detailed documentation about how to use the library can be found on pytube.io. This is recommended for most use cases. If you just want to quickly download a single video, the quickstart guide below might be what you're looking for.

Description

YouTube is the most popular video-sharing platform in the world and as a hacker you may encounter a situation where you want to script something to download videos. For this I present to you pytube.

pytube is a lightweight library written in Python. It has no third party dependencies and aims to be highly reliable.

pytube also makes pipelining easy, allowing you to specify callback functions for different download events, such as on progress or on complete.

Finally pytube also includes a command-line utility, allowing you to quickly download videos right from terminal.

Features

  • Support for both progressive & DASH streams
  • Support for downloading complete playlist
  • Easily register on_download_progress & on_download_complete callbacks
  • Command-line interfaced included
  • Caption track support
  • Outputs caption tracks to .srt format (SubRip Subtitle)
  • Ability to capture thumbnail URL
  • Extensively documented source code
  • No third-party dependencies

Quickstart

This guide is only meant to cover the most basic usage of the library. For more detailed information, please refer to pytube.io.

Installation

Pytube requires an installation of python 3.6 or greater, as well as pip. Pip is typically bundled with python installations, and you can find options for how to install python at https://python.org.

To install from pypi with pip:

$ python -m pip install pytube

Sometime, the pypi release becomes slightly outdated. To install from the source with pip:

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

Using pytube in a python script

To download a video using the library in a script, you'll need to first import the YouTube class from the library, and pass it 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 extremely straightforward as well. To download a video at the highest progressive quality, you can use the following command:

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

You can also do the same for a playlist:

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

pytube's People

Contributors

nficano avatar hbmartin avatar tfdahlin avatar josegonzalez avatar swiftyy-mage avatar ronncc avatar grking8 avatar ahmedsadman avatar jan-v2 avatar dependabot-preview[bot] avatar palashgoel7 avatar eloar avatar philippeitis avatar mattwmaster58 avatar sanfx avatar tooxo avatar tenyearscoder avatar dependabot[bot] avatar masipcat avatar a-czyrny avatar donoa avatar jkuijt avatar b-mcg avatar garg10may avatar vidyuthd avatar mursts avatar maitreyee19 avatar insideou7 avatar frankenstein91 avatar vn-ki avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.