Aller au contenu principal

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

📦 Torrents

👤 Utilisateur

❤️ Santé


Recherche de torrents

Recherche des torrents avec filtres avancés.

Paramètres de requête

ParamètreTypeRequisDescription
q ou namestringTerme de recherche
offsetnumberPagination (défaut: 0)
categorynumberID de catégorie
categoriesstringListe d'IDs séparés par virgules
sub_categorynumberID de sous-catégorie
sortstringChamp de tri (voir ci-dessous)
orderstringascending ou descending
imdbidstringID IMDB (ex: tt1234567)
tmdbidstringID TMDB
seasonnumberNuméro de saison (séries TV)
epnumberNuméro d'épisode (séries TV)
ban_wordsstringMots à exclure (séparés par virgules)

Champs de tri valides

  • name - Nom du torrent
  • size - Taille
  • publish_date - Date de publication
  • completed - Nombre de téléchargements
  • seed - Nombre de seeders
  • leech - Nombre de leechers
  • comments_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

CodeDescription
200Succès
400Paramètres invalides
500Erreur 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ètreTypeRequisDescription
idnumberID 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ètreTypeRequisDescription
idnumberID 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ètreTypeRequisDescription
idnumberID 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

CodeDescription
200Service opérationnel
503Service 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

CodeDescription
INVALID_PARAMETERSParamètres de requête invalides
TORRENT_NOT_FOUNDTorrent introuvable
YGG_ERRORErreur YGG Torrent
AUTH_FAILEDÉchec d'authentification YGG
RATE_LIMITEDRate 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
Rate Limiting

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)

Prochaines étapes