Communitygithub.com

Proxy-Rotator (Deutsch)

Rotiert einen Pool von HTTP/SOCKS-Proxys mit Round-Robin-Auswahl, Fehlerverfolgung und einer Abkühlungsphase, die tote Proxys vor einem erneuten Versuch aussetzt. Sie bringen Ihre eigene Proxy-Liste über eine Umgebungsvariable mit – es werden keine mitgeliefert.

Was ist Proxy-Rotator (Deutsch)?

Der Proxy-Rotator ist ein Skill für KI-Agenten (z. B. Claude Code, Cursor, Codex), der es ermöglicht, HTTP/SOCKS-Proxys in einer Round-Robin-Art zu rotieren, Fehler zu verfolgen und fehlgeschlagene Proxys für eine konfigurierbare Abkühlungszeit zu sperren, bevor sie erneut getestet werden. Entwickler nutzen ihn, um IP-Sperren zu vermeiden, Last auf mehrere Proxys zu verteilen und ausgefallene Proxys automatisch zu ersetzen. Die Funktionsweise ist einfach: Der Agent lädt die Proxy-Liste aus einer Umgebungsvariable (`PROXY_POOL`), holt sich den nächsten gesunden Proxy, führt die Anfrage aus und meldet das Ergebnis zurück. Der Rotator sperrt Proxys nach einer einstellbaren Anzahl von Fehlern und gibt ihnen nach der Abkühlungszeit eine zweite Chance. Der Skill wird über natürliche Sprachbefehle wie „Rotiere die Proxys“ oder „Verteile die Anfragen auf verschiedene Proxys“ aktiviert und arbeitet plattformunabhängig in Python, Node.js oder anderen Sprachen.

Funktioniert mit~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/baronguyen001/ai-automation-skills/tree/HEAD/skills/proxy-rotator

In Ihrer bevorzugten KI fragen

Öffnet einen neuen Chat, in dem dieser Agent-Skill bereits geladen ist.

Dokumentation

Proxy-Rotator

Verwenden Sie diesen Skill, wenn ein Scraper Anfragen auf mehrere Proxys verteilen und aufhören soll, tote Proxys zu belasten. Der Rotator gibt den nächsten gesunden Proxy aus, zählt Fehler und sperrt einen Proxy für eine Abkühlungszeit, nachdem er zu oft fehlgeschlagen ist – und gibt ihm dann eine zweite Chance. Sie bringen die Proxy-Liste mit; es wird nichts festgeschrieben.

Wann aufrufen

  • Benutzer sagt: "Rotiere die Proxys", "Verteile die Anfragen auf verschiedene Proxys", "Hör auf, IP-gesperrt zu werden", "Wiederhole über einen anderen Proxy".
  • Der Code im Gespräch führt viele ausgehende Anfragen aus und muss sie auf einen Proxy-Pool verteilen.

Wann NICHT aufrufen

  • Eine einzelne Verbindung reicht aus, oder das Ziel erlaubt explizit Ihr Volumen – die Rotation von Proxys fügt unnötige Komplexität hinzu.
  • Die Absicht ist, eine explizite Sperre zu umgehen oder einen Dienst zu missbrauchen; halten Sie die Nutzung innerhalb der Bedingungen des Ziels.

Konkretes Beispiel

Benutzereingabe:

Ich habe 5 Proxys. Rotiere sie im Round-Robin und überspringe die, die anfangen zu fehlschlagen.

Ausgabe:

import requests
from rotator import ProxyRotator

rot = ProxyRotator.from_env()        # PROXY_POOL="http://h1:8080,socks5://h2:1080,..."
for url in urls:
    p = rot.get()                    # nächster gesunder Proxy
    try:
        r = requests.get(url, proxies=p.as_dict(), timeout=15)
        rot.report(p, ok=r.ok)       # Ergebnis zurückmelden, damit sich der Pool selbst heilt
    except Exception:
        rot.report(p, ok=False)      # zu viele Fehler -> für die Abkühlung gesperrt

Anzuwendendes Muster

  1. Laden Sie Proxys aus der Umgebung oder einer gitignorierten Datei – niemals echte Proxy-URLs oder Zugangsdaten festhalten.
  2. Rufen Sie immer report(proxy, ok=...) nach jeder Anfrage auf, damit fehlschlagende Proxys automatisch gesperrt werden.
  3. Passen Sie max_fails und cooldown an das Ziel an; eine kurze Abkühlung erholt flaky Proxys, eine lange entfernt schlechte.
  4. Führen Sie health_check vor einer großen Charge aus, um tote Proxys vorab zu sperren.
  5. Behandeln Sie den Fehler "keine gesunden Proxys" – warten Sie und wiederholen Sie es, anstatt den Lauf abzubrechen.

Referenz: assets/rotator.py.

Quelle

Destilliert aus dem produktiven Einsatz in den Automatisierungsprojekten des Autors. v1.0.0. Siehe auch: [[playwright-login-session]], [[pipeline-orchestrator]], [[cron-dispatch]].

→ Erstellen Sie den vollständig lauffähigen Bot mit Trawlkit.

Individual skills in this repo

This repo contains 9 individual skills — each has its own dedicated page.

baronguyen001/ai-automation-skills

Schedule any script to run on a recurring schedule on Windows (Task Scheduler) or Linux (cron) - register, list, and remove jobs from one command, with logging to a file and a guard against overlapping runs. Use for schedule a script, run nightly, set up a cron job, windows task scheduler, or run on a timer.

baronguyen001/ai-automation-skills

Turn a run's list of result dicts into a schema'd CSV and a Markdown table from one column spec - declare columns once, emit both, with stable ordering and safe escaping, stdlib only, no pandas. Use when the user asks to write results to CSV, export a report, make a markdown summary table, or save a run's output as a spreadsheet.

baronguyen001/ai-automation-skills

Strip HTML to clean plain text with the standard library only (no BeautifulSoup/lxml): drops script/style, turns block tags into line breaks, and collapses whitespace. Use when the user wants readable text from an HTML page/email, to clean scraped HTML before sending it to an LLM, or to build a text index from web content.

baronguyen001/ai-automation-skills

Persist records between scheduled runs as append-only JSON Lines (one object per line) with streaming reads and optional key-based dedup, stdlib only. Use when the user wants to log run results to JSONL, append events to a file, dedup records by id across runs, or keep a simple durable history without a database.

baronguyen001/ai-automation-skills

Extract text and simple table-like rows from a PDF for downstream AI without OCR binaries. Use when the user asks to read a PDF, turn a PDF into text, pull simple tables from statements/reports, or feed PDF content into an LLM pipeline.

baronguyen001/ai-automation-skills

Parse an RSS 2.0 or Atom feed into normalized item dicts (title, link, id, published, summary) with the standard library only - no feedparser. Use when the user asks to read an RSS/Atom feed, poll a blog/news feed, extract feed entries, or watch a site that publishes a feed.

baronguyen001/ai-automation-skills

Upload and download run artifacts from S3-compatible storage with BYO bucket and credentials from env. Use when the user asks to store scraper output, archive reports, publish artifacts to object storage, fetch a prior run file, or use MinIO/R2/Spaces/S3 without hardcoding credentials.

baronguyen001/ai-automation-skills

Draft a short-form TikTok/Reels/Shorts or long-form video script from a topic and creator persona file - hook variants, beat-structured body, CTA, b-roll cues, caption overlays, and [STORY]/[NUMBER] slots so the model never fabricates personal facts. Use for write a video script, tiktok script, youtube script, or /shortform-script.

baronguyen001/ai-automation-skills

Give scheduled scripts memory between runs with one SQLite file - a seen-set for dedup, a key/value cursor to resume where you left off, and order-preserving new-item filtering. Use for dedup across runs, don't re-alert the same item, remember the last id, resume a scraper, or persist state between cron runs.

Verwandte Skills