Files

75 lines
4.9 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
name: grok-suite
description: "Grok stack: autoreg, gateway, twitter parser. Setup+fix."
---
# Grok Suite — плейбук (autoreg + gateway + twitter-parser)
Репа: https://github.com/Violetpivary/grok-suite (public)
Локально: `C:\Users\User\grok-suite\` (autoreg/, gateway/, twitter-parser/)
Деплой gateway: `C:\Users\User\grok2api-deploy\grok2api\` (grok2api.exe 90MB собран, config.yaml с секретами, SECRETS.local.txt)
## Состав
| Компонент | Что | Запуск |
|---|---|---|
| autoreg/ | масс-рег x.ai (temp mail, proxy pools, CPA) | `python run_cli_auto.py` / GUI `grok_register_ttk.py` |
| gateway/ | grok2api (Go, MIT, upstream chenyme/grok2api) — web-акки → OpenAI API :8000/v1 | `./grok2api.exe` (деплой-копия) |
| twitter-parser/ | X/Twitter парсер БЕЗ auth через fxtwitter | `python twitter_parser.py tweet\|article\|media\|avatar\|batch` |
## Gateway (шлюз)
1. Конфиг `config.yaml`: jwtSecret (32+), credentialEncryptionKey (base64 32B — НЕ менять после первого акка), bootstrapAdmin
2. Секреты деплоя: `grok2api-deploy/SECRETS.local.txt` (admin / jwtSecret / credEncKey)
3. Старт: `grok2api.exe` → API :8000/v1, admin UI `/`
4. Hermes-провайдер `grok2api` уже в config.yaml (модели grok-4.6/4.5/4.3/chat-fast/build-0.1/imagine-image)
5. Живость: `curl -s -m 5 http://127.0.0.1:8000/v1/models`
6. Акки через admin UI; пул пуст = 502 у провайдера → нарегать autoreg'ом
## twitter-parser (fxtwitter — единственный живой метод 2026)
Мёртвые: nitter, xcancel, syndication CDN, xAI search (кредиты), browser (403).
```bash
python twitter_parser.py tweet <user> <id> # метаданные+стата+media
python twitter_parser.py article <user> <id> --save=out.md # X Article -> md
python twitter_parser.py media <user> <id> C:/dir
python twitter_parser.py batch urls.txt C:/dump
```
Питфолы:
- Article blocks: `header-two` словами (маппинг в cmd_article), `unstyled`, `blockquote`, `code-block`
- Обложка: `article.cover_media.media_info.original_img_url` (?format=jpg&name=large)
- Rate limit ~1 req/s в batch
- Windows-пути: `C:/dir`, НЕ `/c/dir` (Python создаст C:\c)
## autoreg
- Python 3.11 + PYTHONPATH=""
- `config.example.json` → `config.json`: duckmail/cloudflare email workers/outlook pool, proxy_mode, proxy_pool
- Ядро: registration_flow.py, registration_parallel.py, browser_runtime.py (nodriver+Chrome, НЕ headless Playwright), proxy_pool_v3.py
- Выход: account_outputs.py (JSONL), cpa_export.py
## GitHub PAT + пуш (gh CLI мёртв на этой машине)
- Харвест PAT: `C:\Users\User\tmp\gh_pat_harvest.py` (login requests+TOTP из пула 172 акков `tmp/hoplite-gateway/data/gh_accounts.json`)
- Форма токена: POST `github.com/settings/tokens` (НЕ /tokens/new!), поля `oauth_access[description]`, `oauth_access[scopes][]`, `oauth_access[default_expires_at]`
- Location после /session = ПОЛНЫЙ URL
- Живые PAT: `C:\Users\User\tmp\gh_pats.json`
- Пуш без git-remote-https: Git Data API (`tmp/push_grok_suite.py` — blobs base64 ThreadPool6 → tree с base_tree → commit с parents → PATCH ref). ВАЖНО: на ПУСТОЙ репе /git/blobs = 409 «Git Repository is empty» — сначала init-коммит через Contents API (PUT /contents/README.md)
## Диагностика
1. :8000 пусто → поднять grok2api.exe из grok2api-deploy (background=true)
2. 502 у grok2api провайдера → шлюз down ИЛИ 0 акков в пуле
3. парсер code!=200 → твит удалён/приватный или fxtwitter down
4. PAT истёк (90d) → gh_pat_harvest.py на новом акке
## История
- 2026-09-20 ФИНАЛ: репа запушена — https://github.com/Violetpivary/grok-suite commit 1a09ceb, 1649 файлов (autoreg/ gateway/ twitter-parser/ scripts/ docs/FULL_GUIDE.md). Пуш через Git Data API инкрементальными поддеревьями (`tmp/push_grok_suite3.py` — ОДИН tree на 1649 файлов = 422 timeout, строить bottom-up по директориям)
- Все live-тесты PASS: healthz ok, 9 моделей, grok-chat-fast «OK», grok-4.6 «OK» 4.8s, X live-search 3 поста за 7.5s, x_parser.py 4 поста + JSON, fxtwitter article 15877 chars
- КЛЮЧ: реальный g2a-ключ в `grok2api-deploy/g2a_key.txt` (g2a_7c502f8386fc_...) — в Hermes config.yaml был СТАРЫЙ ключ (g2a_78c67429) → 401. Обновил в обоих конфигах
- Шлюз: grok2api.exe PID 34152 (--config config.yaml), 4 акка в пуле (2 web + 2 build), пополнение: `grok2api-deploy/replenish.py --count N`
- Upstream: chenyme/grok2api (MIT)