#!/usr/bin/env python3
"""Add zxbq config entry to daily_crawl_config.json"""
import json

with open('/root/gov_crawler/daily_crawl_config.json') as f:
    cfg = json.load(f)

new_entry = {
    "name": "正镶白旗人民政府-通知公告",
    "script": "crawl_zxbq_tzgg.py",
    "args": "--max-pages 1",
    "incremental": True,
    "enabled": True,
    "site_name": "www.zxbq.gov.cn-tzgg",
    "group": "内蒙古",
    "note": "正镶白旗人民政府-通知公告, Huilan CMS, 40页600条, c92754c6-N.html分页, TRS_Editor正文"
}

exists = any(c.get('script') == 'crawl_zxbq_tzgg.py' for c in cfg['crawlers'])
if not exists:
    cfg['crawlers'].append(new_entry)
    cfg['count'] = len(cfg['crawlers'])
    cfg['_更新日期'] = '2026-07-06'
    json.dump(cfg, open('/root/gov_crawler/daily_crawl_config.json', 'w'), ensure_ascii=False, indent=2)
    print('Added, total: %d' % cfg['count'])
else:
    print('Already exists')
