Metadata-Version: 2.5
Name: langchain-huntapi
Version: 0.1.0
Summary: LangChain tools for HuntAPI: read the metadata of public videos and download them as video or audio.
Project-URL: Homepage, https://www.huntapi.com
Project-URL: Documentation, https://github.com/huntapi/langchain-huntapi#readme
Project-URL: Repository, https://github.com/huntapi/langchain-huntapi
Project-URL: Issues, https://github.com/huntapi/langchain-huntapi/issues
Author-email: HuntAPI <contact@huntapi.com>
License-Expression: MIT
License-File: LICENSE
Keywords: agents,audio,download,huntapi,langchain,media,tiktok,tools,video,youtube
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: httpx<1,>=0.27
Requires-Dist: langchain-core<2,>=0.3.15
Provides-Extra: test
Requires-Dist: langchain-tests>=0.3.5; extra == 'test'
Requires-Dist: pytest-asyncio>=0.24; extra == 'test'
Requires-Dist: pytest>=8.3; extra == 'test'
Requires-Dist: ruff<1,>=0.8; extra == 'test'
Description-Content-Type: text/markdown

# langchain-huntapi

[LangChain](https://www.langchain.com) integration for [HuntAPI](https://www.huntapi.com): read the metadata of public videos and download them as video or audio.

## Installation

```bash
pip install -U langchain-huntapi
export HUNTAPI_API_KEY="your-api-key"
```

Get an API key at [app.huntapi.com](https://app.huntapi.com).

## Tools

| Class | Tool name | What it does |
| --- | --- | --- |
| `HuntAPIMediaMetadata` | `huntapi_media_metadata` | Read the metadata of a public video through HuntAPI. |
| `HuntAPIVideoDownload` | `huntapi_video_download` | Download a public video through HuntAPI and return the download link. |
| `HuntAPIAudioDownload` | `huntapi_audio_download` | Extract the audio of a public video through HuntAPI and return the download link. |

Each tool takes `api_key` (defaults to `HUNTAPI_API_KEY`), `base_url` and `timeout`, plus the settings shown in its docstring. Errors (invalid key, no credits, rate limit, timeout) come back to the model as a `ToolException` message, without the API key. Every tool has an async version.

```python
from langchain_huntapi import HuntAPIMediaMetadata

tool = HuntAPIMediaMetadata()
print(tool.invoke({"url": "https://www.youtube.com/watch?v=jNQXAC9IVRw"}))
```

### In an agent

```python
from langchain.agents import create_agent
from langchain_huntapi import HuntAPIMediaMetadata, HuntAPIVideoDownload, HuntAPIAudioDownload

agent = create_agent(
    "openai:gpt-4.1-mini", tools=[HuntAPIMediaMetadata(), HuntAPIVideoDownload(), HuntAPIAudioDownload()]
)
result = agent.invoke({"messages": [{"role": "user", "content": "..."}]})
```

## Development

```bash
pip install -e ".[test]"
pytest tests/unit_tests
```

## License

MIT
