#!/usr/bin/env python # -*- coding: utf-8 -*- """ 网站推广工具包 - 检查 Google 收录状态 - 生成可直接发布的推广内容 - 提交到可自动提交的目录/平台 - 生成推广报告 """ import urllib.request, urllib.parse, sys, io, os, json, time from datetime import datetime sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) OUTPUT_DIR = os.path.join(BASE_DIR, 'output') SITE = 'https://blog.quant-view.xyz' BLOG_NAME = 'GFIL Trading Insights' ARTICLES = [ {'title': 'GFIL BOSS PANEL v7.0 Review: Institutional Trading Terminal', 'url': '/gfil-boss-panel-v70-review.html', 'kw': 'institutional trading terminal'}, {'title': 'Gold XAUUSD Trading in 2026: Why Retail Indicators Fail', 'url': '/gold-xauusd-trading-2026.html', 'kw': 'gold trading XAUUSD'}, {'title': 'TradingView vs GFIL BOSS: Chart Lag Comparison', 'url': '/tradingview-vs-gfil-boss.html', 'kw': 'trading platform comparison'}, {'title': 'Why 87% of Retail Traders Lose Money', 'url': '/why-retail-traders-lose-money.html', 'kw': 'retail trading losses'}, {'title': 'Your Trading Activity Is Being Tracked', 'url': '/trading-activity-tracked.html', 'kw': 'trading privacy'}, {'title': 'Forex Scalping Strategy 2026: 5-Minute System', 'url': '/forex-scalping-2026.html', 'kw': 'forex scalping strategy'}, {'title': 'How Institutions See Market Moves 15 Min Before', 'url': '/institutional-traders-see-market-moves.html', 'kw': 'institutional trading advantage'}, {'title': 'AI Market Intelligence: Human Analysis Is Obsolete', 'url': '/ai-driven-market-intelligence.html', 'kw': 'AI trading analysis'}, {'title': 'WTI Crude Oil 2026: Profit from Energy Volatility', 'url': '/wti-crude-oil-2026.html', 'kw': 'crude oil trading'}, {'title': 'GFIL BOSS PANEL FAQ: Complete Guide', 'url': '/gfil-boss-panel-faq.html', 'kw': 'GFIL BOSS PANEL FAQ'}, ] def check_google_index(): """用 site: 查询检查是否被收录""" print('=== Google 收录检查 ===') query = f'site:{SITE.replace("https://", "")}' url = f'https://www.google.com/search?q={urllib.parse.quote(query)}' req = urllib.request.Request(url, headers={ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36' }) try: r = urllib.request.urlopen(req, timeout=15) html = r.read().decode('utf-8', errors='replace') # Count results for line in html.split('\n'): if 'result-stats' in line or 'About' in line and 'results' in line: print(f' 收录结果: {line[:200]}') break else: print(f' 页面已返回,但无法解析结果数(google 可能要求验证)') # Count mentioned URLs url_count = sum(1 for a in ARTICLES if a['url'] in html) print(f' 页面中检测到 {url_count}/{len(ARTICLES)} 篇文章链接') except Exception as e: print(f' 检查失败(Google 验证拦截): {e}') def generate_reddit_posts(): """生成 Reddit 推广帖子(可直接复制发布)""" posts_dir = os.path.join(BASE_DIR, 'outreach_templates') os.makedirs(posts_dir, exist_ok=True) posts = [ { 'subreddit': 'r/Forex', 'title': "I analyzed why 87% of retail forex traders lose money — the data asymmetry is worse than you think", 'body': f"""I spent the last few weeks researching and writing a detailed analysis of the retail trader loss rate, and what I found surprised me. The common narrative is that traders lose because of poor risk management or lack of discipline. But the real culprit is **structural data asymmetry** between retail and institutional traders. Key findings: - Institutions get market-moving data 15-30 minutes before retail platforms show it - Most retail platforms have 500ms-3s of data delay (vs <50ms for institutional tools) - The average retail trader is trading on information that's already priced in - Order flow analysis reveals what institutions are doing before price moves I wrote a full breakdown here if anyone's interested: {SITE}/why-retail-traders-lose-money.html Would love to hear others' experiences with this. Has anyone else noticed the information gap in their own trading?""", 'articles': ['why-retail-traders-lose-money.html'] }, { 'subreddit': 'r/Daytrading', 'title': "TradingView vs institutional terminals — the latency difference is costing you money", 'body': f"""I did a detailed comparison between TradingView and institutional-grade trading terminals, specifically looking at data latency and its impact on day trading. The numbers are pretty stark: - TradingView average data latency: 500ms-3s (REST polling) - Institutional terminal latency: <50ms (WebSocket streaming) - Over 20 trades/day, the latency difference adds up to 60-160 pips of slippage Full comparison here: {SITE}/tradingview-vs-gfil-boss.html For those of you who've used both retail and institutional platforms — what's your experience been?""", 'articles': ['tradingview-vs-gfil-boss.html'] }, { 'subreddit': 'r/Gold', 'title': "Gold XAUUSD in 2026 — why traditional technical indicators are failing most traders", 'body': f"""Been analyzing gold markets extensively this year and noticing a troubling trend: the classic indicators (RSI, MACD, Bollinger Bands) that most retail traders rely on are becoming increasingly unreliable for gold trading. The reason? Institutions have moved to: - Real-time order flow analysis - Cumulative delta divergence - Volume profile & market profile - Intermarket correlation (DXY, yields, gold ETF flows) While retail traders watch lagging indicators, institutional desks are already positioned based on live order book data. Wrote a detailed guide here if anyone wants to dig deeper: {SITE}/gold-xauusd-trading-2026.html What indicators are you guys using for gold in 2026?""", 'articles': ['gold-xauusd-trading-2026.html'] }, ] # Save each post for post in posts: fname = f"reddit_{post['subreddit'].replace('r/','').lower()}.txt" path = os.path.join(posts_dir, fname) content = f"Subreddit: {post['subreddit']}\n" content += f"Title: {post['title']}\n" content += f"{'='*60}\n" content += post['body'] content += f"\n{'='*60}\n" content += f"\nTarget articles: {', '.join(post['articles'])}\n" with open(path, 'w', encoding='utf-8') as f: f.write(content) print(f' ✓ Reddit 帖子: {path}') return len(posts) def generate_tradingview_ideas(): """生成 TradingView 观点帖子""" ideas_dir = os.path.join(BASE_DIR, 'outreach_templates') os.makedirs(ideas_dir, exist_ok=True) ideas = [ { 'title': 'XAUUSD: Institutional Order Flow Shows Bearish Divergence — Technical Analysis', 'content': f"""Gold (XAUUSD) is showing a clear bearish divergence between price and cumulative delta on the 1-hour timeframe. Price made a higher high, but cumulative delta made a lower high. This divergence suggests institutional distribution is occurring — smart money is selling into strength. Key levels to watch: - Resistance: Previous high zone - Support: Volume-weighted average price (VWAP) For a complete analysis of how institutional traders read gold markets, check out our detailed guide: {SITE}/gold-xauusd-trading-2026.html Trade safe.""", }, { 'title': 'EUR/USD Scalping Setup: Delta Divergence on M5 — 15 Pip Target', 'content': f"""EUR/USD 5-minute chart showing a textbook delta divergence entry setup: Price making lower lows, but cumulative delta making higher lows — selling pressure exhausting. Entry: Bullish close above previous 1m high Stop: 5 pips below divergence low Target 1: 10 pips (50% position) Target 2: 15 pips (remaining) Full scalping strategy breakdown: {SITE}/forex-scalping-2026.html This is the exact setup institutional scalpers use.""", }, ] for i, idea in enumerate(ideas, 1): fname = f'tradingview_idea_{i}.txt' path = os.path.join(ideas_dir, fname) content = f"Title: {idea['title']}\n" content += f"{'='*60}\n" content += idea['content'].strip() with open(path, 'w', encoding='utf-8') as f: f.write(content) print(f' ✓ TradingView 观点: {path}') def submit_to_directories(): """尝试提交到公开收录目录""" print('\n=== 提交到公开目录 ===') # 1. 提交到 Search.co (免费目录提交) directories = [ ('Google Business Profile', 'https://business.google.com/', False), ('Bing Webmaster Tools', 'https://www.bing.com/webmasters/', False), ] for name, url, _ in directories: print(f' 📋 {name}: {url}(需手动提交)') print('\n ✅ IndexNow: 已提交 11 个 URL') print(' ✅ Sitemap: 已在 robots.txt 声明') print(' 📋 手动操作: Google Search Console + Bing Webmaster Tools') def generate_shareable_content(): """生成可直接分享的推广内容""" print('\n=== 社交媒体推广内容 ===') for art in ARTICLES: share_texts = [ f"📊 {art['title']}\n\n{art['kw'].title()} — full analysis:\n{SITE}{art['url']}", f"🔍 Just published: {art['title']}\n\nRead the full analysis 👇\n{SITE}{art['url']}", ] print(f'\n--- Article: {art["title"][:50]}... ---') for i, text in enumerate(share_texts, 1): char_count = len(text) print(f' Tweet {i} ({char_count} chars):') print(f' {text[:100]}...') print() def generate_report(): """生成完整的推广报告""" report_lines = [] report_lines.append('=' * 60) report_lines.append(f'博客推广报告 - {datetime.now().strftime("%Y-%m-%d %H:%M")}') report_lines.append('=' * 60) report_lines.append('') report_lines.append('✅ 技术 SEO') report_lines.append(' • 10篇深度文章 ✓') report_lines.append(' • 结构化数据 (WebSite/Organization/Breadcrumb/Article/FAQPage) ✓') report_lines.append(' • OG Image (og-default.svg) ✓') report_lines.append(' • 自定义 404 页面 ✓') report_lines.append(' • Sitemap.xml / robots.txt ✓') report_lines.append(' • Nginx Gzip + SSL + HTTP/2 + 缓存 ✓') report_lines.append('') report_lines.append('✅ 搜索引擎提交') report_lines.append(' • IndexNow API: 已提交 11 URLs ✓') report_lines.append(' • Google Search Console: 待验证(需你在 Cloudflare 加 TXT 记录)') report_lines.append('') report_lines.append('📋 待执行的推广任务') report_lines.append(' 1. Google Search Console 域名验证') report_lines.append(' 2. Reddit 发帖 (r/Forex / r/Daytrading / r/Gold)') report_lines.append(' 3. TradingView 发布观点') report_lines.append(' 4. 设置 GA4 看流量') report_lines.append(' 5. 写更多文章覆盖新关键词') report_lines.append('') report_lines.append('推广帖子已保存到 outreach_templates/ 目录') report_lines.append('=' * 60) report = '\n'.join(report_lines) print(report) path = os.path.join(OUTPUT_DIR, 'promotion_report.txt') with open(path, 'w', encoding='utf-8') as f: f.write(report) print(f'\n报告已保存: {path}') if __name__ == '__main__': action = sys.argv[1] if len(sys.argv) > 1 else 'all' if action in ('all', 'check'): check_google_index() if action in ('all', 'content'): print() print('=== 生成推广内容 ===') n_reddit = generate_reddit_posts() generate_tradingview_ideas() generate_shareable_content() print(f'\n✓ 共生成 {n_reddit} 个 Reddit 帖子 + 2 个 TradingView 观点') if action in ('all', 'submit'): submit_to_directories() if action in ('all', 'report'): generate_report()