{"id":15070075,"url":"https://github.com/fedeegmz/youtube-pydantic-models","last_synced_at":"2026-01-06T00:03:37.950Z","repository":{"id":249468587,"uuid":"831555097","full_name":"fedeegmz/youtube-pydantic-models","owner":"fedeegmz","description":"Use Pydantic models to work with the YouTube API.","archived":false,"fork":false,"pushed_at":"2024-09-14T03:46:18.000Z","size":586,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-03T05:02:53.162Z","etag":null,"topics":["pydantic","pydantic-models","pydantic-v2","python","python-3","python3","youtube","youtube-api","youtube-api-v3"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/youtube-pydantic-models/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fedeegmz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-20T22:57:58.000Z","updated_at":"2025-01-09T13:27:40.000Z","dependencies_parsed_at":"2024-09-13T11:56:42.567Z","dependency_job_id":null,"html_url":"https://github.com/fedeegmz/youtube-pydantic-models","commit_stats":null,"previous_names":["fedeegmz/youtube_pydantic_models","fedeegmz/youtube-pydantic-models"],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fedeegmz%2Fyoutube-pydantic-models","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fedeegmz%2Fyoutube-pydantic-models/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fedeegmz%2Fyoutube-pydantic-models/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fedeegmz%2Fyoutube-pydantic-models/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fedeegmz","download_url":"https://codeload.github.com/fedeegmz/youtube-pydantic-models/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239324720,"owners_count":19620234,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pydantic","pydantic-models","pydantic-v2","python","python-3","python3","youtube","youtube-api","youtube-api-v3"],"created_at":"2024-09-25T01:46:56.199Z","updated_at":"2025-11-01T21:30:29.885Z","avatar_url":"https://github.com/fedeegmz.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# youtube-pydantic-models\n\nA **Python** library that contains the most popular YouTube models based on Pydantic. If you are working with the **YouTube API**, **youtube-pydantic-models** can help you validate, manipulate, and retrieve data.  \nUse the YoutubeClient class to get data about channels, playlists, videos and more.  \nThe YouTube API returns data using camel case, but you can choose to return data using camel case or snake case. With the parameter ```by_alias=True```, data is returned using camel case. When using the model, every parameter is accessed using snake case.\n\n- Author: [fedeegmz](https://github.com/fedeegmz)\n- Source: [GitHub](https://github.com/fedeegmz/youtube_pydantic_models)\n- [**Docs**](https://fedeegmz.github.io/youtube-pydantic-models/)\n\n## Features\n\n- Validate YouTube API responses using Pydantic models\n- Convert data between camel case and snake case\n- Easy-to-use interface for common YouTube resources\n- Make requests to YouTube API using the client\n\n## Requirements\n\n- Python 3.7+\n- A YouTube Data API Key\n\n## Installation\n\nYou can install the library using pip:\n\n```sh\npip install youtube-pydantic-models\n```\n\n## Example usage\n\n### YoutubeClient\n\n```python\nfrom youtube_pydantic_models import YoutubeClient\n\nclient = YoutubeClient(\"MY_API_KEY\")\nchannel = client.get_channel(\n    id=\"UC_x5XG1OV2P6uZZ5FSM9Ttw\",\n    part=\"snippet, statistics\"\n)\n\nif channel:\n    print(channel.id) # -\u003e UC_x5XG1OV2P6uZZ5FSM9Ttw\n```\n\n### Channel Model\n\n```python\nimport requests\nfrom youtube_pydantic_models import YoutubeChannelResource\n\nparams = {\n    'id': \"UC_x5XG1OV2P6uZZ5FSM9Ttw\",\n    'key': \"YOUR_API_KEY\",\n    'part': \"snippet, contentDetails\"\n}\nresponse = requests.get(\n    \"https://www.googleapis.com/youtube/v3/channels\",\n    params=params\n).json()\n\nchannel = YoutubeChannelResource(**response)\nprint(channel.id)\nprint(channel.snippet.custom_url)\nchannel_dict = channel.model_dump(\n    by_alias=True,\n    exclude_none=True\n)\n```\n\n### Playlist Model\n\n```python\nimport requests\nfrom youtube_pydantic_models import YoutubePlaylistResource\n\nparams = {\n    'channelId': \"UC_x5XG1OV2P6uZZ5FSM9Ttw\",\n    'key': \"YOUR_API_KEY\",\n    'part': \"snippet, player\"\n}\nresponse = requests.get(\n    \"https://www.googleapis.com/youtube/v3/playlists\",\n    params=params\n).json()\n\nplaylist = YoutubePlaylistResource(**response)\nprint(playlist.snippet.channel_title)\nprint(playlist.player.embed_html)\nplaylist_dict = playlist.model_dump(\n    by_alias=True,\n    exclude_none=True\n)\n```\n\n### Video Model\n\n```python\nimport requests\nfrom youtube_pydantic_models import YoutubeVideoResource\n\nparams = {\n    'id': \"PJm8WNajZtw\",\n    'key': \"YOUR_API_KEY\",\n    'part': \"statistics\"\n}\nresponse = requests.get(\n    \"https://www.googleapis.com/youtube/v3/videos\",\n    params=params\n).json()\n\nvideo = YoutubeVideoResource(**response)\nprint(video.id)\nprint(video.statistics.view_count)\nvideo_dict = video.model_dump(\n    by_alias=True,\n    exclude_none=True\n)\n```\n\n### Search Model\n\n```python\nimport requests\nfrom youtube_pydantic_models import YoutubeSearchResource\n\nparams = {\n    'channelId': \"UC_x5XG1OV2P6uZZ5FSM9Ttw\",\n    'key': \"YOUR_API_KEY\",\n    'part': \"id, snippet\"\n}\nresponse = requests.get(\n    \"https://www.googleapis.com/youtube/v3/search\",\n    params=params\n).json()\n\nresource = YoutubeSearchResource(**response)\nprint(resource.id.kind)\nprint(resource.snippet.thumbnails.default.url)\nresource_dict = resource.model_dump(\n    by_alias=True,\n    exclude_none=True\n)\n```\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request on GitHub.\n\n## License\n\nThis project is licensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffedeegmz%2Fyoutube-pydantic-models","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffedeegmz%2Fyoutube-pydantic-models","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffedeegmz%2Fyoutube-pydantic-models/lists"}