Downloads · 30 days
0
Ferdowsi/pytube
pytube is a machine learning model from Ferdowsi. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
<div align="center" <p <a href=""<img src="https://assets.nickficano.com/gh-pytube.min.svg" width="456" height="143" alt="pytube logo" /</a </p </div
Downloads · 30 days
0
Access
Public
Updated Jan 14, 2024
Repo size
—
Likes
0
Public
Click a slice to open those files.
.gz5.3 MB · 92%
From the Hugging Face model README
pytube is a genuine, lightweight, dependency-free Python library (and command-line utility) for downloading YouTube videos.
Detailed documentation about the usage of the library can be found at pytube.io. This is recommended for most cases. If you want to hastily download a single video, the quick start guide below might be what you're looking for.
on_download_progress & on_download_complete callbacksThis guide covers the most basic usage of the library. For more detailed information, please refer to pytube.io.
Pytube requires an installation of Python 3.6 or greater, as well as pip. (Pip is typically bundled with Python installations.)
To install using github:
$ python -m pip install git+https://github.com/javad-rzvn/pytube
If you have internet problem, you should use proxy. To do that, you better setup a v2ray connection, then use its proxy to download videos.
from pytube import YouTube
from pytube.cli import on_progress
YouTube("https://youtu.be/2lAe1cqCOXo").streams.first().download()
proxies = {"http": "socks5://127.0.0.1:2080"}
yt = YouTube(
"http://youtube.com/watch?v=2lAe1cqCOXo",
on_progress_callback=on_progress,
# on_complete_callback=complete_func,
proxies=proxies,
)
yt.streams.filter(progressive=True, file_extension="mp4").order_by(
"resolution"
).desc().first().download()
In the example below, it downloads only 3 videos of the channel.
from pytube import Channel
proxies = {"http": "socks5://127.0.0.1:2080"}
c = Channel('https://www.youtube.com/c/FalcomMusicChannel/videos', proxies=proxies)
print(f'Downloading videos by: {c.channel_name}')
print(f'Channel URLs: {c.video_urls[:3]}')
for i, video in enumerate(c.videos[:3]):
print(c.video_urls[i])
video.streams.first().download()