ytpy
Python wrapper to extract youtube data. Simple asynchronous wrapper to get youtube video or playlist data. The purpose of this project is to make it easier for developers to extract data from YouTube.
Requirements
- Python 3.x
- Get Google API' Credential 'API KEY' for
YoutubeDataApiV3Clientonly
Dependencies
- urllib
- aiohttp
Install
pip install --upgrade ytpy
Usage
Search Video by Keywords without api key.
params:
q, string. Search key. default: empty string.max_results
Example Search method (Without api key)
from ytpy import YoutubeClient
import asyncio
import aiohttp
async def main(loop):
session = aiohttp.ClientSession()
client = YoutubeClient(session)
response = await client.search('chico love letter')
print(response)
await session.close()
loop = asyncio.get_event_loop()
loop.run_until_complete(main(loop))
Search Video by Keywords with YoutubeDataApiV3Client
https://developers.google.com/youtube/v3/docs/search
params:
q, string. Search key. default: empty string.part, string. Valid parts: snippet, contentDetails, player, statistics, status. default: snippet.type, string. Valid types: video, playlist, channel.
Example Search method
import os
import asyncio
import aiohttp
from ytpy import YoutubeDataApiV3Client
async def main(loop):
session = aiohttp.ClientSession()
# Pass the aiohttp client session
ayt = YoutubeDataApiV3Client(session, dev_key=os.environ["DEVELOPER_KEY"])
# test search
results = await ayt.search(q="d&e lost",
search_type="video",
max_results=1)
print(results)
await session.close()
loop = asyncio.get_event_loop()
loop.run_until_complete(main(loop))
loop.close()
Examples
Check examples for the full code example
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests/examples as appropriate.
Metadata
Release files for ytpy 2021.8.17
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 |
|---|---|---|---|---|
| ytpy-2021.8.17.tar.gz | 6.8 kB | Without provenance | Details for ytpy-2021.8.17.tar.gz |
Release files / ytpy-2021.8.17.tar.gz
| Download URL | ytpy-2021.8.17.tar.gz |
|---|---|
| Size | 6.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
88bcc950f4e08d4a6f717f41b8892100539672c49e35b08518d5cdc182d8aa87
|
|
BLAKE2b-256 checksum How to use checksums |
fcbe69a7a743c5b26e6ad7c9a464f8a1632a7d3b29e96fc7ef9c4499a4a82b24
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/54.1.2 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
|
Security for ytpy 2021.8.17
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.