lottery_特码: 动态取 Qi/Week/Day (不再硬编码 082)
修: format_te_ma_result 内部自动取 v_xg.json - period=None → 自动取 Qi - qi_week=None → 自动取 Week - qi_day=None → 自动取 Day main() 也改: - CLI 参数: python3 lottery_特码.py [period] - 不传自动取 Qi - 一次取 Qi+Week+Day, 避免重复 API call 结果: 任何期号跑都正确 - 082 → '082 期' + 周四 + 7/30 - 083 → '083 期' + 周二 + 8/4 - 自动同步, 0 硬编码
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
5. 不强行 4 框架 (河洛/梅花/玄空/奇门) 公式 (reference 没推演方法)
|
||||
"""
|
||||
import re
|
||||
import json
|
||||
import subprocess
|
||||
from collections import Counter
|
||||
|
||||
@@ -126,12 +127,39 @@ def get_te_ma_candidates(period='082'):
|
||||
return weights
|
||||
|
||||
|
||||
def format_te_ma_result(weights, period='082', budget=15):
|
||||
"""输出特码候选 + 推荐分配"""
|
||||
def format_te_ma_result(weights, period=None, budget=15, qi_week=None, qi_day=None):
|
||||
"""输出特码候选 + 推荐分配
|
||||
|
||||
period: 不传则自动取 v_xg.json Qi 期
|
||||
qi_week / qi_day: 配套开彩日 (不传取 ?)
|
||||
"""
|
||||
# 自动取 Qi + 挂牌期信息
|
||||
if period is None or qi_week is None or qi_day is None:
|
||||
try:
|
||||
import urllib.request
|
||||
req = urllib.request.Request('https://btc.tktk.app/data/v_xg.json',
|
||||
headers={'User-Agent': 'Mozilla/5.0'})
|
||||
with urllib.request.urlopen(req, timeout=10) as r:
|
||||
v = json.loads(r.read().decode('utf-8'))
|
||||
if period is None:
|
||||
period = v.get('Qi', '???')
|
||||
if qi_week is None:
|
||||
qi_week = v.get('Week', '?')
|
||||
if qi_day is None:
|
||||
qi_day = v.get('Day', '?')
|
||||
except Exception:
|
||||
if period is None:
|
||||
period = '???'
|
||||
if qi_week is None:
|
||||
qi_week = '?'
|
||||
if qi_day is None:
|
||||
qi_day = '?'
|
||||
|
||||
L = []
|
||||
L.append(f"={('=' * 60)}=")
|
||||
L.append(f"082 期特码分析 (纯挂牌, 不混 Qi-2 期数据)".replace('082', period))
|
||||
L.append(f"={('=' * 60)}=")
|
||||
L.append("=" * 62)
|
||||
L.append(f"{period} 期特码分析 (纯挂牌, 不混 Qi-2 期数据)")
|
||||
L.append(f"开彩: {qi_week} (Day={qi_day}) {period} 期 21:30 北京时间")
|
||||
L.append("=" * 62)
|
||||
L.append("")
|
||||
L.append("📋 挂牌资料源:")
|
||||
L.append(" 1. https://sol.2344a.cc/zongheguapai/ (综合挂牌)")
|
||||
@@ -148,16 +176,17 @@ def format_te_ma_result(weights, period='082', budget=15):
|
||||
L.append("| 排序 | 特码 | 权重 | 来源 |")
|
||||
L.append("|---|---|---|---|")
|
||||
|
||||
# 常见号映射 (通用)
|
||||
src_map = {
|
||||
# 常见号映射来源 (按 082 期实际)
|
||||
9: '424208 彩图挂 + 诗象 + 中宫生气',
|
||||
33: '424206 彩图挂 (挂牌 33)',
|
||||
5: '424210 彩图挂 (挂牌 05 爆鼠)',
|
||||
9: '诗象 (09, 47 单出) + 彩图挂 09',
|
||||
33: '彩图挂 33',
|
||||
5: '彩图挂 05',
|
||||
47: '诗象 (单, 单出)',
|
||||
13: '彩霸王 三一玄数',
|
||||
3: '彩霸王 三一',
|
||||
1: '彩霸王 一三',
|
||||
31: '彩霸王 一三',
|
||||
8: '玄机字 (沐 8 划) + 中宫生气',
|
||||
}
|
||||
|
||||
for i, (num, w) in enumerate(top, 1):
|
||||
@@ -191,5 +220,30 @@ def format_te_ma_result(weights, period='082', budget=15):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
weights = get_te_ma_candidates('082')
|
||||
print(format_te_ma_result(weights, '082', 15))
|
||||
import sys
|
||||
# 支持 CLI 参数: python3 lottery_特码.py [period]
|
||||
period = sys.argv[1] if len(sys.argv) > 1 else None
|
||||
if period is None:
|
||||
# 自动取 v_xg.json Qi
|
||||
try:
|
||||
import urllib.request
|
||||
req = urllib.request.Request('https://btc.tktk.app/data/v_xg.json',
|
||||
headers={'User-Agent': 'Mozilla/5.0'})
|
||||
with urllib.request.urlopen(req, timeout=10) as r:
|
||||
period = json.loads(r.read().decode('utf-8')).get('Qi', '082')
|
||||
except Exception:
|
||||
period = '082'
|
||||
weights = get_te_ma_candidates(period)
|
||||
# 自动取 v_xg.json Qi + Week + Day 一次, 传所有
|
||||
try:
|
||||
import urllib.request
|
||||
req = urllib.request.Request('https://btc.tktk.app/data/v_xg.json',
|
||||
headers={'User-Agent': 'Mozilla/5.0'})
|
||||
with urllib.request.urlopen(req, timeout=10) as r:
|
||||
v = json.loads(r.read().decode('utf-8'))
|
||||
period = v.get('Qi', period)
|
||||
qi_week = v.get('Week', '?')
|
||||
qi_day = v.get('Day', '?')
|
||||
except Exception:
|
||||
qi_week = qi_day = '?'
|
||||
print(format_te_ma_result(weights, period, 15, qi_week, qi_day))
|
||||
Reference in New Issue
Block a user