← 返回
未分类

官方节假日发现与同步

从 gov.cn 官方节假日通知中发现、抓取并解析中国法定节假日与调休安排,生成结构化的节假日/补班日历数据。支持按年度频率控制探测、本地缓存复用,适用于构建中国工作日历、判断某日是否工作日、计算每周首个工作日等场景。 Discover and parse China's official holiday notices from gov.cn, normalize holiday and adjusted-workday rows, and apply frequency-controlled probing for any requested year. Use when Codex needs to build or explain a China business calendar, sync official holiday schedules into storage, determine the first workday of a week, or implement holiday-aware weekly sending logic.
joeyyyy
未分类 community v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 112
下载
💾 2
安装
1
版本
#latest

概述

China Holiday Calendar Sync

Use only official gov.cn holiday notices as the source of truth for China holiday and adjusted-workday schedules.

Keep the workflow conservative:

  • Prefer configured notice_urls first.
  • Use the China government policy search for discovery before any public-search fallback.
  • Parse official notice正文 into structured holiday/workday rows.
  • Apply frequency-controlled discovery — probe eagerness scales with how far the requested year is from the present.

Workflow

  1. Load configured notice URLs.
    • Check notice_urls in local config for the requested year first.
    • If a confirmed URL exists and a refresh is not explicitly requested, use local holiday storage and skip steps 2–3.
  1. Determine whether discovery is appropriate.
    • Compare the requested year to the current year using the frequency rules in the references.
    • If the year is too far in the future (≥ current year + 2), return no URL immediately — do not probe.
    • If discovery is allowed, check discovery_cache to see whether this year was already probed within the current calendar month. If it was, respect that cached result without re-fetching.
  1. Discover the notice URL when needed.
    • Build search queries from the canonical title template, trying variants from exact to broad (see references).
    • Accept only https://www.gov.cn/zhengce/content/... candidates; validate each by fetching its page and confirming the title.
    • On success: write the confirmed URL to notice_urls and update discovery_cache.
    • On miss: write a negative entry to discovery_cache for the current month; return no URL to the caller.
  1. Parse the official notice content.
    • Extract holiday ranges and adjusted workdays using the patterns in the references.
    • Emit normalized rows with date, is_holiday, is_workday, holiday_name, and source_url.
  1. Persist two layers separately.
    • Stable source mapping in notice_urls.
    • Probe history in discovery_cache.

Rules

  • Do not use third-party holiday calendars as authoritative data.
  • Do not fabricate future-year schedules before an official notice exists.
  • If a year has not been published yet, return no URL and record a negative check in discovery_cache for the current month.
  • If a year is already present in local holiday storage, do not refetch the official notice unless the caller explicitly requests a refresh.
  • Probe delay thresholds and cache TTL are parameters, not hard-coded constants. Defaults are documented in the references; callers may override them.

References

For source priority, URL validation, query variants, parsing regex patterns, frequency rules, and caching schemas, read references/official-notice-method.md.

Output Shape

Normalize notice parsing results into a shape close to:

{
  "date": "2026-10-08",
  "is_holiday": false,
  "is_workday": true,
  "holiday_name": "国庆节调休上班",
  "source_url": "https://www.gov.cn/zhengce/content/202511/content_7047090.htm"
}

版本历史

共 1 个版本

  • v1.0.0 Initial release 当前
    2026-04-13 17:40 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

data-analysis

Data Analysis

ivangdavila
{"answer":"数据分析与可视化。查询数据库、生成报告、自动化电子表格,将原始数据转化为清晰可行的见解。适用于:(1) 您……"}
★ 214 📥 71,100
data-analysis

AdMapix

fly0pants
AdMapix 原始数据层,提供广告创意、应用、排名、下载/收入及市场元数据。返回 AdMapix API 的结构化 JSON;调用方...
★ 297 📥 142,619
data-analysis

Tavily 搜索

jacky1n7
通过 Tavily API 进行网页搜索(Brave 替代方案)。当用户要求搜索网页、查找来源或链接,且 Brave 网页搜索不可用时使用。
★ 276 📥 101,321