Download tool.py from flashdata-dev/youtube-channel-research-flashdata: direct link, hf CLI and curl.
- Browser
- Download file 1.07 kB
-
https://huggingface.co/spaces/flashdata-dev/youtube-channel-research-flashdata/resolve/main/tool.py
- Command line
-
hf download hf://spaces/flashdata-dev/youtube-channel-research-flashdata/tool.py
-
curl -L -o tool.py https://huggingface.co/spaces/flashdata-dev/youtube-channel-research-flashdata/resolve/main/tool.py
1.07 kB
| from smolagents import Tool | |
| class FlashDataTool(Tool): | |
| name = 'youtube_channel' | |
| description = 'Get a YouTube channel profile and recent videos from its handle. Retrieve channel details and a bounded list of recent uploads. Request 1–100 recent videos. This is not a complete channel archive; statistics and other fields may be unavailable. Uses paid FlashData API credits. Never automatically retry an uncertain submission; check Jobs first.' | |
| inputs = {'handle': {'description': 'YouTube channel handle, for example @jawed.', 'type': 'string'}, | |
| 'video_limit': {'description': 'Video limit. minimum: 1. maximum: 100. Default: 20.', | |
| 'nullable': True, | |
| 'type': 'integer'}} | |
| output_type = 'object' | |
| def forward(self, handle: str, video_limit: int = 20) -> dict: | |
| from langchain_flashdata import FlashDataYouTubeChannel | |
| values = {'handle': handle, 'video_limit': video_limit} | |
| return FlashDataYouTubeChannel().invoke({key: value for key, value in values.items() if value is not None}) | |