Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/anyesh/youtube
:mortar_board: A simple and fast Python module to retrieve data from YouTube.
https://github.com/anyesh/youtube
Last synced: 3 days ago
JSON representation
:mortar_board: A simple and fast Python module to retrieve data from YouTube.
- Host: GitHub
- URL: https://github.com/anyesh/youtube
- Owner: Anyesh
- License: mit
- Created: 2018-02-10T13:20:23.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-05-02T08:48:31.000Z (over 2 years ago)
- Last Synced: 2023-02-27T23:56:27.458Z (over 1 year ago)
- Language: Python
- Size: 88.9 KB
- Stars: 0
- Watchers: 1
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# youtube
[![Python](https://img.shields.io/badge/Python-3.6-blue.svg)](https://docs.python.org/3/whatsnew/3.6.html)
[![Travis CI](https://travis-ci.org/Fallmay/youtube.svg?branch=master)](https://travis-ci.org/Fallmay/youtube)A simple and fast Python module to retrieve data from YouTube.
- Does not use third-party dependencies and YouTube Data API.
- Uses a pool of threads to execute asynchronously requests.
- Can receive data from multiple videos at once.## Installation
Install from source:
```
$ git clone https://github.com/Fallmay/youtube.git
$ cd youtube
$ python setup.py install
```You can also use `pip`:
```
$ pip install --upgrade pip setuptools
$ pip install https://github.com/Fallmay/youtube/archive/master.tar.gz
```## Usage
Get information about a video:
```python
import youtubevideo = youtube.Video('https://www.youtube.com/watch?v=nKIu9yen5nc')
print(video.title, video.duration, video.date, sep='\n')
# What Most Schools Don't Teach
# 05:44
# 2013-02-26print(video.description)
# Learn about a new "superpower" that isn't being taught in 90% of US schools ...print(video.statistics)
# {'likes': '115618', 'dislikes': '3549', 'rating': '4.88', 'views': '14134818'}print(video.channel)
# {'title': 'Code.org', 'subscribers': '203K', ...print(video.streams['adaptive']['audio'])
# {'140': {'bitrate': '128056', 'type': 'audio/mp4', ...print(video.streams['adaptive']['video'])
# {'137': {'quality': '1080p', 'bitrate': '4276030', 'fps': '24', ...print(video.streams['multiplexed'])
# {'22': {'quality': 'hd720', 'type': 'video/mp4', ...if 'English' in video.captions:
print(video.captions['English'])
# {'languageCode': 'en', 'url': ...
```Serialize information about your favorite videos to a JSON formatted string:
```python
import json
import youtubefavorite = ['nKIu9yen5nc', 'n_KghQP86Sw', 'kccUxGDsMAQ', 'QQmFyybzon0',
'U6hkOAnFJxM', 'qDbsiVWA2Ag', '6mbFO0ZLMW8']data = youtube.load(favorite, video=True)
for _identifier, _data in data.items():
video = youtube.Video(identifier=_identifier, data=_data)
print(json.dumps(video.__dict__))# {"title": "What Most Schools Don't Teach", ...
# {"title": "Internet - Understanding Technology - by CS50 at Harvard", ...
# {"title": "Multimedia - Understanding Technology - by CS50 at Harvard", ...
# {"title": "Security - Understanding Technology - by CS50 at Harvard", ...
# {"title": "Web Development - Understanding Technology - by CS50 at Harvard", ...
# {"title": "Programming - Understanding Technology - by CS50 at Harvard", ...
# {"title": "Hardware - Understanding Technology - by CS50 at Harvard", ...
```Please see [JSON output example](docs/video.json).