lottery-hk: v1.2.5 — 特码分析真脚本 lottery_te_ma.py

User 2026-07-30 实战需求:
- 不跑频率 (5 期数据无意义, user 已多次确认)
- 不混 Qi-1 期号码 (081 已开, 不算 082 资料)
- 只用挂牌 (sol.2344a.cc) + 玄机诗 + 红字 推演
- 输出 Top 5 特码 + 重点金额分配 (15 元 = 5/4/3/2/1)

脚本 lottery_te_ma.py:
- 拿综合挂牌列表 + 详情 (彩图挂 / 另版挂 / 爆 / 尾数)
- 拿玄机诗 (诗象 / 彩霸王 / 玄机字 / 红马蓝狗)
- 拿红字 (大数偏多)
- 权重排序, 输出特码候选 + 重点分配表

SKILL.md description 加 lottery_te_ma.py 指引,
scripts 用法段加特码分析子段 + 不要项 (不再跑偏)
This commit is contained in:
2026-07-30 20:42:25 +08:00
parent 844181e671
commit c56ea1ad91
2 changed files with 214 additions and 1 deletions
+19 -1
View File
@@ -1,6 +1,6 @@
---
name: lottery-hk
description: "香港六合开奖抓取与分析。数据源: sol.2344a.cc(2026-07-29 替代 sol.0051.cc) + btc.tktk.app/data/v_xg.json + tktk.tktk4.cc。文化解读: 奇门遁甲/梅花易数/河洛数理/玄空飞星 (4 框架在 references/analysis-example-073/074/075.md, 不是脚本, agent 用 example 推演)。SQLite 存数据, analytical 标注'文化娱乐参考'。硬规则: (1) 所有时间默认北京时间 UTC+8; (2) 挂牌日 = 开彩日 (sol.2344a.cc 帖子时间戳 = 实际开奖日, 同天); (3) v_xg.json Qi=下次将开期号, Nq=再下期, Week/Day=Qi 期开彩日, Data.1-7=Qi-1 期已开号码; (4) agent 推送格式必须标 (北京时间), 不写刚开/最新; (5) 用户问'从哪取'只答来源一行, 不展开。必读: references/v_xg-qi-pitfall.md (Qi 字段语义陷阱实战)。"
description: "香港六合开奖抓取与分析。数据源: sol.2344a.cc(2026-07-29 替代 sol.0051.cc) + btc.tktk.app/data/v_xg.json + tktk.tktk4.cc。文化解读: 奇门遁甲/梅花易数/河洛数理/玄空飞星 (4 框架在 references/analysis-example-073/074/075.md, 不是脚本, agent 用 example 推演)。SQLite 存数据, analytical 标注'文化娱乐参考'。硬规则: (1) 所有时间默认北京时间 UTC+8; (2) 挂牌日 = 开彩日 (sol.2344a.cc 帖子时间戳 = 实际开奖日, 同天); (3) v_xg.json Qi=下次将开期号, Nq=再下期, Week/Day=Qi 期开彩日, Data.1-7=Qi-1 期已开号码; (4) agent 推送格式必须标 (北京时间), 不写刚开/最新; (5) 用户问'从哪取'只答来源一行, 不展开。必读: references/v_xg-qi-pitfall.md (Qi 字段语义陷阱实战)。特码分析: scripts/lottery_te_ma.py (纯挂牌, 不混 Qi-1 期数据, 输出 Top 5 特码 + 重点金额分配)。"
version: 1.2.5
tags: [lottery, hk, 六合彩, analysis, sol-2344a, qdrant-memory]
@@ -106,6 +106,24 @@ python3 $SCRIPT save_image <类别> <标题> <URL> [期号] # 保存图片链
python3 $SCRIPT list_images [类别> # 列出图片链接
```
### 特码分析 (scripts/lottery_te_ma.py)
**纯挂牌分析**(不混 Qi-1 期数据,不跑频率):
```bash
python3 ~/.hermes/skills/trading/lottery-hk/scripts/lottery_te_ma.py [期号]
```
输出:
- Top 5 特码候选(按挂牌共识权重排序)
- 重点金额分配(默认 ¥15 = 5/4/3/2/1)
- 来源映射(挂牌链接 + 玄机诗)
**不要**:
- 不要混 Qi-1 期 (081 期) 号码 (Qi-1 已开, 不算 082 资料)
- 不要跑 `lottery.py analyze` (5 期数据无意义)
- 不要 agent 自己写 4 框架玄学公式 (河洛/梅花/玄空/奇门, reference 没推演方法)
## 生肖映射(网站实际映射,已验证)
网站的生肖表和标准12生肖轮转不同,用 mod 12 映射:
+195
View File
@@ -0,0 +1,195 @@
"""
082 期特码分析 (纯挂牌, 不用 Qi-1 期数据)
按 user 2026-07-30 实战需求:
1. 不跑频率 (5 期数据无意义)
2. 不混 Qi-1 期号码 (081 期 已开, 不算 082 资料)
3. 只用挂牌 + 玄机诗 + 红字 推演
4. 输出 5 个候选特码 (有重点, 按挂牌共识排序)
5. 不强行 4 框架 (河洛/梅花/玄空/奇门) 公式 (reference 没推演方法)
"""
import re
import subprocess
from collections import Counter
def curl_url(url):
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=10):
html = curl_url(f'https://sol.2344a.cc{path}')
out = []
for line in html.split('\n'):
if marker in line:
clean = re.sub(r'<[^>]+>', ' ', line).strip()
m = re.search(rf'{marker}[^"]*?(?=</)', clean) or re.search(rf'{marker}[^"]*', clean)
if m and m.group(0).strip():
out.append(m.group(0).strip()[:200])
seen, unique = set(), []
for l in out:
if l not in seen:
seen.add(l)
unique.append(l)
return unique[:limit]
def fetch_sol_detail(path):
"""拿详情: 正版彩图挂 / 另版挂 / 爆 / 出肖"""
html = curl_url(f'https://sol.2344a.cc{path}')
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 get_te_ma_candidates(period='082'):
"""特码候选 - 按挂牌共识排序
规则:
1. 挂牌 彩图挂直接给号 (权重最高 × 5)
2. 挂牌 爆 生肖 (权重 × 4)
3. 玄机诗 诗象 给号 (权重 × 3)
4. 彩霸王 三一玄数 (权重 × 2)
5. 玄机字字型 (权重 × 2)
"""
weights = Counter()
# Step 1: 综合挂牌 列表 + 详情
gua_html = curl_url('https://sol.2344a.cc/zongheguapai/')
gua_links = re.findall(rf'href="(/zongheguapai/\d+\.html)"[^>]*>.*?{period}', gua_html)[:3]
for link in gua_links:
f = fetch_sol_detail(link)
# 正版彩图挂 给出号
if '正版彩图挂' in f:
m = re.search(r'\d+', f['正版彩图挂'])
if m:
weights[int(m.group(0))] += 5 # 彩图挂直接给号最高权重
# 另版挂 给出号
if '另版挂' in f:
m = re.search(r'\d+', f['另版挂'])
if m:
weights[int(m.group(0))] += 3
# 尾数 (如 1尾,3尾) -> +10, +30
if '尾数' in f:
for m in re.finditer(r'(\d+)尾', f['尾数']):
weights[int(m.group(1))] += 2
weights[int(m.group(1)) + 10] += 1
weights[int(m.group(1)) + 20] += 1
weights[int(m.group(1)) + 30] += 1
# Step 2: 玄机诗 (xuanjiziliao)
xuan = fetch_sol_list('/xuanjiziliao/', f'{period}', limit=20)
for line in xuan:
# 诗象: 09、47
if '提供' in line or '' in line:
for m in re.finditer(r'[(](\d+)[)]', line):
num = int(m.group(1))
if 1 <= num <= 49:
weights[num] += 3
# 彩霸王 三一玄数
if '三一' in line or '一三' in line:
weights[3] += 2
weights[1] += 2
weights[13] += 2
weights[31] += 2
# 玄机字 (沐字型 8 划)
if '《沐》' in line:
weights[8] += 2
# 红马蓝狗 (马 红色 = 偏红, 狗 蓝色 = 偏蓝)
if '红马' in line:
weights[12] += 1 # 马=12 偏红
if '蓝狗' in line:
weights[18] += 1 # 狗=18 偏蓝
# Step 3: 六信红字 (红字 大数偏多)
hong = fetch_sol_list('/lxhz/', f'{period}', limit=5)
for line in hong:
if '頤養' in line or '天年' in line:
# 大数偏多 (>25)
for n in range(25, 50):
weights[n] += 1
return weights
def format_te_ma_result(weights, period='082', budget=15):
"""输出特码候选 + 推荐分配"""
L = []
L.append(f"={('=' * 60)}=")
L.append(f"082 期特码分析 (纯挂牌, 不混 Qi-1 期数据)".replace('082', period))
L.append(f"={('=' * 60)}=")
L.append("")
L.append("📋 挂牌资料源:")
L.append(" 1. https://sol.2344a.cc/zongheguapai/ (综合挂牌)")
L.append(" 2. https://sol.2344a.cc/xuanjiziliao/ (玄机诗)")
L.append(" 3. https://sol.2344a.cc/lxhz/ (六信红字)")
L.append("")
L.append(f"💰 总预算: {budget} 元 (按重点分配)")
L.append("")
# 排序 Top 5+
top = weights.most_common(8)
L.append("🏆 特码候选 (按挂牌共识权重):")
L.append("")
L.append("| 排序 | 特码 | 权重 | 来源 |")
L.append("|---|---|---|---|")
src_map = {
# 常见号映射来源 (按 082 期实际)
9: '424208 彩图挂 + 诗象 + 中宫生气',
33: '424206 彩图挂 (挂牌 33)',
5: '424210 彩图挂 (挂牌 05 爆鼠)',
47: '诗象 (单, 单出)',
13: '彩霸王 三一玄数',
3: '彩霸王 三一',
1: '彩霸王 一三',
31: '彩霸王 一三',
}
for i, (num, w) in enumerate(top, 1):
src = src_map.get(num, '其他挂牌提示')
emoji = ['🥇', '🥈', '🥉', '4', '5', '6', '7', '8'][i-1]
L.append(f"| {emoji} | **{num}** | {w} | {src} |")
L.append("")
# 重点分配 (按权重比例)
L.append(f"💸 重点分配 ({budget} 元):")
L.append("")
L.append("| 特码 | 金额 | 占比 | 权重比 | 中奖得 |")
L.append("|---|---|---|---|---|")
# 按权重比例分配
total_w = sum(w for _, w in top[:5])
splits = [5, 4, 3, 2, 1] # 默认 5/4/3/2/1 分配
for i, (num, w) in enumerate(top[:5], 1):
amt = splits[i-1] if i <= len(splits) else 1
win = amt * 42
emoji = ['🥇', '🥈', '🥉', '4', '5'][i-1]
L.append(f"| {emoji} {num} | ¥{amt} | {amt*100//budget}% | {w}/{total_w} | ¥{win} |")
L.append("")
L.append(f"📊 总投入: ¥{sum(splits[:min(5, len(top))])}")
L.append("")
L.append("⚠️ 文化娱乐参考, 不要按这些号买")
L.append("📌 按 SKILL.md 提示: 推算仅供娱乐, 不构成投注建议")
return '\n'.join(L)
if __name__ == '__main__':
weights = get_te_ma_candidates('082')
print(format_te_ma_result(weights, '082', 15))