diff --git a/script_library/index.json b/script_library/index.json index 22c98f2..eb7738c 100644 --- a/script_library/index.json +++ b/script_library/index.json @@ -1,7 +1,7 @@ { "format_version": 1, - "data_version": 31, - "updated": "2026-03-27T15:15:38.324Z", + "data_version": 32, + "updated": "2026-03-28T03:12:59.398Z", "announcement": null, "categories": [ { @@ -798,6 +798,29 @@ "updated": null, "status": "active", "lines": 113 + }, + { + "id": "script_mn9r95l0", + "name": "实时电影票房", + "name_en": "实时电影票房", + "desc": "建议用中号小组件", + "desc_en": "建议用中号小组件", + "category": "widgets", + "file": "scripts/widgets/script_mn9r95l0.py", + "thumbnail": null, + "version": 1, + "file_type": "py", + "author": "一只菜鸡", + "author_en": "一只菜鸡", + "tags": [ + "community" + ], + "requires": [], + "min_app_version": "1.5.0", + "added": "2026-03-28", + "updated": null, + "status": "active", + "lines": 87 } ] } diff --git a/script_library/scripts/widgets/script_mn9r95l0.py b/script_library/scripts/widgets/script_mn9r95l0.py new file mode 100644 index 0000000..76157c5 --- /dev/null +++ b/script_library/scripts/widgets/script_mn9r95l0.py @@ -0,0 +1,87 @@ +from widget import Widget, family, SMALL, MEDIUM, LARGE +import requests + +def safe_text(val, default=""): + return val if val and val.strip() else default + +try: + headers = {"Content-Type": "application/x-www-form-urlencoded;charset:utf-8"} + resp = requests.post( + "https://api.taolale.com/api/hot_rankings/get", + data={"key": "DoG1KYTwfGhcTACTpgAk4eFiDf"}, + headers=headers, + timeout=10 + ) + data = resp.json() + movies = data.get("data", [])[:5] if data.get("code") == 200 else [] +except: + movies = [] + +bg = ("#F8FAFC", "#0F172A") +title_color = ("#0F172A", "#F8FAFC") +subtitle_color = ("#647B94", "#94A3B8") +accent = "#EF4444" + +w = Widget(background=bg, padding=14) + +if family == SMALL: + top = movies[0] if movies else None + with w.vstack(spacing=0, align="leading"): + w.spacer(24) + if top: + w.icon("film.fill", size=18, color=accent) + w.spacer(8) + w.text(top["title"], size=17, weight="bold", color=title_color, max_lines=1) + w.spacer(6) + w.text(top["sumBoxDesc"], size=24, weight="bold", design="rounded", color=title_color) + release_info = safe_text(top.get("releaseInfo")) + if release_info: + w.spacer(6) + w.text(release_info, size=12, color=subtitle_color) + else: + w.text("暂无数据", size=16, color=subtitle_color) + w.spacer() + +elif family == MEDIUM: + with w.hstack(spacing=0): + w.icon("film.fill", size=15, color=accent) + w.spacer(6) + w.text("实时票房前三", size=14, weight="semibold", color=title_color) + w.spacer() + #w.text(f"共{len(movies)}部", size=12, color=subtitle_color) + w.spacer() + for movie in movies[:3]: + rank = movie["index"] + rc = "#F59E0B" if rank == 1 else "#94A3B8" if rank == 2 else "#CD7F32" + with w.hstack(spacing=0, align="center"): + w.text(f"#{rank}", size=13, weight="bold", color=rc) + w.spacer(6) + w.text(movie["title"], size=13, weight="medium", color=title_color) + w.spacer() + w.text(movie["sumBoxDesc"], size=13, weight="bold", design="rounded", color=title_color) + w.spacer(4) + w.spacer() + +else: + with w.hstack(spacing=0): + w.icon("film.fill", size=17, color=accent) + w.spacer(8) + w.text("实时票房榜", size=17, weight="bold", color=title_color) + w.spacer() + w.text(f"共{len(movies)}部", size=13, color=subtitle_color) + w.spacer(12) + for movie in movies: + rank = movie["index"] + rc = "#F59E0B" if rank == 1 else "#94A3B8" if rank == 2 else "#CD7F32" + release_info = safe_text(movie.get("releaseInfo")) + with w.hstack(spacing=0, align="center"): + w.text(f"#{rank}", size=15, weight="bold", color=rc) + w.spacer(8) + w.text(movie["title"], size=15, weight="semibold", color=title_color) + if release_info: + w.text(f" · {release_info}", size=12, color=subtitle_color) + w.spacer() + w.text(movie["sumBoxDesc"], size=16, weight="bold", design="rounded", color=title_color) + w.spacer(6) + +w.render() \ No newline at end of file