From bb8a05fc882f31e55b60a838a01058e2727a0b25 Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期二, 26 十二月 2023 17:16:08 +0800
Subject: [PATCH] 开盘啦减持公告获取

---
 third_data/kpl_api.py |   46 +++++++++++++++++++++++++++++++++++-----------
 1 files changed, 35 insertions(+), 11 deletions(-)

diff --git a/third_data/kpl_api.py b/third_data/kpl_api.py
index 3cd00c4..3bd6925 100644
--- a/third_data/kpl_api.py
+++ b/third_data/kpl_api.py
@@ -178,15 +178,39 @@
     return list(set(blocks))
 
 
+# 鑾峰彇F10閲岄潰鐨勫ぇ浜嬩欢
+def __getF10BigReminders(code):
+    data = f"a=BigReminder&st=25&apiv=w32&c=StockF10Basic&StockID={code}&PhoneOSNew=1&DeviceID=a38adabd-99ef-3116-8bb8-6d893c846e23&VerSion=5.8.0.2&Index=0&"
+    result = __base_request("https://apparticle.longhuvip.com/w1/api/index.php", data=data, timeout=3)
+    result = json.loads(result)
+    if int(result["errcode"]) == 0:
+        return result["info"]
+    return None
+
+
+# 鑾峰彇鑲$エ鍑忔寔鏃ユ湡
+def getCodeReductionDate(code):
+    infos = __getF10BigReminders(code)
+    if not infos:
+        return None
+    keys = ["缁堟", "缁撴潫", "缁撴灉", "涓嶅噺鎸�", "瀹屾垚"]
+    for info in infos:
+        if info.get("type") == 5:
+            title = str(info.get("title"))
+            if title.find("鍑忔寔") < 0:
+                continue
+            wrong = False
+            for k in keys:
+                if title.find(k) >= 0:
+                    wrong = True
+            if wrong:
+                continue
+            return info.get("date").split(" ")[0]
+    return None
+
+
 if __name__ == "__main__":
-    blocks = getCodeBlocks("600713")
-    blocks1 = getCodeJingXuanBlocks("600713")
-    if len(blocks) > 2:
-        # 鏍规嵁娑ㄥ箙鎺掑簭
-        blocks.sort(key=lambda x: x[2])
-        blocks.reverse()
-        datas = []
-        for b in blocks:
-            if b[2] > 0 and b[1] not in constant.KPL_INVALID_BLOCKS:
-                datas.append(b)
-        print(datas)
+    codes = "000422,000536,000619,000766,000892,001255,001258,001300,002288,002442,002584,002632,002771,002942,300505,300949,600293,600610,600679,600769,603168,603188,603291,603329,603392,603518,603759,603767,603836,603839,603938,605218,688655"
+    codes = codes.split(",")
+    for code in codes:
+        print(code, getCodeReductionDate(code))

--
Gitblit v1.8.0