Documentation API
Cette page documente tous les endpoints de l'API Ygégé.
Base URL
http://localhost:8715
Authentification
L'API ne nécessite pas d'authentification directe. L'authentification YGG est gérée automatiquement via la configuration.
Endpoints disponibles
🔍 Recherche
GET /search- Rechercher des torrentsGET /categories- Lister les catégories
📦 Torrents
GET /torrent/info- Informations détailléesGET /torrent/{id}/files- Liste des fichiersGET /download- Télécharger le fichier .torrent
👤 Utilisateur
GET /user- Informations du compte YGG
❤️ Santé
GET /health- Vérification de santéGET /status- Statut du service
Recherche de torrents
GET /search
Recherche des torrents avec filtres avancés.
Paramètres de requête
| Paramètre | Type | Requis | Description |
|---|---|---|---|
q ou name | string | ❌ | Terme de recherche |
offset | number | ❌ | Pagination (défaut: 0) |
category | number | ❌ | ID de catégorie |
categories | string | ❌ | Liste d'IDs séparés par virgules |
sub_category | number | ❌ | ID de sous-catégorie |
sort | string | ❌ | Champ de tri (voir ci-dessous) |
order | string | ❌ | ascending ou descending |
imdbid | string | ❌ | ID IMDB (ex: tt1234567) |
tmdbid | string | ❌ | ID TMDB |
season | number | ❌ | Numéro de saison (séries TV) |
ep | number | ❌ | Numéro d'épisode (séries TV) |
ban_words | string | ❌ | Mots à exclure (séparés par virgules) |
Champs de tri valides
name- Nom du torrentsize- Taillepublish_date- Date de publicationcompleted- Nombre de téléchargementsseed- Nombre de seedersleech- Nombre de leecherscomments_count- Nombre de commentaires
Exemples
Recherche simple:
curl "http://localhost:8715/search?q=vaiana+2"
Recherche avancée:
curl "http://localhost:8715/search?q=vaiana+2&sort=seed&order=descending&category=2178"
Recherche par IMDB:
curl "http://localhost:8715/search?imdbid=tt10298810"
Recherche série (saison/épisode):
curl "http://localhost:8715/search?q=breaking+bad&season=1&ep=1"
Réponse
[
{
"id": 1234567,
"name": "Moana.2.2024.MULTi.TRUEFRENCH.1080p.WEB-DL.H265",
"category_id": 2178,
"size": 3189013217,
"completed": 15624,
"seed": 933,
"leech": 0,
"comments_count": 43,
"age_stamp": 1738044926,
"info_url": "/torrent/info?id=1234567",
"download": "/torrent/1234567",
"url": "https://www.yggtorrent.top/engine/download_torrent?id=1234567"
}
]
Codes de réponse
| Code | Description |
|---|---|
| 200 | Succès |
| 400 | Paramètres invalides |
| 500 | Erreur serveur |
Catégories
GET /categories
Liste toutes les catégories et sous-catégories disponibles.
Exemple
curl "http://localhost:8715/categories"
Réponse
[
{
"id": 2145,
"name": "Film/Vidéo",
"subcategories": [
{
"id": 2178,
"name": "Film/Vidéo - Animation"
},
{
"id": 2179,
"name": "Film/Vidéo - Animation Série"
}
]
}
]
Informations torrent
GET /torrent/info
Obtenir les informations détaillées d'un torrent spécifique.
Paramètres de requête
| Paramètre | Type | Requis | Description |
|---|---|---|---|
id | number | ✅ | ID du torrent |
Exemple
curl "http://localhost:8715/torrent/info?id=1234567"
Réponse
{
"id": 1234567,
"name": "Moana.2.2024.MULTi.TRUEFRENCH.1080p.WEB-DL.H265",
"description": "Description complète du torrent...",
"category_id": 2178,
"uploader": "Username",
"upload_date": "2024-01-01T12:00:00Z",
"size": 3189013217,
"completed": 15624,
"seeders": 933,
"leechers": 0,
"files": 5,
"imdb": "tt10298810",
"tmdb": "447277"
}
Fichiers torrent
GET /torrent/{id}/files
Liste tous les fichiers contenus dans un torrent.
Paramètres de chemin
| Paramètre | Type | Requis | Description |
|---|---|---|---|
id | number | ✅ | ID du torrent |
Exemple
curl "http://localhost:8715/torrent/1234567/files"
Réponse
[
{
"name": "Moana.2.2024.1080p.WEB-DL.mkv",
"size": 3000000000
},
{
"name": "Subs/french.srt",
"size": 150000
}
]
Télécharger torrent
GET /download
Télécharge le fichier .torrent.
Paramètres de requête
| Paramètre | Type | Requis | Description |
|---|---|---|---|
id | number | ✅ | ID du torrent |
Exemple
curl -O "http://localhost:8715/download?id=1234567"
Réponse
Renvoie le fichier .torrent avec le header Content-Type: application/x-bittorrent.
Informations utilisateur
GET /user
Obtenir les informations du compte YGG connecté.
Exemple
curl "http://localhost:8715/user"
Réponse
{
"username": "votre_username",
"rank": "Membre",
"uploaded": 123456789012,
"downloaded": 98765432109,
"ratio": 1.25,
"bonus_points": 1500
}
Health Check
GET /health
Vérifie que le service est opérationnel.
Exemple
curl "http://localhost:8715/health"
Réponse
OK
Codes de réponse
| Code | Description |
|---|---|
| 200 | Service opérationnel |
| 503 | Service indisponible |
Status
GET /status
Obtenir le statut détaillé du service.
Exemple
curl "http://localhost:8715/status"
Réponse
{
"status": "running",
"version": "0.6.2",
"uptime": 3600,
"ygg_connected": true,
"last_request": "2024-12-08T10:30:00Z"
}
Gestion des erreurs
Toutes les erreurs renvoient un objet JSON:
{
"error": "Description de l'erreur",
"code": "ERROR_CODE"
}
Codes d'erreur courants
| Code | Description |
|---|---|
INVALID_PARAMETERS | Paramètres de requête invalides |
TORRENT_NOT_FOUND | Torrent introuvable |
YGG_ERROR | Erreur YGG Torrent |
AUTH_FAILED | Échec d'authentification YGG |
RATE_LIMITED | Rate limit atteint |
Limites de débit
Pour éviter le rate limiting de YGG:
- Recherches: Limitez à 1 requête par seconde
- Téléchargements: Pas de limite stricte
Si vous êtes rate-limité par YGG, vérifiez que vos identifiants sont correctement configurés dans config.json.
Exemples complets
Recherche et téléchargement
# 1. Rechercher
results=$(curl -s "http://localhost:8715/search?q=vaiana+2")
# 2. Extraire le premier ID
torrent_id=$(echo $results | jq -r '.[0].id')
# 3. Télécharger
curl -O "http://localhost:8715/download?id=$torrent_id"
Avec Python
import requests
# Configuration
BASE_URL = "http://localhost:8715"
# Recherche
response = requests.get(f"{BASE_URL}/search", params={"q": "vaiana 2"})
torrents = response.json()
# Télécharger le premier résultat
if torrents:
torrent_id = torrents[0]["id"]
download_url = f"{BASE_URL}/download?id={torrent_id}"
response = requests.get(download_url)
with open(f"{torrent_id}.torrent", "wb") as f:
f.write(response.content)