#!/usr/bin/env python # -*- coding: utf-8 -*- import requests from fastapi import APIRouter,BackgroundTasks def ValidSubCount(fileName:str)->int: with open(fileName, "r") as f: lines = f.readlines() return len(lines) router = APIRouter() @router.get('/') def returnValidSubCount(): # 获取当前剩余的有效订阅数量 (方便随时检测) return ValidSubCount(router.fileName)