#!/usr/bin/env python # -*- coding: utf-8 -*- """GitHub 批量建仓库引流""" import urllib.request, json, base64, time, sys, io, os sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from config import GITHUB_TOKEN as TOKEN, BLOG_URL as BLOG, TOOLS_URL as TOOLS, TG_CHANNEL as TG, DISCORD_INVITE as DISCORD, LANDING_URL as TERMINAL def api(url, data=None): headers = {"Authorization": f"token {TOKEN}", "Content-Type": "application/json", "User-Agent": "GFIL-Bot", "Accept": "application/vnd.github+json"} req = urllib.request.Request(url, data=data, headers=headers, method="POST") return json.loads(urllib.request.urlopen(req, timeout=15).read()) repos = [ ("free-forex-position-size-calculator", "Free Forex Position Size Calculator", f"# Free Forex Position Size Calculator\n\n(Account x Risk%) / (Stop Loss x Pip Value) = Exact Lots\n\n👉 {BLOG}/tools/position-size-calculator.html\n\n## 16 Free Tools\n{TOOLS}\n\n## Community\n[Telegram]({TG}) | [Discord]({DISCORD}) | [Terminal]({TERMINAL})"), ("gold-xauusd-order-flow-trading", "Gold XAUUSD Order Flow Trading Strategy 2026", f"# Gold XAUUSD Order Flow Strategy\n\nStop using RSI. Start reading cumulative delta, volume profile, absorption.\n\n👉 {BLOG}/gold-xauusd-trading-2026.html\n\n## Free Tools\n{TOOLS}\n\n## Community\n[Telegram]({TG}) | [Discord]({DISCORD})"), ("forex-scalping-m5-london-strategy", "Forex Scalping M5 London Open Strategy", f"# M5 Forex Scalping Strategy\n\nLondon open liquidity sweep + delta divergence. 5 pip stop, 12-15 pip target.\n\n👉 {BLOG}/forex-scalping-2026.html\n\n## Tools\n[Position Size]({BLOG}/tools/position-size-calculator.html) | [All 16]({TOOLS})\n\n## Community\n[Telegram]({TG}) | [Discord]({DISCORD})"), ("16-free-trading-calculators", "16 Free Trading Calculators — No Signup, No Ads", f"# 16 Free Trading Calculators\n\nPosition Size, Pip Value, Fibonacci, ATR, Kelly Criterion, Margin, Risk/Reward, Drawdown, Profit Factor, Compound Interest, Pivot Points, Correlation Matrix, Currency Strength Meter, and more.\n\n👉 {TOOLS}\n\n## Community\n[Telegram]({TG}) | [Discord]({DISCORD}) | [Terminal]({TERMINAL})"), ("tradingview-websocket-latency-test", "TradingView vs WebSocket Latency — Real Data 2026", f"# TradingView Latency vs WebSocket\n\nTradingView: 500ms-3s REST polling. WebSocket: <50ms streaming. For scalpers, that's 60-100 pips/day.\n\n👉 {BLOG}/tradingview-vs-gfil-boss.html\n\n## Free Tools\n{TOOLS}\n\n## Community\n[Telegram]({TG}) | [Discord]({DISCORD}) | [Terminal]({TERMINAL})"), ("order-flow-cumulative-delta-guide", "Order Flow Trading — Cumulative Delta & Volume Profile Guide", f"# Order Flow Trading Guide\n\nCumulative delta divergence, volume profile, absorption patterns, footprint charts.\n\n👉 {BLOG}/order-flow-trading.html\n\n## Free Tools\n{TOOLS}\n\n## Community\n[Telegram]({TG}) | [Discord]({DISCORD})"), ("websocket-vs-rest-api-trading", "WebSocket vs REST API — Why Speed Matters in Trading", f"# WebSocket vs REST for Trading\n\nDuring NFP: REST = ~30 data points. WebSocket = ~6,000. That's the difference between seeing the move and missing it.\n\n👉 {BLOG}/websocket-vs-rest-api.html\n\n## Free Tools\n{TOOLS}\n\n## Community\n[Telegram]({TG}) | [Discord]({DISCORD})"), ("anonymous-trading-privacy-2026", "Anonymous Trading — Strategy Privacy Guide 2026", f"# Anonymous Trading Guide\n\nBrokers see every trade. Market makers detect flow. HFT firms reverse-engineer strategies. Protect yourself.\n\n👉 {BLOG}/trading-activity-tracked.html\n\n## Free Tools\n{TOOLS}\n\n## Community\n[Telegram]({TG}) | [Discord]({DISCORD})"), ] if __name__ == "__main__": print(f"🐙 GitHub: 批量建 {len(repos)} 个仓库...") print(f" Token: {TOKEN[:25]}...") print() count = 0 for name, desc, readme in repos: try: r = api("https://api.github.com/user/repos", json.dumps({"name": name, "description": desc, "private": False, "auto_init": True}).encode()) if "id" not in r: print(f" ⚠️ {name}: {r.get('message','?')}") if "rate" in str(r).lower(): print(" ⏰ Rate limited, waiting 30s...") time.sleep(30) continue readme_b64 = base64.b64encode(readme.encode()).decode() api(f"https://api.github.com/repos/liudecai-one/{name}/contents/README.md", json.dumps({"message": "Add trading resources", "content": readme_b64}).encode()) print(f" ✅ github.com/liudecai-one/{name}") count += 1 except Exception as e: print(f" ❌ {name}: {str(e)[:60]}") time.sleep(1.5) print(f"\n📊 {count}/{len(repos)} repos created") print(f"📈 总仓库数: {128 + count}+")