# youtube
## Overview
A python library that wraps around the YouTube V3 API. You can use it find and manage YouTube resources including Videos, Playlists, Channels and Comments.
The library is modelled after [Google's own documentation](https://developers.google.com/youtube/v3/docs/videos).
## Requirements
- Python 3.10+
- Works on Linux, Windows, macOS, BSD
## Installation
```sh
pip install oryks-youtube
```
## Get started
To get started, you need a verified Google Account and Google API keys with the correct permissions.
### How to Get A Google API Key
Follow the instructions in this short [article](https://medium.com/@lyle-okoth/how-to-get-a-google-api-key-d3c38649eaae) to get an API key.
To get a particular video using the videos' id:
1. Create an instance of the YouTube API passing in the path to the downloaded client secret file:
```sh
from youtube import YouTube
client_secrets_file = '/home/lyle/Downloads/secrets.json'
youtube = YouTube(client_secrets_file)
youtube.authenticate()
```
2. Use the video id to find the video:
```python
video = youtube.find_video_by_id('rfscVS0vtbw')
```
3. To find many videos using their id's:
```python
ids = ['rfscVS0vtbw', 'TFa38ONq5PY']
videos = youtube.find_videos(ids)
```
4. To find the most popular videos in a given region e.g Kenya, pass in the region code:
```python
popular_kenyan_videos = youtube.find_most_popular_video_by_region('ke')
```
5. To search for videos (this returns an iterator):
```python
from youtube.schemas import (
SearchFilter, SearchOptionalParameters, SearchPart, YouTubeResponse, YouTubeRequest
)
from typing import Iterator
from youtube.models import Video
query: str = 'Python programming videos'
max_results: int = 10
part: SearchPart = SearchPart()
optional_parameters: SearchOptionalParameters = SearchOptionalParameters(
q=query,
maxResults=max_results,
type=['video', 'playlist', 'channel']
)
search_request: YouTubeRequest = YouTubeRequest(
part=part,
optional_parameters=optional_parameters
)
video_iterator: Iterator = youtube.get_search_iterator(search_request)
videos: list[Video] = next(video_iterator)
```
## Documentation and Tutorials
To learn more about the library including the documentation and tutorials, check out the [libraries' documentation](https://youtube-wrapper.readthedocs.io/en/latest/).
## How to Contribute
To contribute, chack out the [contribution guideline](CONTRIBUTING.md).
## License
The API uses an [MIT License](LICENSE)
## Developer
Lyle Okoth – [@lylethedesigner](https://twitter.com/lylethokoth) on twitter
[lyle okoth](https://medium.com/@lyle-okoth) on medium
My email is lyceokoth@gmail.com
Here is my [GitHub Profile](https://github.com/twyle/)
You can also find me on [Linkedin](https://www.linkedin.com/in/lyle-okoth/)
Raw data
{
"_id": null,
"home_page": "https://youtube-wrapper.readthedocs.io/en/latest/index.html",
"name": "oryks-youtube",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "youtube, youtube-api, youtube comments, youtube videos, youtube channels, youtube comment thread, create youtube playlist",
"author": "Lyle Okoth",
"author_email": "lyceokoth@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/15/85/0bc6874ab7eda3396499c6497b4d89f9999383f9801316a58253db120420/oryks-youtube-0.14.1.tar.gz",
"platform": null,
"description": "# youtube\n## Overview\n\nA python library that wraps around the YouTube V3 API. You can use it find and manage YouTube resources including Videos, Playlists, Channels and Comments.\n\nThe library is modelled after [Google's own documentation](https://developers.google.com/youtube/v3/docs/videos).\n\n## Requirements\n- Python 3.10+\n- Works on Linux, Windows, macOS, BSD\n\n## Installation\n\n```sh\npip install oryks-youtube\n```\n\n## Get started\nTo get started, you need a verified Google Account and Google API keys with the correct permissions.\n\n### How to Get A Google API Key\nFollow the instructions in this short [article](https://medium.com/@lyle-okoth/how-to-get-a-google-api-key-d3c38649eaae) to get an API key.\n\n\nTo get a particular video using the videos' id:\n1. Create an instance of the YouTube API passing in the path to the downloaded client secret file:\n```sh\nfrom youtube import YouTube\n\nclient_secrets_file = '/home/lyle/Downloads/secrets.json'\nyoutube = YouTube(client_secrets_file)\nyoutube.authenticate()\n```\n2. Use the video id to find the video:\n```python\nvideo = youtube.find_video_by_id('rfscVS0vtbw')\n```\n3. To find many videos using their id's:\n```python\nids = ['rfscVS0vtbw', 'TFa38ONq5PY']\nvideos = youtube.find_videos(ids)\n```\n4. To find the most popular videos in a given region e.g Kenya, pass in the region code:\n```python\npopular_kenyan_videos = youtube.find_most_popular_video_by_region('ke')\n```\n5. To search for videos (this returns an iterator):\n```python\nfrom youtube.schemas import (\n SearchFilter, SearchOptionalParameters, SearchPart, YouTubeResponse, YouTubeRequest\n)\nfrom typing import Iterator\nfrom youtube.models import Video\n\nquery: str = 'Python programming videos'\nmax_results: int = 10\npart: SearchPart = SearchPart()\noptional_parameters: SearchOptionalParameters = SearchOptionalParameters(\n q=query,\n maxResults=max_results,\n type=['video', 'playlist', 'channel']\n)\nsearch_request: YouTubeRequest = YouTubeRequest(\n part=part,\n optional_parameters=optional_parameters\n)\nvideo_iterator: Iterator = youtube.get_search_iterator(search_request)\nvideos: list[Video] = next(video_iterator)\n```\n\n## Documentation and Tutorials\nTo learn more about the library including the documentation and tutorials, check out the [libraries' documentation](https://youtube-wrapper.readthedocs.io/en/latest/).\n\n## How to Contribute\n\nTo contribute, chack out the [contribution guideline](CONTRIBUTING.md).\n\n## License\n\nThe API uses an [MIT License](LICENSE)\n\n## Developer\n\nLyle Okoth \u2013 [@lylethedesigner](https://twitter.com/lylethokoth) on twitter\n\n[lyle okoth](https://medium.com/@lyle-okoth) on medium\n\nMy email is lyceokoth@gmail.com\n\nHere is my [GitHub Profile](https://github.com/twyle/)\n\nYou can also find me on [Linkedin](https://www.linkedin.com/in/lyle-okoth/)\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A python library that wraps around the YouTube V3 API. You can use it find and manage YouTube resources including Videos, Playlists, Channels and Comments.",
"version": "0.14.1",
"project_urls": {
"Homepage": "https://youtube-wrapper.readthedocs.io/en/latest/index.html"
},
"split_keywords": [
"youtube",
" youtube-api",
" youtube comments",
" youtube videos",
" youtube channels",
" youtube comment thread",
" create youtube playlist"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "929b5bee89d05fe1e32c933e3e0a706b1777de218feb4309ca5bcffdbe3f257c",
"md5": "67163d7956d6dd342b50194ba34ea5b8",
"sha256": "1e9db38883436d5acc9c9d1af517f9c3cc60cf2840c0bd957775731e49be1626"
},
"downloads": -1,
"filename": "oryks_youtube-0.14.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "67163d7956d6dd342b50194ba34ea5b8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 49290,
"upload_time": "2024-07-29T12:45:05",
"upload_time_iso_8601": "2024-07-29T12:45:05.823440Z",
"url": "https://files.pythonhosted.org/packages/92/9b/5bee89d05fe1e32c933e3e0a706b1777de218feb4309ca5bcffdbe3f257c/oryks_youtube-0.14.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "15850bc6874ab7eda3396499c6497b4d89f9999383f9801316a58253db120420",
"md5": "7ba9169fd5ec7c694f803eda2e814465",
"sha256": "1053663fcaa9b4bd1ea2688d497743372c554a9502cf4cf06cac1ab32dea3370"
},
"downloads": -1,
"filename": "oryks-youtube-0.14.1.tar.gz",
"has_sig": false,
"md5_digest": "7ba9169fd5ec7c694f803eda2e814465",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 27317,
"upload_time": "2024-07-29T12:45:11",
"upload_time_iso_8601": "2024-07-29T12:45:11.078540Z",
"url": "https://files.pythonhosted.org/packages/15/85/0bc6874ab7eda3396499c6497b4d89f9999383f9801316a58253db120420/oryks-youtube-0.14.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-29 12:45:11",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "oryks-youtube"
}