XHamster API is an API for xhamster.com. It allows you to fetch information from videos using regexes and requests.
Important
This is an unofficial and unaffiliated project. Please read the full disclaimer before use: DISCLAIMER.md
By using this project you agree to comply with the target site’s rules, copyright/licensing requirements, and applicable laws. Do not use it to bypass access controls or scrape at disruptive rates.
- Fetch videos + metadata
- Download videos
- Fetch Channels
- Fetch Pornstars
- Fetch Creators
- Fetch Shorts
- Search for videos
- Fetch playlists
- Asynchronous
- Built-in caching
- Easy interface
- Great type hinting
- HTTP 2.0 / HTTP 3.0
- Browser impersonation
- Custom JA3
- All proxy types
- Proxy authentication
- Speed Limit
- DNS over HTTPS
- And even more...
- All of this is configurable and can be adjusted as you like!
This API has been tested and confirmed working on:
- Windows 11 (x64)
- macOS Sequoia (x86_64)
- Linux (Arch) (x86_64)
- Android 16 (aarch64)
Have a look at the Documentation for more details
- Install the library with
pip install xhamster_api
from xhamster_api import Client
# Initialize a Client object
async def main():
client = Client()
# Fetch a video
video_object = await client.get_video("<insert_url_here>")
# Information from Video objects
print(video_object.title)
print(video_object.likes)
# Download the video
await video_object.download(downloader="threaded", quality="best", path="your_output_path + filename")
# SEE DOCUMENTATION FOR MOREI am developing all my projects entirely for free. I do that because I have fun and I don't want to charge 30€ like other people do.
However, if you find my work useful, please consider donating something. A tiny amount such as 1€ means a lot to me.
Paypal: https://paypal.me/EchterAlsFake
XMR (Monero): 42XwGZYbSxpMvhn9eeP4DwMwZV91tQgAm3UQr6Zwb2wzBf5HcuZCHrsVxa4aV2jhP4gLHsWWELxSoNjfnkt4rMfDDwXy9jR
Do you see any issues or having some feature requests? Simply open an Issue or talk in the discussions.
Pull requests are also welcome.
Licensed under the LGPLv3 License
Copyright (C) 2023–2026 Johannes Habel