Skip to content

feat(activity-updater): Add activity updater to automatically fetch activity info. #318

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Nanboom233
Copy link
Contributor

@Nanboom233 Nanboom233 commented Jun 22, 2025

用于自动更新活动的草案,目前通过调用 gamekee Wiki API 以及解析 Blue Archive Wiki (EN) 网页进行抓取。
目前只保留了最基础信息,即标题和开始/结束时间。
时间已经经过格式化处理,并且筛选了当前正在举行的活动。

使用方法

  1. 添加了requests等库,因此需要重新安装依赖
  2. 执行 bThread.solve("update_activity") 即可,结果用json格式打印

目前问题

  1. gamekee API 仅返回中文信息,且 title 并不遵循统一格式,具体格式化时可能存在问题。
  2. Blue Archive Wiki (EN) 仅包含英文信息,且缺失国服活动内容。
  3. 目前尚未对Blue Archive Wiki (EN) 的总力战和大决战信息进行抓取

使用 gamekee API 的示例输出:

{
    "国服": [
        {
            "title": "特别委托3倍",
            "begin_time": "1748462400",
            "end_time": "1750795140"
        },
        {
            "title": "[活动]电脑新春进行曲",
            "begin_time": "1750327200",
            "end_time": "1751522340"
        },
        {
            "title": "综合战术测试 · 防御 · 轻装甲",
            "begin_time": "1750327200",
            "end_time": "1750881540"
        },
        {
            "title": "大决战:黑&白(室内战)",
            "begin_time": "1750917600",
            "end_time": "1751486340"
        },
        {
            "title": "悬赏通缉、日程2倍",
            "begin_time": "1750276800",
            "end_time": "1750881540"
        },
        {
            "title": "学院交流会2倍",
            "begin_time": "1750881600",
            "end_time": "1751486340"
        }
    ],
    "日服": [
        {
            "title": "引导任务「和乐祭特别庆典!」",
            "begin_time": "1747821600",
            "end_time": "1750816740"
        },
        {
            "title": "制约解除决战「可库玛」",
            "begin_time": "1747879200",
            "end_time": "1750791540"
        },
        {
            "title": "特别依赖2倍",
            "begin_time": "1750186800",
            "end_time": "1750791540"
        }
    ],
    "国际服": [
        {
            "title": " [活动]祕密的午夜派对 ~钟响时刻的捉迷藏~",
            "begin_time": "1749520800",
            "end_time": "1750730340"
        },
        {
            "title": "制约解除决战 – 霍刻玛(重装甲)",
            "begin_time": "1749607200",
            "end_time": "1751914740"
        },
        {
            "title": "总力战 – 气垫船(野战)",
            "begin_time": "1750125600",
            "end_time": "1750705140"
        },
        {
            "title": "特殊任务2倍",
            "begin_time": "1750100400",
            "end_time": "1750705140"
        },
        {
            "title": "帐号经验值2倍",
            "begin_time": "1750446000",
            "end_time": "1750618740"
        }
    ]
}

使用 Blue Archive Wiki (EN) 的示例输出:

{
    "JP": {
        "event_schedules": [],
        "mini_events": [],
        "reward_campaigns": [
            {
                "Name": "Double Commissions rewards",
                "Start date": "1750186800",
                "End date": "1750791540"
            }
        ]
    },
    "Global": {
        "event_schedules": [
            {
                "Name (EN)": "Secret Midnight Party: The Chimes of Tag",
                "Start date": "1749520800",
                "End date": "1750730400",
                "Notes": ""
            }
        ],
        "mini_events": [],
        "reward_campaigns": [
            {
                "Name": "Double Commissions rewards",
                "Start date": "1750186800",
                "End date": "1750791540"
            }
        ]
    }
}

@Nanboom233 Nanboom233 marked this pull request as ready for review June 22, 2025 18:47
@pur1fying
Copy link
Owner

用于自动更新活动的草案,目前通过调用 gamekee Wiki API 以及解析 Blue Archive Wiki (EN) 网页进行抓取。 目前只保留了最基础信息,即标题和开始/结束时间。 时间已经经过格式化处理,并且筛选了当前正在举行的活动。

使用方法

  1. 添加了requests等库,因此需要重新安装依赖
  2. 执行 bThread.solve("update_activity") 即可,结果用json格式打印

目前问题

  1. gamekee API 仅返回中文信息,且 title 并不遵循统一格式,具体格式化时可能存在问题。
  2. Blue Archive Wiki (EN) 仅包含英文信息,且缺失国服活动内容。
  3. 目前尚未对Blue Archive Wiki (EN) 的总力战和大决战信息进行抓取

使用 gamekee API 的示例输出:

{
"国服": [
{
"title": "特别委托3倍",
"begin_time": "1748462400",
"end_time": "1750795140"
},
{
"title": "[活动]电脑新春进行曲",
"begin_time": "1750327200",
"end_time": "1751522340"
},
{
"title": "综合战术测试 · 防御 · 轻装甲",
"begin_time": "1750327200",
"end_time": "1750881540"
},
{
"title": "大决战:黑&白(室内战)",
"begin_time": "1750917600",
"end_time": "1751486340"
},
{
"title": "悬赏通缉、日程2倍",
"begin_time": "1750276800",
"end_time": "1750881540"
},
{
"title": "学院交流会2倍",
"begin_time": "1750881600",
"end_time": "1751486340"
}
],
"日服": [
{
"title": "引导任务「和乐祭特别庆典!」",
"begin_time": "1747821600",
"end_time": "1750816740"
},
{
"title": "制约解除决战「可库玛」",
"begin_time": "1747879200",
"end_time": "1750791540"
},
{
"title": "特别依赖2倍",
"begin_time": "1750186800",
"end_time": "1750791540"
}
],
"国际服": [
{
"title": " [活动]祕密的午夜派对 ~钟响时刻的捉迷藏~",
"begin_time": "1749520800",
"end_time": "1750730340"
},
{
"title": "制约解除决战 – 霍刻玛(重装甲)",
"begin_time": "1749607200",
"end_time": "1751914740"
},
{
"title": "总力战 – 气垫船(野战)",
"begin_time": "1750125600",
"end_time": "1750705140"
},
{
"title": "特殊任务2倍",
"begin_time": "1750100400",
"end_time": "1750705140"
},
{
"title": "帐号经验值2倍",
"begin_time": "1750446000",
"end_time": "1750618740"
}
]
}

使用 Blue Archive Wiki (EN) 的示例输出:

{
"JP": {
"event_schedules": [],
"mini_events": [],
"reward_campaigns": [
{
"Name": "Double Commissions rewards",
"Start date": "1750186800",
"End date": "1750791540"
}
]
},
"Global": {
"event_schedules": [
{
"Name (EN)": "Secret Midnight Party: The Chimes of Tag",
"Start date": "1749520800",
"End date": "1750730400",
"Notes": ""
}
],
"mini_events": [],
"reward_campaigns": [
{
"Name": "Double Commissions rewards",
"Start date": "1750186800",
"End date": "1750791540"
}
]
}
}

  1. 可以考虑对gamekee返回的字符串进行关键词匹配( 需要设计识别模块 )
  2. 更新活动的函数建议设计为如下接口
def update_activity(server = "CN", api_name = "gamekee"):
    if api_name == "gamekee":
        gamekee_api(server)
    elif api_name == "bawiki":
         bawiki_api(server)
  1. 返回的结果也需要统一管理一下, 可以做成json表单的形式, 以下可以参考
{
    "server" : "CN",
    "total_assault": {
        "has_value": true,
        "name": "xxx",
        "time": [114514, 191980]
    },
    "special_task": {
    
    }
}

@Nanboom233 Nanboom233 marked this pull request as draft June 23, 2025 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants