33800 Docs

← Retour

Task : Fix GitHub Trending Collector

Date : 13/01/2026 20:41 Duree : ~20 min Statut : TERMINE


Probleme

Le collector GitHub Trending utilisait l'API api.gitterapp.com qui est hors service (retourne "Not Found"). Resultat : 0 discoveries GitHub dans NeedFinder v2.1


Solution

Migration vers OSS Insight API (api.ossinsight.io/v1/trends/repos)

Avantages OSS Insight

Modifications

Fichier : /app/src/collectors/github-trending.ts

Element Avant Apres
API gitterapp.com api.ossinsight.io
Periodes daily, weekly past_24_hours, past_week
Langages '', python, typescript, etc All, TypeScript, Python, etc
Response Array direct { data: { rows: [...] } }

Code cle

const TRENDING_API = 'https://api.ossinsight.io/v1/trends/repos';
const LANGUAGES = ['All', 'TypeScript', 'Python', 'JavaScript', 'Rust', 'Go'];
const PERIODS = ['past_24_hours', 'past_week'];

// API Response structure
interface APIResponse {
  type: string;
  data: {
    columns: Array<{ col: string; data_type: string }>;
    rows: TrendingRepo[];
  };
}

Resultat

Metrique Avant Apres
GitHub discoveries 0 178
Total discoveries 631 809
Erreurs 1 (API fail) 0

Deploiement

# Deploye via docker exec
cat github-trending-fixed.ts | ssh gouroubleu@192.168.1.51 \
  "docker exec -i needfinder-collector-dev sh -c 'cat > /app/src/collectors/github-trending.ts'"

# Redemarrage container
docker restart needfinder-collector-dev

# Test collection
curl -X POST "http://192.168.1.51:5200/api/collect/github"
# {"status":"completed","collected":300,"errors":0}

Sources