From d48fce073e05943be5e3b13e4a65a3750d28f704 Mon Sep 17 00:00:00 2001 From: karuo Date: Fri, 13 Mar 2026 16:50:14 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=84=20=E5=8D=A1=E8=8B=A5AI=20=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=202026-03-13=2016:50=20|=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=EF=BC=9A=E5=8D=A1=E6=9C=A8=E3=80=81=E8=BF=90=E8=90=A5=E4=B8=AD?= =?UTF-8?q?=E6=9E=A2=E3=80=81=E8=BF=90=E8=90=A5=E4=B8=AD=E6=9E=A2=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E5=8F=B0=20|=20=E6=8E=92=E9=99=A4=20>20MB:=2011=20?= =?UTF-8?q?=E4=B8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../木叶_视频内容/多平台分发/脚本/publish_log.json | 9 + .../视频号发布/脚本/channels_api_publish.py | 7 +- .../视频号发布/脚本/channels_storage_state.json | 2 +- .../视频号发布/脚本/channels_task_id.txt | 2 +- .../视频号发布/脚本/channels_token.json | 10 +- 运营中枢/scripts/smsonline_get_token.py | 169 ++++++++++++++++++ 运营中枢/工作台/gitea_push_log.md | 1 + 运营中枢/工作台/代码管理.md | 1 + 8 files changed, 191 insertions(+), 10 deletions(-) create mode 100644 运营中枢/scripts/smsonline_get_token.py diff --git a/03_卡木(木)/木叶_视频内容/多平台分发/脚本/publish_log.json b/03_卡木(木)/木叶_视频内容/多平台分发/脚本/publish_log.json index 9973c2c5..da7747c4 100644 --- a/03_卡木(木)/木叶_视频内容/多平台分发/脚本/publish_log.json +++ b/03_卡木(木)/木叶_视频内容/多平台分发/脚本/publish_log.json @@ -154,3 +154,12 @@ {"platform": "抖音", "video_path": "/Users/karuo/Movies/soul视频/soul 派对 120场 20260320_output/成片/赚钱没那么复杂,自信心才是核心问题.mp4", "title": "获得收益真没那么复杂,自信心才是卡住你的核心问题", "success": false, "status": "error", "message": "Cookie 已过期", "elapsed_sec": 0.14186525344848633, "timestamp": "2026-03-11 17:19:12"} {"platform": "小红书", "video_path": "/Users/karuo/Movies/soul视频/soul 派对 120场 20260320_output/成片_大师版/AI每天剪1000个视频 M4电脑24T素材库全网分发.mp4", "title": "M4芯片+24T素材库,AI每天剪1000条视频自动全网分发", "success": true, "status": "published", "message": "页面已重置(发布成功)", "screenshot": "/tmp/xhs_result.png", "elapsed_sec": 28.265141010284424, "timestamp": "2026-03-11 17:19:43"} {"platform": "小红书", "video_path": "/Users/karuo/Movies/soul视频/soul 派对 120场 20260320_output/成片_大师版/Soul派对变现全链路 发视频就有钱,后端全解决.mp4", "title": "Soul派对怎么商业转化?发视频就有收益,后端体系全部搞定", "success": true, "status": "published", "message": "页面已重置(发布成功)", "screenshot": "/tmp/xhs_result.png", "elapsed_sec": 26.74960207939148, "timestamp": "2026-03-11 17:20:13"} +{"platform": "视频号", "video_path": "/Users/karuo/Movies/soul视频/soul_派对_121场_20260311_output/成片_final/Cursor的权限问题,安全隐患必须提前讲清楚.mp4", "title": "Cursor的权限问题,安全隐患必须提前讲清楚 #Soul派对 #创业日记", "success": true, "status": "published", "message": "纯 API 发布成功 (13.0s)", "elapsed_sec": 13.048572778701782, "timestamp": "2026-03-13 16:11:37"} +{"platform": "视频号", "video_path": "/Users/karuo/Movies/soul视频/soul_派对_121场_20260311_output/成片_final/NFC碰一碰引流,线下餐饮店用这招就够了.mp4", "title": "NFC碰一碰引流,线下餐饮店用这招就够了 #Soul派对 #创业日记", "success": true, "status": "published", "message": "纯 API 发布成功 (10.9s)", "elapsed_sec": 10.91233205795288, "timestamp": "2026-03-13 16:11:56"} +{"platform": "视频号", "video_path": "/Users/karuo/Movies/soul视频/soul_派对_121场_20260311_output/成片_final/Skill和Cursor的区别,一个走工作流一个走对话.mp4", "title": "Skill和Cursor的区别,一个走工作流一个走对话 #Soul派对 #创业日记", "success": true, "status": "published", "message": "纯 API 发布成功 (8.0s)", "elapsed_sec": 8.028389930725098, "timestamp": "2026-03-13 16:12:13"} +{"platform": "视频号", "video_path": "/Users/karuo/Movies/soul视频/soul_派对_121场_20260311_output/成片_final/Soul派对比抖音省力太多,连麦机制是核心差异.mp4", "title": "Soul派对比抖音省力太多,连麦机制是核心差异 #Soul派对 #创业日记", "success": true, "status": "published", "message": "纯 API 发布成功 (9.1s)", "elapsed_sec": 9.126675844192505, "timestamp": "2026-03-13 16:12:30"} +{"platform": "视频号", "video_path": "/Users/karuo/Movies/soul视频/soul_派对_121场_20260311_output/成片_final/做API聚合给别人充值,这是另一种AI变现路径.mp4", "title": "做API聚合给别人充值,这是另一种AI变现路径 #Soul派对 #创业日记", "success": true, "status": "published", "message": "纯 API 发布成功 (14.9s)", "elapsed_sec": 14.861711025238037, "timestamp": "2026-03-13 16:12:54"} +{"platform": "视频号", "video_path": "/Users/karuo/Movies/soul视频/soul_派对_121场_20260311_output/成片_final/帮别人装AI工具就能赚钱,工作流才是变现入口.mp4", "title": "帮别人装AI工具就能赚钱,工作流才是变现入口 #Soul派对 #创业日记", "success": true, "status": "published", "message": "纯 API 发布成功 (12.3s)", "elapsed_sec": 12.33399510383606, "timestamp": "2026-03-13 16:13:14"} +{"platform": "视频号", "video_path": "/Users/karuo/Movies/soul视频/soul_派对_121场_20260311_output/成片_final/本地部署大模型到底行不行,小事可以大事别想.mp4", "title": "本地部署大模型到底行不行,小事可以大事别想 #Soul派对 #创业日记", "success": true, "status": "published", "message": "纯 API 发布成功 (12.8s)", "elapsed_sec": 12.772934913635254, "timestamp": "2026-03-13 16:13:36"} +{"platform": "视频号", "video_path": "/Users/karuo/Movies/soul视频/soul_派对_121场_20260311_output/成片_final/每个消费者都是你的流量入口,碰一碰就能连接.mp4", "title": "每个消费者都是你的流量入口,碰一碰就能连接 #Soul派对 #创业日记", "success": true, "status": "published", "message": "纯 API 发布成功 (11.6s)", "elapsed_sec": 11.603442907333374, "timestamp": "2026-03-13 16:13:56"} +{"platform": "视频号", "video_path": "/Users/karuo/Movies/soul视频/soul_派对_121场_20260311_output/成片_final/电竞19年经验加AI,跨界结合才有真正的护城河.mp4", "title": "电竞19年经验加AI,跨界结合才有真正的护城河 #Soul派对 #创业日记", "success": true, "status": "published", "message": "纯 API 发布成功 (12.8s)", "elapsed_sec": 12.751282215118408, "timestamp": "2026-03-13 16:14:17"} diff --git a/03_卡木(木)/木叶_视频内容/视频号发布/脚本/channels_api_publish.py b/03_卡木(木)/木叶_视频内容/视频号发布/脚本/channels_api_publish.py index add74663..74ea5760 100644 --- a/03_卡木(木)/木叶_视频内容/视频号发布/脚本/channels_api_publish.py +++ b/03_卡木(木)/木叶_视频内容/视频号发布/脚本/channels_api_publish.py @@ -25,7 +25,7 @@ import httpx SCRIPT_DIR = Path(__file__).parent COOKIE_FILE = SCRIPT_DIR / "channels_storage_state.json" -VIDEO_DIR = Path("/Users/karuo/Movies/soul视频/soul 派对 120场 20260320_output/成片_大师版") +VIDEO_DIR = Path("/Users/karuo/Movies/soul视频/soul_派对_121场_20260311_output/成片_final") sys.path.insert(0, str(SCRIPT_DIR.parent.parent / "多平台分发" / "脚本")) from publish_result import PublishResult, is_published, save_results, print_summary @@ -536,8 +536,9 @@ def _run_login_then_retry(): if not login_script.exists(): return False print("[*] Cookie 无效,正在自动调起登录(浏览器将打开,请扫码)...", flush=True) - r = subprocess.run([sys.executable, str(login_script)], cwd=str(SCRIPT_DIR), timeout=300) - return r.returncode == 0 + subprocess.run([sys.executable, str(login_script)], cwd=str(SCRIPT_DIR), timeout=300) + # rawKeyBuff 非必需,只要 Cookie 文件已更新即可认为登录成功 + return COOKIE_FILE.exists() and COOKIE_FILE.stat().st_size > 100 async def main(): diff --git a/03_卡木(木)/木叶_视频内容/视频号发布/脚本/channels_storage_state.json b/03_卡木(木)/木叶_视频内容/视频号发布/脚本/channels_storage_state.json index 52b8f8d6..2f48e7f4 100644 --- a/03_卡木(木)/木叶_视频内容/视频号发布/脚本/channels_storage_state.json +++ b/03_卡木(木)/木叶_视频内容/视频号发布/脚本/channels_storage_state.json @@ -1 +1 @@ -{"cookies": [{"name": "sessionid", "value": "BgAAySFskQflFyEymqZMOalyrdmMk5xmq4gumjVNMmShioI94oWnXQCEfWXKsQ6BLvvIt7FCPL65xB0aePR18FEWr01wtmjbrrie1%2BoCEjs%3D", "domain": "channels.weixin.qq.com", "path": "/", "expires": 1807854753.00845, "httpOnly": false, "secure": true, "sameSite": "None"}, {"name": "wxuin", "value": "4249681427", "domain": "channels.weixin.qq.com", "path": "/", "expires": 1807854753.008508, "httpOnly": false, "secure": true, "sameSite": "None"}], "origins": [{"origin": "https://channels.weixin.qq.com", "localStorage": [{"name": "__ml::page_6b465a4b-9431-4a1c-99c7-76a0423901a3", "value": "{\"pageId\":\"LoginForIframe\",\"accessId\":\"8d12cc30-0707-4554-8576-66d2de5f4632\",\"step\":1}"}, {"name": "__ml::page_b007a852-0fa9-4c81-8999-0996de5d3955", "value": "{\"pageId\":\"Home\",\"accessId\":\"3a16659d-82a2-491e-8454-a3fbb20c62c2\",\"step\":1}"}, {"name": "__ml::hb_ts", "value": "1773294723328"}, {"name": "finder_route_meta", "value": "micro.content/post/list;index;1;1773294830483"}, {"name": "__ml::page_64bc2640-049f-4a88-b247-5b334a248f16", "value": "{\"pageId\":\"LoginForIframe\",\"accessId\":\"e9668dd6-d202-4a4e-86af-c19db52e1c43\",\"step\":1}"}, {"name": "__rx::aid", "value": "\"ce49f3b8-c5ef-4cae-8798-4df77ac721fd\""}, {"name": "__ml::aid", "value": "\"ce49f3b8-c5ef-4cae-8798-4df77ac721fd\""}, {"name": "__ml::page", "value": "[\"64bc2640-049f-4a88-b247-5b334a248f16\",\"6b465a4b-9431-4a1c-99c7-76a0423901a3\",\"b007a852-0fa9-4c81-8999-0996de5d3955\",\"ace605e5-74aa-4fcb-8e5c-9b4b23c7ae7b\",\"ac12b732-37e2-47e3-b97e-6c0178f68048\",\"63574ae3-342a-41a6-8fe4-7492b515dbdd\"]"}, {"name": "finder_login_token", "value": ""}, {"name": "finder_username", "value": "v2_060000231003b20faec8c5e48919cbd5cb05e53db077dd1924028a806c10cffd891eb5a80ce7@finder"}, {"name": "__ml::page_ace605e5-74aa-4fcb-8e5c-9b4b23c7ae7b", "value": "{\"pageId\":\"PostCard\",\"accessId\":\"8c1bbb73-adfe-4d8c-8685-54faf23f87eb\",\"step\":1}"}, {"name": "_finger_print_device_id", "value": "6fd704941768442b12a996d2652fc61e"}, {"name": "MICRO_VISITED_NAME", "value": "{\"postCard\":1,\"content\":1}"}, {"name": "__ml::page_ac12b732-37e2-47e3-b97e-6c0178f68048", "value": "{\"pageId\":\"MicroPost\",\"accessId\":\"e434233d-9523-4067-aa98-23ef969680cb\",\"step\":1}"}, {"name": "UvFirstReportLocalKey", "value": "1773244800000"}, {"name": "__ml::page_63574ae3-342a-41a6-8fe4-7492b515dbdd", "value": "{\"pageId\":\"PostList\",\"accessId\":\"9b7981aa-77b8-4224-a786-a9431138f718\",\"step\":1}"}, {"name": "finder_ua_report_data", "value": "{\"browser\":\"Chrome\",\"browserVersion\":\"131.0.0.0\",\"engine\":\"Webkit\",\"engineVersion\":\"537.36\",\"os\":\"Mac OS X\",\"osVersion\":\"10.15.7\",\"device\":\"desktop\",\"darkmode\":0}"}, {"name": "finder_uin", "value": ""}]}]} \ No newline at end of file +{"cookies": [{"name": "sessionid", "value": "BgAAZEcp7spdDMd18bSqLdVpyb1KwaeKsJUw%2Bzro6mBtUmfyKSqLWOx2lhfpHvPPz%2F2uCVLSz234%2BhroIPhboAc8Qu%2B1%2FqYQiIEMmK%2FLKPg%3D", "domain": "channels.weixin.qq.com", "path": "/", "expires": 1807950356.118908, "httpOnly": false, "secure": true, "sameSite": "None"}, {"name": "wxuin", "value": "616486132", "domain": "channels.weixin.qq.com", "path": "/", "expires": 1807950356.11896, "httpOnly": false, "secure": true, "sameSite": "None"}], "origins": [{"origin": "https://channels.weixin.qq.com", "localStorage": [{"name": "finder_uin", "value": ""}, {"name": "__ml::page_701fd1f5-b404-4b8e-a88b-29d35b0dee5d", "value": "{\"pageId\":\"LoginForIframe\",\"accessId\":\"9d92ba5c-aa9f-4a2e-b2c9-f8dedbeba2fe\",\"step\":1}"}, {"name": "__ml::page_6f428237-88e3-469e-bd84-29668c6795d6", "value": "{\"pageId\":\"PostCreate\",\"accessId\":\"d6e47c2e-6467-4535-897a-bc63978f505b\",\"step\":3,\"refAccessId\":\"416e9ed0-196a-4fe0-953d-834857f603a1\",\"refPageId\":\"PostList\"}"}, {"name": "__ml::hb_ts", "value": "1773391571268"}, {"name": "__ml::page_50f1abbb-d70e-4933-b554-ffd229777645", "value": "{\"pageId\":\"PostList\",\"accessId\":\"3bb96758-57c5-4c6c-9ecb-fc443d0089b0\",\"step\":1}"}, {"name": "__ml::aid", "value": "\"1937ed0f-4064-4cd6-8873-e600c3023705\""}, {"name": "__rx::aid", "value": "\"1937ed0f-4064-4cd6-8873-e600c3023705\""}, {"name": "__ml::page", "value": "[\"701fd1f5-b404-4b8e-a88b-29d35b0dee5d\",\"a5a5e497-7233-43d5-9961-e5d23ca1da25\",\"5d75027b-41e1-43ca-8c02-a27a35493892\",\"433c05a2-59aa-42ff-9e03-fb0645bdb0e7\",\"04cdcfd2-23d1-4b3e-a2b6-96bce9916a89\",\"449d81f1-c914-4ca6-aadc-59c7c1d104bf\",\"50f1abbb-d70e-4933-b554-ffd229777645\",\"a2ad64ac-e4fa-49c3-9279-f08f41d03572\",\"6f428237-88e3-469e-bd84-29668c6795d6\"]"}, {"name": "__ml::page_04cdcfd2-23d1-4b3e-a2b6-96bce9916a89", "value": "{\"pageId\":\"PostList\",\"accessId\":\"3fabf198-8333-47a1-b513-b0f0a66b346f\",\"step\":5,\"refAccessId\":\"58ab6370-c575-4cf3-a4c1-37874190826d\",\"refPageId\":\"PostList\"}"}, {"name": "finder_login_token", "value": ""}, {"name": "finder_username", "value": "v2_060000231003b20faec8c5e48919cbd5cb05e53db077dd1924028a806c10cffd891eb5a80ce7@finder"}, {"name": "__ml::page_449d81f1-c914-4ca6-aadc-59c7c1d104bf", "value": "{\"pageId\":\"MicroPost\",\"accessId\":\"2be1c28f-d74b-4505-a5e0-05fc05a40a35\",\"step\":1}"}, {"name": "_finger_print_device_id", "value": "6fd704941768442b12a996d2652fc61e"}, {"name": "__ml::page_a2ad64ac-e4fa-49c3-9279-f08f41d03572", "value": "{\"pageId\":\"MicroPost\",\"accessId\":\"1725dcc4-caaf-4891-8e3b-a0290cef135e\",\"step\":3,\"refAccessId\":\"57b84bb0-e8cf-470f-b7a9-a21a5f4dd5a8\",\"refPageId\":\"MicroPost\"}"}, {"name": "MICRO_VISITED_NAME", "value": "{\"postCard\":1,\"content\":9}"}, {"name": "__ml::page_5d75027b-41e1-43ca-8c02-a27a35493892", "value": "{\"pageId\":\"PostCard\",\"accessId\":\"1b8e7160-8e93-4e90-b8ff-69c646ebf682\",\"step\":1}"}, {"name": "__ml::page_433c05a2-59aa-42ff-9e03-fb0645bdb0e7", "value": "{\"pageId\":\"MicroPost\",\"accessId\":\"3229b8f4-0be3-4ad7-8699-535436a92f12\",\"step\":6,\"refAccessId\":\"b9118e4b-e64b-4efd-920f-767620ca08ec\",\"refPageId\":\"MicroPost\"}"}, {"name": "__ml::page_a5a5e497-7233-43d5-9961-e5d23ca1da25", "value": "{\"pageId\":\"LoginForIframe\",\"accessId\":\"11dfa431-f060-43a6-b1b7-c88cb6c38e33\",\"step\":1}"}, {"name": "UvFirstReportLocalKey", "value": "1773331200000"}, {"name": "finder_ua_report_data", "value": "{\"browser\":\"Chrome\",\"browserVersion\":\"131.0.0.0\",\"engine\":\"Webkit\",\"engineVersion\":\"537.36\",\"os\":\"Mac OS X\",\"osVersion\":\"10.15.7\",\"device\":\"desktop\",\"darkmode\":0}"}, {"name": "finder_route_meta", "value": "micro.content/post/create;micro.content/post/list;1;1773391526637"}]}]} \ No newline at end of file diff --git a/03_卡木(木)/木叶_视频内容/视频号发布/脚本/channels_task_id.txt b/03_卡木(木)/木叶_视频内容/视频号发布/脚本/channels_task_id.txt index b38a0c8f..f27c7a0e 100644 --- a/03_卡木(木)/木叶_视频内容/视频号发布/脚本/channels_task_id.txt +++ b/03_卡木(木)/木叶_视频内容/视频号发布/脚本/channels_task_id.txt @@ -1 +1 @@ -14874685889694992639 +1773390235611073448 \ No newline at end of file diff --git a/03_卡木(木)/木叶_视频内容/视频号发布/脚本/channels_token.json b/03_卡木(木)/木叶_视频内容/视频号发布/脚本/channels_token.json index 82fb7fe0..bf7eb9ac 100644 --- a/03_卡木(木)/木叶_视频内容/视频号发布/脚本/channels_token.json +++ b/03_卡木(木)/木叶_视频内容/视频号发布/脚本/channels_token.json @@ -1,10 +1,10 @@ { - "sessionid": "BgAAySFskQflFyEymqZMOalyrdmMk5xmq4gumjVNMmShioI94oWnXQCEfWXKsQ6BLvvIt7FCPL65xB0aePR18FEWr01wtmjbrrie1%2BoCEjs%3D", - "wxuin": "4249681427", - "cookie_str": "sessionid=BgAAySFskQflFyEymqZMOalyrdmMk5xmq4gumjVNMmShioI94oWnXQCEfWXKsQ6BLvvIt7FCPL65xB0aePR18FEWr01wtmjbrrie1%2BoCEjs%3D; wxuin=4249681427", + "sessionid": "BgAAZEcp7spdDMd18bSqLdVpyb1KwaeKsJUw%2Bzro6mBtUmfyKSqLWOx2lhfpHvPPz%2F2uCVLSz234%2BhroIPhboAc8Qu%2B1%2FqYQiIEMmK%2FLKPg%3D", + "wxuin": "616486132", + "cookie_str": "sessionid=BgAAZEcp7spdDMd18bSqLdVpyb1KwaeKsJUw%2Bzro6mBtUmfyKSqLWOx2lhfpHvPPz%2F2uCVLSz234%2BhroIPhboAc8Qu%2B1%2FqYQiIEMmK%2FLKPg%3D; wxuin=616486132", "finder_raw": "", - "finder_username": "v2_060000231003b20faec8c5e48919cbd5cb05e53db077dd1924028a806c10cffd891eb5a80ce7@finder", + "finder_username": "", "finder_uin": "", "finder_login_token": "", - "url": "https://channels.weixin.qq.com/platform/post/list" + "url": "https://channels.weixin.qq.com/platform/post/list?tab=post" } \ No newline at end of file diff --git a/运营中枢/scripts/smsonline_get_token.py b/运营中枢/scripts/smsonline_get_token.py new file mode 100644 index 00000000..9498518c --- /dev/null +++ b/运营中枢/scripts/smsonline_get_token.py @@ -0,0 +1,169 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +自动打开 premium.smsonline.cloud,用已保存的 Google 登录态拿到 Firebase idToken。 +拿到后立刻下单 SoulApp 中国号码,轮询收验证码,超时自动退号。 +""" +import json +import sys +import time +import re +import urllib.request +from playwright.sync_api import sync_playwright + +PREMIUM_URL = "https://premium.smsonline.cloud/popular" +API_BASE = "https://api-x.smsonline.cloud/v3" +USER_ID = "PmFBSlkilbMeOsPJb2AdqRD13g93" +TIMEOUT_SEC = 120 +POLL_INTERVAL = 5 + + +def api_put(url, token, body): + data = json.dumps(body).encode("utf-8") + req = urllib.request.Request(url, data=data, method="PUT") + req.add_header("Authorization", f"Bearer {token}") + req.add_header("Content-Type", "application/json") + with urllib.request.urlopen(req, timeout=20) as r: + return json.loads(r.read().decode("utf-8")) + + +def api_get(url, token): + req = urllib.request.Request(url) + req.add_header("Authorization", f"Bearer {token}") + req.add_header("Content-Type", "application/json") + with urllib.request.urlopen(req, timeout=20) as r: + return json.loads(r.read().decode("utf-8")) + + +def api_patch(url, token): + req = urllib.request.Request(url, method="PATCH") + req.add_header("Authorization", f"Bearer {token}") + req.add_header("Content-Type", "application/json") + with urllib.request.urlopen(req, timeout=20) as r: + return json.loads(r.read().decode("utf-8")) + + +PROFILE_DIR = "/Users/karuo/.smsonline_browser_profile" + +def get_token_from_browser(): + """用 Playwright persistent context 打开 premium 站,拦截请求拿到最新 Bearer token。 + 首次需手动 Google 登录,之后 cookie 保存在 profile 里自动登录。""" + captured_token = {"value": None} + + def on_request(request): + auth = request.headers.get("authorization", "") + if auth.startswith("Bearer eyJ") and len(auth) > 200: + captured_token["value"] = auth.replace("Bearer ", "") + + with sync_playwright() as p: + ctx = p.chromium.launch_persistent_context( + PROFILE_DIR, + headless=False, + accept_downloads=False, + ignore_https_errors=True, + ) + page = ctx.pages[0] if ctx.pages else ctx.new_page() + page.on("request", on_request) + print("正在打开 premium.smsonline.cloud …") + print("首次请手动完成 Google 登录(之后会自动登录)。") + try: + page.goto(PREMIUM_URL, wait_until="networkidle", timeout=60000) + except Exception: + pass + for i in range(15): + if captured_token["value"]: + break + time.sleep(2) + if not captured_token["value"]: + try: + page.reload(wait_until="networkidle", timeout=30000) + except Exception: + pass + for i in range(15): + if captured_token["value"]: + break + time.sleep(2) + if not captured_token["value"]: + print("未自动拿到 token,请在浏览器中手动登录…最多等 120 秒") + for i in range(60): + if captured_token["value"]: + break + time.sleep(2) + ctx.close() + return captured_token["value"] + + +def buy_and_receive(token, service="mx", country="China", network="network02"): + """下单→轮询→收码→超时退号。""" + url = f"{API_BASE}/numbers/{USER_ID}/order" + body = { + "maximumPrice": 2000, + "country": country, + "service": service, + "carrier": "any", + "network": network, + "m": "", + "n": "" + } + print(f"正在下单 {service} ({country}) …") + result = api_put(url, token, body) + print(f"下单结果:{json.dumps(result, ensure_ascii=False)}") + if not result.get("ok"): + print(f"下单失败:{result.get('errorMessage', '未知错误')}") + return None, None + order = result.get("body", {}) + order_id = order.get("orderId") or order.get("id") + number = order.get("number") or order.get("phone") + print(f"号码:{number} 订单:{order_id}") + print(f"轮询中(最多 {TIMEOUT_SEC} 秒)…") + start = time.time() + while time.time() - start < TIMEOUT_SEC: + time.sleep(POLL_INTERVAL) + elapsed = int(time.time() - start) + inv_url = f"{API_BASE}/numbers/{USER_ID}/inventory/{order_id}" + try: + inv = api_get(inv_url, token) + sms = inv.get("body", {}).get("sms") or inv.get("body", {}).get("code") + status = inv.get("body", {}).get("status") + if sms: + print(f"\n收到验证码!({elapsed}s)") + print(f" 号码:{number}") + print(f" 验证码:{sms}") + return number, sms + print(f" 等待中 {elapsed}s… status={status}", flush=True) + except Exception as e: + print(f" 轮询出错 {elapsed}s: {e}", flush=True) + # 超时退号 + print(f"\n超时 {TIMEOUT_SEC}s 未收到验证码,正在取消退费…") + try: + refund_url = f"{API_BASE}/numbers/{USER_ID}/order/{network}/{order_id}/refund" + api_patch(refund_url, token) + print(" 已取消退费。") + except Exception as e: + print(f" 退费失败:{e}") + return number, None + + +def main(): + print("=" * 50) + print("SMSOnline Premium 自动取号收码") + print("=" * 50) + # 1. 拿 token + token = get_token_from_browser() + if not token: + print("ERROR: 未能获取 token,退出。") + sys.exit(1) + print(f"Token 获取成功(长度 {len(token)})") + # 2. 下单 + 收码 + number, code = buy_and_receive(token) + if code: + print(f"\n{'='*50}") + print(f"号码:{number}") + print(f"验证码:{code}") + print(f"{'='*50}") + else: + print(f"\n未收到验证码,号码 {number} 已退费。") + + +if __name__ == "__main__": + main() diff --git a/运营中枢/工作台/gitea_push_log.md b/运营中枢/工作台/gitea_push_log.md index e57c761a..35f03082 100644 --- a/运营中枢/工作台/gitea_push_log.md +++ b/运营中枢/工作台/gitea_push_log.md @@ -332,3 +332,4 @@ | 2026-03-13 14:27:42 | 🔄 卡若AI 同步 2026-03-13 14:27 | 更新:运营中枢工作台 | 排除 >20MB: 11 个 | | 2026-03-13 14:45:12 | 🔄 卡若AI 同步 2026-03-13 14:45 | 更新:卡木、运营中枢工作台 | 排除 >20MB: 11 个 | | 2026-03-13 15:42:55 | 🔄 卡若AI 同步 2026-03-13 15:42 | 更新:水桥平台对接、卡木、运营中枢、运营中枢参考资料、运营中枢工作台 | 排除 >20MB: 11 个 | +| 2026-03-13 16:01:23 | 🔄 卡若AI 同步 2026-03-13 16:01 | 更新:运营中枢工作台 | 排除 >20MB: 11 个 | diff --git a/运营中枢/工作台/代码管理.md b/运营中枢/工作台/代码管理.md index 6c3156e1..561692f7 100644 --- a/运营中枢/工作台/代码管理.md +++ b/运营中枢/工作台/代码管理.md @@ -335,3 +335,4 @@ | 2026-03-13 14:27:42 | 成功 | 成功 | 🔄 卡若AI 同步 2026-03-13 14:27 | 更新:运营中枢工作台 | 排除 >20MB: 11 个 | [仓库](http://open.quwanzhi.com:3000/fnvtk/karuo-ai) [百科](http://open.quwanzhi.com:3000/fnvtk/karuo-ai/wiki) | | 2026-03-13 14:45:12 | 成功 | 成功 | 🔄 卡若AI 同步 2026-03-13 14:45 | 更新:卡木、运营中枢工作台 | 排除 >20MB: 11 个 | [仓库](http://open.quwanzhi.com:3000/fnvtk/karuo-ai) [百科](http://open.quwanzhi.com:3000/fnvtk/karuo-ai/wiki) | | 2026-03-13 15:42:55 | 成功 | 成功 | 🔄 卡若AI 同步 2026-03-13 15:42 | 更新:水桥平台对接、卡木、运营中枢、运营中枢参考资料、运营中枢工作台 | 排除 >20MB: 11 个 | [仓库](http://open.quwanzhi.com:3000/fnvtk/karuo-ai) [百科](http://open.quwanzhi.com:3000/fnvtk/karuo-ai/wiki) | +| 2026-03-13 16:01:23 | 成功 | 成功 | 🔄 卡若AI 同步 2026-03-13 16:01 | 更新:运营中枢工作台 | 排除 >20MB: 11 个 | [仓库](http://open.quwanzhi.com:3000/fnvtk/karuo-ai) [百科](http://open.quwanzhi.com:3000/fnvtk/karuo-ai/wiki) |