Skip to main content

Easily get data and download youtube videos, focused on speed and simplicity.

Project description

ytget

Easily get data and download YouTube videos, focused on speed and simplicity.

Also works as a command-line extractor/downloader.

Installation

You can install ytget using pip:

pip install ytget

Features

  • Simple use.
  • Quick download and info extraction of youtube videos.
  • Quick youtube search.
  • Access to age restricted videos without login.
  • Access to your private videos logging into your account.
  • Command-line support.

Usage

Python

To extract information from a video, create a Video object with the url or query:

from ytget import Video

video = Video("https://www.youtube.com/watch?v=dQw4w9WgXcQ")

# Get info
title = video.title
duration = video.duration
subtitles = video.subtitles
stream_url = video.stream_url
# ...and so on. 
# You can use print(dir(video)) or help(video) to get all available info and parameters.

# Download the video
video.download()

# Change some parameters
video.download(path="downloads/", quality="med", only_audio=True)

You can also search for a query and get the information of all the videos obtained:

from ytget import Search
from ytget.utils import format_seconds

# Get the complete information of all videos
results = Search("never gonna give you up", get_duration_formatted=False).results

# Download all
results.download()

for result in results:
    # Only download if the video is less than 3 minutes long
    if result.duration < format_seconds('3:00'):
        result.download(quality="best", only_video=True, target_fps=30)


# Get simplified information (in case you need speed and don't need to download)
results = Search("never gonna give you up", get_simple=True).results

for result in results:
    print(result['title'], result['url'])

Command-line

For more detailed information, use:

ytget --help

Example 1 - Downloading a video and printing its title and url:

ytget https://www.youtube.com/watch?v=dQw4w9WgXcQ --print title url

Example 2 - Searching for a query, without downloading get the data of all the videos and write it to a json file:

ytget "never gonna give you up" --search --skip-download --print all --write-to-json

To Do

  • Add playlist support.
  • Add channels support.
  • Allow some way to download livestreams (fractions).
  • Make user input download speed in MB/s and not using chunk size.

Repository

The source code is available on GitHub.

License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ytget-0.1.0.tar.gz (19.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ytget-0.1.0-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

Details for the file ytget-0.1.0.tar.gz.

File metadata

  • Download URL: ytget-0.1.0.tar.gz
  • Upload date:
  • Size: 19.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.0

File hashes

Hashes for ytget-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f8337c45aff1ae25007eb90843763a8d3c349ee7cc55260019c04ce01e2a7465
MD5 6891772361d0232af6ddd26010b34286
BLAKE2b-256 0d28ce51f6ed45e438f02b42af885f1477d9fd9dcbe5e521753911a97ed2904f

See more details on using hashes here.

File details

Details for the file ytget-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ytget-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.0

File hashes

Hashes for ytget-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fefb72ee94cd3afe7b7df8746607b64c847a5366c1109fee17e01144fbb9bd50
MD5 a1525d5fcb029d9a9b6860528ad53a37
BLAKE2b-256 9912cda06666c0ee2e7a7bf6b51becf9df202fbb00b0d4ddc3bcd8bbb581b585

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page