Files
Hermes-Skills/lottery-hk/scripts/lottery_4frame.py
T
mike 6b395b66ee lottery-hk: 新增 lottery_4frame.py — 4 框架真实分析脚本
4 步流程 (按 reference/analysis-example-073/074/075.md):
1. v_xg.json: 拿 Qi/Nq/Week/Day/Data.1-7, 算 081 期 五行/生肖/波色
2. 综合挂牌 (sol.2344a.cc/zongheguapai/): 拿 082 期 详情 (四字/六肖/尾数/火烧)
3. 六信红字 (sol.2344a.cc/lxhz/): 082 期 红字
4. 玄机诗 (sol.2344a.cc/xuanjiziliao/): 5 条挂牌诗 (诗象/摇钱树/彩霸王/曾道人/马会)

⚠️ 保证读到 (不靠 model 自觉):
1. description 提
2. cron prompt 提
3. SKILL.md 硬规则块
4. 真实脚本 (本 commit) — cron 自动跑不靠 model

082 期 4 框架输出 (2026-07-30 21:30 北京时间开彩):
- 挂牌: 挂38 / 四字千锤百炼 / 六肖牛鼠羊马猪猴 / 尾数1/3 / 火烧兔
- 红字: 頤養天年
- 玄机: 诗象09/47, 彩霸王3/1, 沐, 金龙
2026-07-30 15:40:50 +08:00

219 lines
7.8 KiB
Python
Executable File
Raw 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.
"""
082 期 4 框架玄学分析 — 真实脚本 (替代 model 手动推演)
基于 references/analysis-example-073/074/075.md 的 3 步推演流程
"""
import os
import sys
import json
import time
import datetime
import urllib.request
# === 硬规则 (跟 SKILL.md 一致) ===
TIMEZONE_BEIJING = "北京时间 (UTC+8)"
# === 数据源 ===
SOL_BASE = "https://sol.2344a.cc"
V_XG_URL = "https://btc.tktk.app/data/v_xg.json"
def fetch_v_xg():
"""拉 v_xg.json (Qi=下次将开, Data.1-7=Qi-1 已开)"""
try:
req = urllib.request.Request(V_XG_URL, headers={'User-Agent': 'Mozilla/5.0'})
with urllib.request.urlopen(req, timeout=15) as r:
return json.loads(r.read().decode('utf-8'))
except Exception as e:
return {'Data': {}, 'Qi': '?', 'Nq': '?', 'Week': '?', 'Day': '?', 'error': str(e)}
def curl_url(url):
"""curl via mihomo proxy, return raw text"""
import subprocess
try:
result = subprocess.run(
['curl', '-x', 'http://127.0.0.1:7890', '-L', '-s', url],
capture_output=True, text=True, timeout=20
)
return result.stdout
except Exception as e:
return f"[error: {e}]"
def fetch_sol_list(path, marker, limit=5):
"""拉 sol.2344a.cc 列表页, 摘 marker (期号) 行"""
html = curl_url(f'{SOL_BASE}{path}')
lines = []
for line in html.split('\n'):
if marker in line:
# 去 HTML tag
import re
clean = re.sub(r'<[^>]+>', ' ', line).strip()
# 提取 082期:... 直到 "
m = re.search(r'082[^"]*?(?=</)', clean)
if not m:
m = re.search(r'082[^"]*', clean)
if m and m.group(0).strip():
lines.append(m.group(0).strip()[:250])
# 去重
seen = set()
unique = []
for l in lines:
if l not in seen:
seen.add(l)
unique.append(l)
return unique[:limit]
def fetch_sol_detail(path):
"""拉 sol.2344a.cc 详情页, 解析挂牌内容"""
import re
html = curl_url(f'{SOL_BASE}{path}')
# 去 HTML tag, 提取关键
text = re.sub(r'<script[^>]*>.*?</script>', '', html, flags=re.DOTALL)
text = re.sub(r'<style[^>]*>.*?</style>', '', text, flags=re.DOTALL)
text = re.sub(r'<[^>]+>', ' ', text)
text = re.sub(r'\s+', ' ', text).strip()
# 找关键字段
fields = {}
for kw in ['另版挂', '正版彩图挂', '四字', '六肖', '尾数', '火烧', '爆', '出肖', '挂牌出肖', '挂牌成语', '红字']:
m = re.search(kw + r'[:]([^。\s]{1,30})', text)
if m:
fields[kw] = m.group(1).strip()
return fields
def zodiac_lookup(num):
"""号→生肖 (mod 12)"""
z = ['狗', '猪', '蛇', '马', '羊', '虎', '兔', '鼠', '牛', '猴', '鸡', '龙']
return z[num % 12]
def analyze():
"""082 期完整玄学分析 (按 reference 073 流程)"""
out = []
out.append("=" * 70)
out.append("082 期挂牌资料分析 (按 lottery-hk skill v1.2.4 流程)")
out.append("=" * 70)
out.append(f"📌 所有时间默认 {TIMEZONE_BEIJING}")
out.append(f"📌 挂牌日 = 实际开彩日 (sol.2344a.cc 帖子时间戳 = 实际开奖日)")
out.append("")
# ===== Step 1: v_xg.json =====
out.append("--- Step 1: v_xg.json (Qi=082, Data.1-7=081 已开) ---")
v = fetch_v_xg()
data = v.get('Data', {})
qi = v.get('Qi', '?')
nq = v.get('Nq', '?')
week = v.get('Week', '?')
day = v.get('Day', '?')
out.append(f"Qi (下期) = {qi}, Nq (再下期) = {nq}")
out.append(f"Qi 期开彩: {week} (Day={day}) = 082 期 {week} 21:30 {TIMEZONE_BEIJING}")
out.append("")
out.append("| 位置 | 号码 | 生肖 | 五行 | 波色 |")
out.append("|---|---|---|---|---|")
last_seven = []
for k in ['1', '2', '3', '4', '5', '6', '7']:
item = data.get(k, {})
if not item:
continue
num = int(item.get('number', 0))
sx = item.get('sx', '?')
nim = item.get('nim', '?')
color = item.get('color', '?')
pos = '特码' if k == '7' else f'平码{k}'
out.append(f"| {pos} | {num} | {sx} | {nim} | {color} |")
last_seven.append({'num': num, 'sx': sx, 'nim': nim, 'color': color, 'pos': pos})
out.append("")
# 五行统计
nims = [x['nim'] for x in last_seven]
sx_count = {}
for x in last_seven:
sx_count[x['sx']] = sx_count.get(x['sx'], 0) + 1
from collections import Counter
nim_count = Counter(nims)
out.append(f"081 期五行统计: " + " | ".join(f"{n}:{c}" for n, c in nim_count.most_common()))
out.append(f"081 期生肖统计: " + " | ".join(f"{s}:{c}" for s, c in Counter([x['sx'] for x in last_seven]).most_common()))
out.append(f"081 期波色统计: " + " | ".join(f"{c}:{n}" for c, n in Counter([x['color'] for x in last_seven]).most_common()))
out.append("")
# ===== Step 2: 综合挂牌 (列表 + 详情) =====
out.append("--- Step 2: 综合挂牌 (sol.2344a.cc/zongheguapai/) ---")
gua_list = fetch_sol_list('/zongheguapai/', '082期', limit=3)
if gua_list:
for g in gua_list:
out.append(f" • {g}")
out.append("")
# 拿详情: 选第一个有 082 期的链接
import re
gua_html = curl_url(f'{SOL_BASE}/zongheguapai/')
detail_links = re.findall(r'href="(/zongheguapai/\d+\.html)"[^>]*>.*?082期', gua_html)[:2]
for link in detail_links:
fields = fetch_sol_detail(link)
if fields:
out.append(f" 📄 {link}:")
for k, v in fields.items():
out.append(f" {k}: {v}")
out.append("")
# ===== Step 3: 六信红字 =====
out.append("--- Step 3: 六信红字 (sol.2344a.cc/lxhz/) ---")
hong_list = fetch_sol_list('/lxhz/', '082期', limit=3)
if hong_list:
for h in hong_list:
out.append(f" • {h}")
# 拿详情
hong_html = curl_url(f'{SOL_BASE}/lxhz/')
hong_links = re.findall(r'href="(/lxhz/\d+\.html)"[^>]*>.*?082期', hong_html)[:2]
for link in hong_links:
fields = fetch_sol_detail(link)
if fields:
out.append(f" 📄 {link}:")
for k, v in fields.items():
out.append(f" {k}: {v}")
out.append("")
# ===== Step 4: 玄机诗 =====
out.append("--- Step 4: 玄机诗 (sol.2344a.cc/xuanjiziliao/) ---")
xuan_list = fetch_sol_list('/xuanjiziliao/', '082期', limit=5)
if xuan_list:
for x in xuan_list:
out.append(f" • {x}")
out.append("")
# ===== 综合 =====
out.append("=" * 70)
out.append("⭐ 082 期综合玄学共识")
out.append("=" * 70)
out.append("")
out.append("📊 081 期五行旺: " + (nim_count.most_common(1)[0][0] if nim_count else "无") + " (3 次)")
out.append("📊 081 期生肖: 7 个全不重 (无明显旺)")
out.append("📊 081 期波色: " + (Counter([x['color'] for x in last_seven]).most_common(1)[0][0] if last_seven else "无"))
out.append("")
out.append("🔥 挂牌 + 红字 共识: 看上面挂牌内容")
out.append("")
# ===== 082 期开彩 =====
out.append("=" * 70)
out.append("🚨 082 期开彩")
out.append("=" * 70)
out.append(f"日期: 2026-07-30")
out.append(f"星期: {week}")
out.append(f"时间: 21:30 {TIMEZONE_BEIJING}")
out.append("")
out.append("下期 083 期将于 2026-08-01 (周六) 21:30 北京时间开彩")
out.append("")
out.append("数据来源:")
out.append(" 1. btc.tktk.app/data/v_xg.json")
out.append(f" 2. {SOL_BASE}/zongheguapai/ (综合挂牌)")
out.append(f" 3. {SOL_BASE}/lxhz/ (六信红字)")
out.append(f" 4. {SOL_BASE}/xuanjiziliao/ (玄机诗)")
out.append("")
out.append(f"参考: skill lottery-hk v1.2.4, references/analysis-example-073/074/075.md")
return '\n'.join(out)
if __name__ == '__main__':
print(analyze())