A Basic, Asynchronous, Object-Oriented YouTube API Wrapper Written in Python.
The library is designed towards being used in python based discord bots that use an asynchronous discord api wrapper
Installation
Stable Release:
The latest stable version is available on pypi
Windows:
python -m pip install -U ayt-api
Unix based OSes (Linux, Mac OS, etc.):
The pip command can vary between different unix based OSes but should be simular to these:
python3 -m pip install -U ayt-api
# or
pip3 install -U ayt-api
Latest Commit:
Installing the latest commit from here. You will need git or something simular installed to download the library
Windows:
python -m pip install -U "git+https://github.com/Revnoplex/ayt-api.git"
Unix based OSes (Linux, Mac OS, etc.):
The pip command can vary between diffrent unix based OSes but should be simular to these:
python3 -m pip install -U git+https://github.com/Revnoplex/ayt-api.git
# or
pip3 install -U git+https://github.com/Revnoplex/ayt-api.git
Usage
First of all to use this library, you will need an API key. To get one, see here for instructions
Basic video data fetching:
import asyncio
import ayt_api
api = ayt_api.AsyncYoutubeAPI("Your API Key")
async def video_example():
video_data = await api.fetch_video("Video ID")
print(video_data.id)
print(video_data.channel_id)
print(video_data.url)
print(video_data.title)
print(video_data.thumbnails.default.url)
print(video_data.visibility)
print(video_data.duration)
print(video_data.view_count)
print(video_data.like_count)
print(video_data.embed_html)
print(video_data.published_at)
print(video_data.description)
print(video_data.age_restricted)
loop = asyncio.new_event_loop()
loop.run_until_complete(video_example())
Basic playlist data fetching:
import asyncio
import ayt_api
api = ayt_api.AsyncYoutubeAPI("Your API Key")
async def playlist_example():
playlist_data = await api.fetch_playlist("Playlist ID")
print(playlist_data.id)
print(playlist_data.channel_id)
print(playlist_data.url)
print(playlist_data.title)
print(playlist_data.thumbnails.default.url)
print(playlist_data.visibility)
print(playlist_data.published_at)
print(playlist_data.description)
print(playlist_data.embed_html)
print(playlist_data.item_count)
loop = asyncio.new_event_loop()
loop.run_until_complete(playlist_example())
Basic playlist video fetching:
import asyncio
import ayt_api
api = ayt_api.AsyncYoutubeAPI("Your API Key")
async def playlist_video_example():
playlist_videos = await api.fetch_playlist_videos("Playlist ID")
video = playlist_videos[0]
print(video.id)
print(video.channel_id)
print(video.url)
print(video.title)
print(video.thumbnails.default.url)
print(video.visibility)
print(video.published_at)
print(video.description)
print(video.duration)
loop = asyncio.new_event_loop()
loop.run_until_complete(playlist_video_example())
More examples are listed here
Metadata
Release files for ayt-api 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ayt_api-0.4.0.tar.gz | 60.5 kB | Without provenance | Details for ayt_api-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ayt_api-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for ayt_api-0.4.0-py3-none-any.whl |
Total release size: 120.0 kB
Release files / ayt_api-0.4.0.tar.gz
| Download URL | ayt_api-0.4.0.tar.gz |
|---|---|
| Size | 60.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5353b24a1af983c48f34a43d2b114ab770ccd07ce2da1ab0019a91bbcdbb207b
|
|
BLAKE2b-256 checksum How to use checksums |
39aa361ab68a61ec56a1ec770abd311df94453dd7149b147ec34974197d78974
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.9.21
|
Release files / ayt_api-0.4.0-py3-none-any.whl
| Download URL | ayt_api-0.4.0-py3-none-any.whl |
|---|---|
| Size | 59.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d11a00783ee746dabcc540cee96ae1e1cda1acadc05aff0d60c3788e0f2082d5
|
|
BLAKE2b-256 checksum How to use checksums |
431f984f4b07cd042092ab92871d995b4e1a911905f3ff9e14f9c04ce9dc1335
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.9.21
|
Security for ayt-api 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.