# 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": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"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/5a/62/98199f2c1d14e788d661ff8e968e3ae0c2b583088df3493ce54ac98552b6/oryks-youtube-0.13.0.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.13.0",
"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": "b632a9c6863211db33a7ae82e09ef92291989491f9dea58403dd7445f37ded72",
"md5": "390fe36fe8fb7ecc89340ec391a61ba1",
"sha256": "122a2bd707eb025c98fb2f3fb5a446d936899f2ca31647839ea071f280ff5838"
},
"downloads": -1,
"filename": "oryks_youtube-0.13.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "390fe36fe8fb7ecc89340ec391a61ba1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 47239,
"upload_time": "2024-03-08T10:24:31",
"upload_time_iso_8601": "2024-03-08T10:24:31.807689Z",
"url": "https://files.pythonhosted.org/packages/b6/32/a9c6863211db33a7ae82e09ef92291989491f9dea58403dd7445f37ded72/oryks_youtube-0.13.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5a6298199f2c1d14e788d661ff8e968e3ae0c2b583088df3493ce54ac98552b6",
"md5": "0d415e14a7ed6673dbcd1ccaab57d5e4",
"sha256": "72aa994e59c2cfe900a97baf0329aa2f3e1a3d8f236d7223d25646c10ff9268c"
},
"downloads": -1,
"filename": "oryks-youtube-0.13.0.tar.gz",
"has_sig": false,
"md5_digest": "0d415e14a7ed6673dbcd1ccaab57d5e4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 26673,
"upload_time": "2024-03-08T10:24:36",
"upload_time_iso_8601": "2024-03-08T10:24:36.852102Z",
"url": "https://files.pythonhosted.org/packages/5a/62/98199f2c1d14e788d661ff8e968e3ae0c2b583088df3493ce54ac98552b6/oryks-youtube-0.13.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-08 10:24:36",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "oryks-youtube"
}