From c8002a5a05781d960738e1be1ad0f0262b7343d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=8A=E6=99=9A=E6=89=93=E8=80=81=E8=99=8E?= Date: Thu, 19 Mar 2026 23:52:15 +0800 Subject: [PATCH 1/2] =?UTF-8?q?[=E6=8A=95=E7=A8=BF]=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E8=84=9A=E6=9C=AC:=20=E6=B5=81=E9=87=8F=E5=B0=8F=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=20=E2=80=94=20by=20Silence?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scripts/widgets/script_mmxnexoi.py | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 script_library/scripts/widgets/script_mmxnexoi.py diff --git a/script_library/scripts/widgets/script_mmxnexoi.py b/script_library/scripts/widgets/script_mmxnexoi.py new file mode 100644 index 0000000..8ef04e7 --- /dev/null +++ b/script_library/scripts/widgets/script_mmxnexoi.py @@ -0,0 +1,85 @@ +# 欢迎使用 PythonIDE!如果觉得好用,请给个好评哦~ +import requests +from widget import Widget, family +from widget import SMALL, MEDIUM, LARGE, CIRCULAR, RECTANGULAR + + +def get_unicom_data(): + + url = '' + headers = { + 'Host': '', + 'User-Agent': '', + 'Cookie': +#这里把你抓到的cookie放里面即可. +'这里....' + } + try: + res = requests.get(url, headers=headers, timeout=5) + if res.status_code == 200: + data = res.json() + flow = data.get('flowResource', {}).get('flowPersent', '0') + fee = data.get('feeResource', {}).get('feePersent', '0') + voice = data.get('voiceResource', {}).get('voicePersent', '0') + t = data.get("flush_date_time", "").split(" ")[-1] if " " in data.get("flush_date_time", "") else "刚刚" + return True, flow, fee, voice, t + except: + pass + return False, "0", "0", "0", "--" + + +success, flow, fee, voice, update_time = get_unicom_data() + + +w = Widget( + background=("#FFFFFF", "#0B0F1A"), # + padding=16 +) + +if family == MEDIUM: + + with w.hstack(spacing=0): + + + with w.vstack(align="leading", spacing=0): + + with w.hstack(spacing=6): + w.icon("antenna.radiowaves.left.and.right", size=16, color="#E63946") + w.text("中国联通", size=14, weight="bold", color=("#111", "#EEE")) + + w.spacer(14) + w.text("剩余通用流量", size=12, color=("#64748B", "#94A3B8")) + w.spacer(4) + + + with w.hstack(spacing=4, align="bottom"): + + w.text(flow, size=36, weight="bold", design="rounded", color=("#000", "#FFF")) + + w.text("GB", size=14, weight="bold", color="#E63946") + + + w.spacer() + + + with w.vstack(align="leading", spacing=10): + w.spacer(6) + + + with w.hstack(spacing=8): + w.icon("yensign.circle.fill", size=14, color="#F59E0B") + w.text(f"{fee} 元", size=11, weight="semibold", color="#F59E0B") + + + with w.hstack(spacing=8): + w.icon("phone.fill", size=14, color="#10B981") + w.text(f"{voice} 分钟", size=11, weight="semibold", color="#10B981") + + + with w.hstack(spacing=8): + w.icon("clock", size=14, color=("#94A3B8", "#64748B")) + w.text(update_time, size=11, color=("#94A3B8", "#64748B")) + + +w.render() +#2026-3-19 \ No newline at end of file From 27291c38f1e7d765f56e3611d24b18020d0ae791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=8A=E6=99=9A=E6=89=93=E8=80=81=E8=99=8E?= Date: Thu, 19 Mar 2026 23:52:17 +0800 Subject: [PATCH 2/2] =?UTF-8?q?[=E6=8A=95=E7=A8=BF]=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=20index.json:=20=E6=B7=BB=E5=8A=A0=20=E6=B5=81=E9=87=8F?= =?UTF-8?q?=E5=B0=8F=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script_library/index.json | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/script_library/index.json b/script_library/index.json index faee266..1351795 100644 --- a/script_library/index.json +++ b/script_library/index.json @@ -1,7 +1,7 @@ { "format_version": 1, - "data_version": 10, - "updated": "2026-03-19T08:48:04.318Z", + "data_version": 11, + "updated": "2026-03-19T15:52:16.644Z", "announcement": null, "categories": [ { @@ -426,6 +426,29 @@ "updated": null, "status": "active", "lines": 201 + }, + { + "id": "script_mmxnexoi", + "name": "流量小组件", + "name_en": "流量小组件", + "desc": "这里省略了一万字", + "desc_en": "这里省略了一万字", + "category": "widgets", + "file": "scripts/widgets/script_mmxnexoi.py", + "thumbnail": null, + "version": 1, + "file_type": "py", + "author": "Silence", + "author_en": "Silence", + "tags": [ + "community" + ], + "requires": [], + "min_app_version": "1.5.0", + "added": "2026-03-19", + "updated": null, + "status": "active", + "lines": 85 } ] }