# TubeCtrl
## 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 tubectrl
```
## 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 tubectrl 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": "tubectrl",
"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/27/fa/274e5cf88bf626f097b2ea004f7103ad20ff9cd59578d9ae5895e152b5fd/tubectrl-0.2.3.tar.gz",
"platform": null,
"description": "# TubeCtrl\n\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\n- Python 3.10+\n- Works on Linux, Windows, macOS, BSD\n\n## Installation\n\n```sh\npip install tubectrl\n```\n\n## Get started\n\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\n\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\nTo get a particular video using the videos' id:\n\n1. Create an instance of the YouTube API passing in the path to the downloaded client secret file:\n\n```sh\nfrom tubectrl import YouTube\n\nclient_secrets_file = '/home/lyle/Downloads/secrets.json'\nyoutube = YouTube(client_secrets_file)\nyoutube.authenticate()\n```\n\n2. Use the video id to find the video:\n\n```python\nvideo = youtube.find_video_by_id('rfscVS0vtbw')\n```\n\n3. To find many videos using their id's:\n\n```python\nids = ['rfscVS0vtbw', 'TFa38ONq5PY']\nvideos = youtube.find_videos(ids)\n```\n\n4. To find the most popular videos in a given region e.g Kenya, pass in the region code:\n\n```python\npopular_kenyan_videos = youtube.find_most_popular_video_by_region('ke')\n```\n\n5. To search for videos (this returns an iterator):\n\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\n\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",
"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.2.3",
"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": null,
"digests": {
"blake2b_256": "a2a31070049ea999aba53d10e30d39722806393ed10475c945d0c9276e5a157c",
"md5": "36a98d4b55f7ff17debbea02e1c878ee",
"sha256": "53395643388265c5047c483328cfeaad2eaae935a6f1e41b552a75306ceca96c"
},
"downloads": -1,
"filename": "tubectrl-0.2.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "36a98d4b55f7ff17debbea02e1c878ee",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 19324,
"upload_time": "2025-03-20T14:02:28",
"upload_time_iso_8601": "2025-03-20T14:02:28.380460Z",
"url": "https://files.pythonhosted.org/packages/a2/a3/1070049ea999aba53d10e30d39722806393ed10475c945d0c9276e5a157c/tubectrl-0.2.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "27fa274e5cf88bf626f097b2ea004f7103ad20ff9cd59578d9ae5895e152b5fd",
"md5": "ad42e7879aa8b3aed0f74b56a1db7837",
"sha256": "fdff7d38529fc0a24529ce39b3e812dad28e2a57b1df8a34a646918a2586f104"
},
"downloads": -1,
"filename": "tubectrl-0.2.3.tar.gz",
"has_sig": false,
"md5_digest": "ad42e7879aa8b3aed0f74b56a1db7837",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 13642,
"upload_time": "2025-03-20T14:02:30",
"upload_time_iso_8601": "2025-03-20T14:02:30.153901Z",
"url": "https://files.pythonhosted.org/packages/27/fa/274e5cf88bf626f097b2ea004f7103ad20ff9cd59578d9ae5895e152b5fd/tubectrl-0.2.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-03-20 14:02:30",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "tubectrl"
}