Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/youtube-py/youtube.py
YouTube Python is a light python module for youtube videos/playlists inbuilt multiple connection downloader.
https://github.com/youtube-py/youtube.py
playlists youtube youtube-api youtube-api-v3 youtube-channel youtube-dl youtube-downloader youtube-playlist youtube-python youtube-search youtube-video youtube-videos
Last synced: about 1 month ago
JSON representation
YouTube Python is a light python module for youtube videos/playlists inbuilt multiple connection downloader.
- Host: GitHub
- URL: https://github.com/youtube-py/youtube.py
- Owner: youtube-py
- License: mit
- Created: 2020-11-25T11:32:05.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2023-03-01T15:03:56.000Z (over 1 year ago)
- Last Synced: 2024-09-29T03:21:59.965Z (about 2 months ago)
- Topics: playlists, youtube, youtube-api, youtube-api-v3, youtube-channel, youtube-dl, youtube-downloader, youtube-playlist, youtube-python, youtube-search, youtube-video, youtube-videos
- Language: Python
- Homepage: https://youtube-python.mayankfawkes.xyz/
- Size: 479 KB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[![banner](https://github.com/youtube-py/youtube.py/raw/master/img/header.png)](https://youtube-python.mayankfawkes.xyz/)
![rtd](https://readthedocs.org/projects/youtube-python/badge/?version=latest)
![size](https://img.shields.io/github/languages/code-size/youtube-py/youtube.py)
![ver](https://img.shields.io/pypi/pyversions/youtube.py)
![lang](https://img.shields.io/github/languages/top/youtube-py/youtube.py)
![status](https://img.shields.io/pypi/status/youtube.py)
![ver](https://img.shields.io/pypi/v/youtube.py)
[![Downloads](https://pepy.tech/badge/youtube-py/week)](https://pepy.tech/project/youtube-py)# YouTube Python
Youtube Python is best and powerful python module for developers internal use APIs or command line CLI , Downloading specific video or playlist if now easy.
# Install
## Python module
run this command on terminal.```
$ pip install -U youtube.py
```Have multipls versions of python?
```
$ python3.x -m pip install -U youtube.py
```## Install FFMPEG
Windows download [link](https://ffmpeg.org/download.html). After download the exe file make sure to put that on environment variables or simply move ``ffmpeg.exe`` to ``c:\windows\system32\``
For Linux
```
$ sudo apt update
$ sudo apt install ffmpeg
```# Features
* Supports proxy (for scraping data, proxy will not be used for downloading videos)
* Rate limit bypass
* Light module
* Command line input available
* Supports FFMPEG
* Can parsec youtube video details
* Youtube Search, Video, PlayList# Basic
```python
from youtube import Videovideo_url = "https://www.youtube.com/watch?v=3AtDnEC4zak"
v = Video(video_url)
#Print Title
print(v.title)#Print Author name
print(v.author)#Print Channel ID
print(v.channel)#Print video description
print(v.description)#Print video length in second
print(v.length)#Print video keywords in dict
print(v.keywords)#Print high resolution thumbnail
print(v.thumbnail)#Print video id
print(v.videoId)#Print total video views
print(v.views)
```Working with streams
```python
>>> from youtube import Video
>>> v = Video("https://www.youtube.com/watch?v=3AtDnEC4zak")
>>> v.title
"Charlie Puth - We Don't Talk Anymore (feat. Selena Gomez) [Official Video]"
>>> v.length
231
>>> v.views
2550001850
>>> v.streams
[,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
]
>>> type(v.streams)>>> v.thumbnail
'https://i.ytimg.com/vi/3AtDnEC4zak/maxresdefault.jpg'
>>> v.get_dict
[{'itag': 18, 'mimeType': 'video/mp4', 'bitrate': 395026, 'width': 640, 'height': 360, 'lastModified': '1580859977121104', 'contentLength': '11378647', 'quality': 'medium', 'fps': 24, 'qualityLabel': '360p', 'projectionType': 'RECTANGULAR', 'averageBitrate': 394913, 'audioQuality': 'AUDIO_QUALITY_LOW', 'approxDurationMs': '230504', 'audioSampleRate': '44100', 'audioChannels': 2, 'type': 'both', 'format': 'mp4', 'codecs': 'avc1.42001E,+mp4a.40.2', 's': 'mAq0QJ8wRQIgRe0DKBgGi4uiqHOk6dmrhwQKtFCcrhCKAvNHps-hzk0CIQDDW_HSmfLlD3-4G5x3XtamqDtAWRVkjYYGv_qFYUY4Ow====', 'sp': 'sig', 'url': 'https://r7---sn-ci5gup-civl.googlevideo.com/videoplayback?expire=1606933954&ei=YonHX_XTBIKqvQSXv4-QDg ...........
```
# Command Line Input```bash
usage: youtube [-h] [-o OUTPUT] [-l] [-ff [FFMPEG] | -v [VIDEO] | -i ITAG | -s
| -a [AUDIO] | -r [RESOLUTION] | --version]
urlDefinitions:
Quality Types: ('HIGH','MID', 'LOW')
Video resolution examples. ('144', '240', '360', '480', '720', '1080') more/less depend on your videoNote:
Default values for '--ffmpeg', '--video', '--audio' is 'HIGH'
Default values for '--resolution' is 720positional arguments:
url Enter video or playlist urloptional arguments:
-h, --help show this help message and exit
-o OUTPUT, --output OUTPUT
Output location for downloading streams.
-l, --logs To enable extra logs.
-ff [FFMPEG], --ffmpeg [FFMPEG]
FFMPEG downloads audio/video both then copy in one file, Pass the quality type.
-v [VIDEO], --video [VIDEO]
Downlaod video (only progressive), Pass quality.
-i ITAG, --itag ITAG Download stream with itag, Pass itag id.
-s, --streams This argument will list the all available streams.
-a [AUDIO], --audio [AUDIO]
Download audio, Pass quality.
-r [RESOLUTION], --resolution [RESOLUTION]
Download stream with quality type, Pass video resolution.
--version Check the current version of youtube.py```
# Sample Codes
Here are some sample codes.## How to download mass videos with ffmpeg.
```python
from youtube import Videovideo_url = ["3AtDnEC4zak", "3AtDnEC4zak"]
for vdo in video_url:
v = Video(f"https://youtu.be/{vdo}").streams
v.ffhigh.download() # ffhigh will download stream with highest quality```
## How to download all playlist videos concurrently/fast.
```python
from youtube import PlayList
import concurrent.futuresMAX_CONCURRENT_DOWNLOADS = 1 #max concurrent download at ones
video_url = "https://www.youtube.com/playlist?list=PLeXILI4F6_4XJau4ZlJXD7-K75g6rDebr"
p = PlayList(video_url, process=True) # process=True to generate all Video objects
func = lambda x: x.streams.get_audios.low().download()
with concurrent.futures.ThreadPoolExecutor(max_workers=MAX_CONCURRENT_DOWNLOADS) as executor:
for n in executor.map(func,p.get_object):
print(f'{n} Downloaded')
```
## ContributingYou just simple fork the project from github and fix the bugs and push with full explanation of bug and fix.
We do love when you invest your time and contribute us for making us more better/stable.
Your each bug report on github or contribute is much appreciated