Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions script_library/index.json
Original file line number Diff line number Diff line change
@@ -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": [
{
Expand Down Expand Up @@ -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
}
]
}
85 changes: 85 additions & 0 deletions script_library/scripts/widgets/script_mmxnexoi.py
Original file line number Diff line number Diff line change
@@ -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
Loading