├── .config └── dotnet-tools.json ├── .dockerignore ├── .editorconfig ├── .github ├── ISSUE_TEMPLATE │ ├── bug-report----.md │ ├── bug-report-qinglong----.md │ ├── feature-request----.md │ └── other----.md ├── PULL_REQUEST_TEMPLATE.md ├── pull.yml └── workflows │ ├── auto-close-pr.yml │ ├── auto-deploy-tencent-scf.yml │ ├── codeql-analysis.yml │ ├── no-response.yml │ ├── no-toxic-comments.yml │ ├── publish-image.yml │ ├── publish-release.yml │ ├── repo-sync.yml │ └── tag.yml ├── .gitignore ├── .husky ├── pre-commit └── task-runner.json ├── CHANGELOG.md ├── Dockerfile ├── LICENSE ├── README.md ├── Ray.BiliBiliTool.sln ├── bruno ├── .env.sample ├── api.bilibili.com │ └── x │ │ ├── space │ │ ├── folder.bru │ │ └── wbi-acc-info.bru │ │ └── vip_point │ │ └── task │ │ └── combine.bru ├── app.bilibili.com │ ├── folder.bru │ ├── pgc │ │ └── activity │ │ │ ├── deliver │ │ │ ├── material │ │ │ │ └── receive.bru │ │ │ └── task │ │ │ │ └── complete.bru │ │ │ └── score │ │ │ └── task │ │ │ └── receive │ │ │ └── v2 │ │ │ ├── dressbuyamount.bru │ │ │ ├── ogvwatchnew.bru │ │ │ ├── tvodbuy.bru │ │ │ └── vipmallbuy.bru │ └── x │ │ ├── report │ │ └── heartbeat │ │ │ └── mobile │ │ │ ├── end.bru │ │ │ └── start.bru │ │ └── vip_point │ │ └── task │ │ └── combine.bru ├── big.bilibili.com │ ├── pgc │ │ └── activity │ │ │ └── score │ │ │ └── task │ │ │ └── sign.bru │ └── x │ │ └── vip │ │ └── experience │ │ └── add.bru ├── bruno.json ├── environments │ └── default.bru ├── passport.bilibili.com │ └── x │ │ ├── passport-login │ │ ├── oauth2 │ │ │ └── login.bru │ │ └── web │ │ │ └── key.bru │ │ ├── relation │ │ ├── followings │ │ │ └── simple.bru │ │ └── tag │ │ │ └── special.bru │ │ ├── v2 │ │ ├── account │ │ │ └── myinfo.bru │ │ └── feed │ │ │ └── index.bru │ │ └── vip │ │ └── web │ │ └── vip_center │ │ └── v2.bru └── www.bilibili.com │ └── x │ └── vip_point │ └── task │ └── combine.bru ├── common.props ├── docker ├── README.md ├── build │ ├── buildAndPushImage_multiArch.ps1 │ ├── buildImage.cmd │ ├── buildImage_amd64.cmd │ └── buildImage_arm64.cmd ├── install.sh └── sample │ ├── config │ └── cookies.json │ └── docker-compose.yml ├── docs ├── configuration.md ├── donate-list.md ├── imgs │ ├── 2233.png │ ├── Tencent-log-bill-1.png │ ├── Tencent-log-docs-1.png │ ├── Tencent-logpage-1.png │ ├── appsettings-cookie.png │ ├── docker-login.png │ ├── donate.jpg │ ├── dotnet-login.png │ ├── get-bilibili-web-cookie.jpg │ ├── get-up-id.png │ ├── get-user-agent.png │ ├── git-secrets-add-cookie.png │ ├── git-secrets.png │ ├── github-actions-close.png │ ├── github-actions-log-1.png │ ├── github-actions-log-2.png │ ├── github-env-count-down.png │ ├── github-env-list.png │ ├── github-env-wait-timer.png │ ├── github-secrets-other-configs.png │ ├── node-support.png │ ├── push-ding.png │ ├── push-tg.png │ ├── push-workweixin.png │ ├── qinglong-application-key.png │ ├── qinglong-application.png │ ├── qinglong-config.png │ ├── qinglong-env.png │ ├── qinglong-extra.png │ ├── qinglong-login.png │ ├── qinglong-run-as-bilitool.png │ ├── qinglong-tasks.png │ ├── run-exe.png │ ├── run-workflow.png │ ├── tencent-scf-actions.png │ ├── tencent-scf-create-async.png │ ├── tencent-scf-create-basic.png │ ├── tencent-scf-create-env.png │ ├── tencent-scf-create.png │ ├── tencent-scf-secret.png │ ├── tencent-scf-secret_yml.png │ ├── tencent-scf-test-1.png │ ├── tencent-scf-test-2.png │ ├── tencent-scf-trigger-add.png │ ├── tencent-scf-trigger-create.png │ ├── web-schedules-log.png │ ├── web-schedules.png │ ├── web-trigger-login.png │ └── wechat-push.png ├── questions.md └── runInLocal.md ├── gitHubActions ├── README.md └── bak │ ├── bilibili-daily-task.yml │ ├── empty-task.yml │ ├── live-lottery-task.yml │ └── unfollow-batched-task.yml ├── helm ├── README.md └── bilibili-tool │ ├── Chart.yaml │ ├── templates │ ├── NOTES.txt │ ├── _helpers.tpl │ ├── configmap.yaml │ └── deployment.yaml │ └── values.yaml ├── krew ├── .gitignore ├── Makefile ├── README.md ├── cmd │ └── kubectl-bilipro.go ├── config.yaml ├── go.mod ├── go.sum └── pkg │ ├── cmd │ ├── cmd.go │ ├── delete.go │ ├── get.go │ ├── init.go │ └── version.go │ ├── options │ └── deployment.go │ ├── resources │ ├── asset.go │ ├── base │ │ ├── bilibiliPro │ │ │ ├── deployment.yaml │ │ │ └── kustomization.yaml │ │ ├── kustomization.yaml │ │ └── ns │ │ │ ├── kustomization.yaml │ │ │ └── namespace.yaml │ └── kustomization.yaml │ └── utils │ ├── client.go │ ├── client_test.go │ ├── cmd.go │ ├── cmd_test.go │ ├── error.go │ ├── error_test.go │ ├── fileSys.go │ └── fileSys_test.go ├── podman ├── README.md └── build │ └── buildImage.cmd ├── qinglong ├── DefaultTasks │ ├── bili_task_base.sh │ ├── bili_task_daily.sh │ ├── bili_task_liveFansMedal.sh │ ├── bili_task_liveLottery.sh │ ├── bili_task_login.sh │ ├── bili_task_test.sh │ ├── bili_task_tryFix.sh │ ├── bili_task_unfollowBatched.sh │ ├── bili_task_vipBigPoint.sh │ └── dev │ │ ├── bili_dev_task_base.sh │ │ ├── bili_dev_task_daily.sh │ │ ├── bili_dev_task_liveFansMedal.sh │ │ ├── bili_dev_task_liveLottery.sh │ │ ├── bili_dev_task_login.sh │ │ ├── bili_dev_task_test.sh │ │ ├── bili_dev_task_tryFix.sh │ │ ├── bili_dev_task_unfollowBatched.sh │ │ └── bili_dev_task_vipBigPoint.sh ├── README.md ├── bak │ ├── bili_dev_task_get_cookie.py.bak │ └── bili_task_get_cookie.py.bak ├── dotnet-install.sh ├── extra.sh └── ray-dotnet-install.sh ├── scripts ├── clean.cmd ├── publish.bat ├── publish.ps1 ├── publish.sh └── ut.ps1 ├── src ├── BlazingQuartz.Core │ ├── BlazingQuartz.Core.csproj │ ├── BlazingQuartzCoreOptions.cs │ ├── Constants.cs │ ├── Events │ │ ├── EventArgs.cs │ │ ├── JobWasExecutedEventArgs.cs │ │ ├── SchedulerErrorEventArgs.cs │ │ └── TriggerEventArgs.cs │ ├── Extensions │ │ └── ModelExtensions.cs │ ├── Helpers │ │ └── CronExpressionHelper.cs │ ├── History │ │ ├── BaseExecutionLogRawSqlProvider.cs │ │ ├── ExecutionLogStore.cs │ │ ├── IExecutionLogRawSqlProvider.cs │ │ ├── IExecutionLogStore.cs │ │ ├── ISchedulerEventLoggingService.cs │ │ └── SchedulerEventLoggingService.cs │ ├── Jobs │ │ └── HousekeepExecutionLogsJob.cs │ ├── Models │ │ ├── ExecutionLogFilter.cs │ │ ├── JobDetailModel.cs │ │ ├── JobExecutionStatusSummaryModel.cs │ │ ├── Key.cs │ │ ├── PagedList.cs │ │ ├── ScheduleJobFilter.cs │ │ ├── ScheduleModel.cs │ │ └── TriggerDetailModel.cs │ ├── ServiceCollectionExtensions.cs │ └── Services │ │ ├── ExecutionLogService.cs │ │ ├── IExecutionLogService.cs │ │ ├── ISchedulerDefinitionService.cs │ │ ├── ISchedulerListenerService.cs │ │ ├── ISchedulerService.cs │ │ ├── SchedulerDefinitionService.cs │ │ ├── SchedulerListenerService.cs │ │ └── SchedulerService.cs ├── BlazingQuartz.Jobs.Abstractions │ ├── BlazingQuartz.Jobs.Abstractions.csproj │ ├── DataMapValue.cs │ ├── DataMapValueResolver.cs │ ├── DataMapValueType.cs │ ├── IDataMapValueResolver.cs │ ├── IJobUI.cs │ ├── JobDataMapKeys.cs │ ├── JobExecutionContextExtensions.cs │ ├── Processors │ │ ├── InterpolatedStringV1Processor.cs │ │ └── SystemVariableV1Provider.cs │ ├── Resolvers │ │ ├── IResolver.cs │ │ └── V1 │ │ │ ├── DateTimeVariableResolver.cs │ │ │ ├── GuidVariableResolver.cs │ │ │ └── LocalDateTimeVariableResolver.cs │ ├── ServiceCollectionExtensions.cs │ └── VariableNameContants.cs ├── BlazingQuartz.Jobs │ ├── BlazingQuartz.Jobs.csproj │ ├── Constants.cs │ ├── HttpAction.cs │ ├── HttpJob.cs │ └── ServiceCollectionExtensions.cs ├── Ray.BiliBiliTool.Agent │ ├── Attributes │ │ ├── AppendHeaderAttribute.cs │ │ ├── AppendHeaderType.cs │ │ └── LogFilterAttribute.cs │ ├── BiliBiliAgent │ │ ├── Attributes │ │ │ └── WbiParameterAttribute.cs │ │ ├── Dtos │ │ │ ├── AddCoinRequest.cs │ │ │ ├── Article │ │ │ │ ├── AddCoinForArticleRequest.cs │ │ │ │ ├── SearchArticleInfoResponse.cs │ │ │ │ ├── SearchArticlesByUpIdFullFto.cs │ │ │ │ └── SearchUpArticlesResponse.cs │ │ │ ├── BaseAppRequest.cs │ │ │ ├── BiliApiResponse.cs │ │ │ ├── BiliPageResult.cs │ │ │ ├── ChargeCommentRequest.cs │ │ │ ├── ChargeRequest.cs │ │ │ ├── ChargeResponse.cs │ │ │ ├── CoinBalance.cs │ │ │ ├── DailyTaskInfo.cs │ │ │ ├── DonatedCoinsForVideo.cs │ │ │ ├── GetAlreadyDonatedCoinsRequest.cs │ │ │ ├── GetSpaceInfoFullDto.cs │ │ │ ├── GetSpaceInfoResponse.cs │ │ │ ├── GetSpecialFollowingsRequest.cs │ │ │ ├── GetVideosResponse.cs │ │ │ ├── Live │ │ │ │ ├── AreaDto.cs │ │ │ │ ├── CheckTianXuanDto.cs │ │ │ │ ├── EnterRoomRequest.cs │ │ │ │ ├── ExchangeSilverStatusResponse.cs │ │ │ │ ├── GetListRequest.cs │ │ │ │ ├── GetLiveRoomInfoResponse.cs │ │ │ │ ├── HeartBeatRequest.cs │ │ │ │ ├── HeartBeatResponse.cs │ │ │ │ ├── JoinTianXuanRequest.cs │ │ │ │ ├── JoinTianXuanResponse.cs │ │ │ │ ├── LikeLiveRoomRequest.cs │ │ │ │ ├── ListItemDto.cs │ │ │ │ ├── LiveSignResponse.cs │ │ │ │ ├── LiveWalletStatusResponse.cs │ │ │ │ ├── MedalWallDto.cs │ │ │ │ ├── SendLiveDanmukuRequest.cs │ │ │ │ ├── Silver2CoinRequest.cs │ │ │ │ ├── Silver2CoinResponse.cs │ │ │ │ ├── WearMedalWallRequest.cs │ │ │ │ ├── WebHeartBeatRequest.cs │ │ │ │ └── WebHeartBeatResponse.cs │ │ │ ├── MangaVipRewardResponse.cs │ │ │ ├── Passport │ │ │ │ ├── GetSsoListResponse.cs │ │ │ │ ├── QrCodeDto.cs │ │ │ │ └── TokenDto.cs │ │ │ ├── RankingInfo.cs │ │ │ ├── Relation │ │ │ │ ├── CopyUserToGroupRequest.cs │ │ │ │ ├── CreateTagRequest.cs │ │ │ │ ├── CreateTagResponse.cs │ │ │ │ ├── GetFollowingsRequest.cs │ │ │ │ ├── GetFollowingsResponse.cs │ │ │ │ ├── ModifyRelationRequest.cs │ │ │ │ └── TagDto.cs │ │ │ ├── SearchUpVideosResponse.cs │ │ │ ├── ShareVideoRequest.cs │ │ │ ├── UpInfo.cs │ │ │ ├── UploadVideoHeartbeatRequest.cs │ │ │ ├── UserInfo.cs │ │ │ ├── Video │ │ │ │ ├── GetBangumiBySsidResponse.cs │ │ │ │ └── SearchVideosByUpIdFullDto.cs │ │ │ ├── VideoDetail.cs │ │ │ ├── VideoInfo.cs │ │ │ ├── ViewMall │ │ │ │ └── ViewvipMallRequest.cs │ │ │ ├── VipPrivilegeType.cs │ │ │ ├── VipStatus.cs │ │ │ ├── VipTask │ │ │ │ ├── CompleteOgvWatchRequest.cs │ │ │ │ ├── ReceiveOrCompleteTaskRequest.cs │ │ │ │ ├── SignRequest.cs │ │ │ │ ├── StartOgvWatchRequest.cs │ │ │ │ ├── StartOgvWatchResponse.cs │ │ │ │ ├── ViewRequest.cs │ │ │ │ ├── VipExperienceRequest.cs │ │ │ │ ├── VipTaskListItem.cs │ │ │ │ └── VouchersInfoResponse.cs │ │ │ └── VipType.cs │ │ ├── Interfaces │ │ │ ├── IAccountApi.cs │ │ │ ├── IArticleApi.cs │ │ │ ├── IBiliBiliApi.cs │ │ │ ├── IChargeApi.cs │ │ │ ├── IDailyTaskApi.cs │ │ │ ├── IHomeApi.cs │ │ │ ├── ILiveApi.cs │ │ │ ├── ILiveTraceApi.cs │ │ │ ├── IMangaApi.cs │ │ │ ├── IPassportApi.cs │ │ │ ├── IRelationApi.cs │ │ │ ├── IUpInfoApi.cs │ │ │ ├── IUserInfoApi.cs │ │ │ ├── IVideoApi.cs │ │ │ ├── IVipBigPointApi.cs │ │ │ └── IVipMallApi.cs │ │ ├── Services │ │ │ ├── IWbiService.cs │ │ │ └── WbiService.cs │ │ ├── Utils │ │ │ └── LiveHeartBeatCrypto.cs │ │ └── WridEncryptionDelegatingHandler.cs │ ├── BiliCookie.cs │ ├── BiliHosts.cs │ ├── Constants.cs │ ├── Extensions │ │ └── ServiceCollectionExtension.cs │ ├── HttpClientDelegatingHandlers │ │ ├── IntervalDelegatingHandler.cs │ │ └── LogDelegatingHandler.cs │ ├── QingLong │ │ ├── Dtos │ │ │ ├── AddQingLongEnv.cs │ │ │ ├── QingLongEnv.cs │ │ │ ├── QingLongGenericResponse.cs │ │ │ ├── TokenResponse.cs │ │ │ └── UpdateQingLongEnv.cs │ │ └── IQingLongApi.cs │ └── Ray.BiliBiliTool.Agent.csproj ├── Ray.BiliBiliTool.Application.Contracts │ ├── IAppService.cs │ ├── IDailyTaskAppService.cs │ ├── ILiveFansMedalAppService.cs │ ├── ILiveLotteryTaskAppService.cs │ ├── ILoginTaskAppService.cs │ ├── ITestAppService.cs │ ├── IUnfollowBatchedTaskAppService.cs │ ├── IVipBigPointAppService.cs │ ├── Ray.BiliBiliTool.Application.Contracts.csproj │ └── TaskTypeFactory.cs ├── Ray.BiliBiliTool.Application │ ├── AppService.cs │ ├── Attributes │ │ ├── TaskInterceptorAttribute.cs │ │ └── TaskLevel.cs │ ├── BaseMultiAccountsAppService.cs │ ├── DailyTaskAppService.cs │ ├── Extensions │ │ └── ServiceCollectionExtension.cs │ ├── FodyWeavers.xml │ ├── FodyWeavers.xsd │ ├── LiveFansMedalAppService.cs │ ├── LiveLotteryTaskAppService.cs │ ├── LoginTaskAppService.cs │ ├── Ray.BiliBiliTool.Application.csproj │ ├── TestAppService.cs │ ├── UnfollowBatchedTaskAppService.cs │ └── VipBigPointAppService.cs ├── Ray.BiliBiliTool.Config │ ├── Constants.cs │ ├── Extensions │ │ └── ServiceCollectionExtension.cs │ ├── IHasCron.cs │ ├── Options │ │ ├── BiliBiliCookieOptions.cs │ │ ├── DailyTaskOptions.cs │ │ ├── LiveFansMedalTaskOptions.cs │ │ ├── LiveLotteryTaskOptions.cs │ │ ├── QingLongOptions.cs │ │ ├── SecurityOptions.cs │ │ ├── UnfollowBatchedTaskOptions.cs │ │ ├── VipBigPointOptions.cs │ │ └── VipPrivilegeOptions.cs │ └── Ray.BiliBiliTool.Config.csproj ├── Ray.BiliBiliTool.Console │ ├── BiliBiliToolHostedService.cs │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── Ray.BiliBiliTool.Console.csproj │ ├── appsettings.Development.json │ ├── appsettings.Production.json │ └── appsettings.json ├── Ray.BiliBiliTool.Domain │ ├── BiliLogs.cs │ ├── ExecutionLog.cs │ ├── ExecutionLogDetail.cs │ ├── LogType.cs │ └── Ray.BiliBiliTool.Domain.csproj ├── Ray.BiliBiliTool.DomainService │ ├── AccountDomainService.cs │ ├── ArticleDomainService.cs │ ├── ChargeDomainService.cs │ ├── CoinDomainService.cs │ ├── DonateCoinDomainService.cs │ ├── Dtos │ │ ├── FansMedalInfoDto.cs │ │ ├── HeartBeatIterationInfoDto.cs │ │ └── VideoInfoDto.cs │ ├── Extensions │ │ └── ServiceCollectionExtensions.cs │ ├── Interfaces │ │ ├── IAccountDomainService.cs │ │ ├── IArticleDomainService.cs │ │ ├── IChargeDomainService.cs │ │ ├── ICoinDomainService.cs │ │ ├── IDomainService.cs │ │ ├── IDonateCoinDomainService.cs │ │ ├── ILiveDomainService.cs │ │ ├── ILoginDomainService.cs │ │ ├── IMangaDomainService.cs │ │ ├── IVideoDomainService.cs │ │ └── IVipPrivilegeDomainService.cs │ ├── LiveDomainService.cs │ ├── LoginDomainService.cs │ ├── MangaDomainService.cs │ ├── Ray.BiliBiliTool.DomainService.csproj │ ├── VideoDomainService.cs │ └── VipPrivilegeDomainService.cs ├── Ray.BiliBiliTool.Infrastructure.EF │ ├── BiliDbContext.cs │ ├── Extensions │ │ └── ServiceCollectionExtension.cs │ ├── Migrations │ │ ├── 20250503105406_InitQuartz.Designer.cs │ │ ├── 20250503105406_InitQuartz.cs │ │ ├── 20250503164108_Update.Designer.cs │ │ ├── 20250503164108_Update.cs │ │ ├── 20250510130427_AddBiliLogs.Designer.cs │ │ ├── 20250510130427_AddBiliLogs.cs │ │ └── BiliDbContextModelSnapshot.cs │ └── Ray.BiliBiliTool.Infrastructure.EF.csproj ├── Ray.BiliBiliTool.Infrastructure │ ├── Cookie │ │ ├── CookieInfo.cs │ │ └── CookieStrFactory.cs │ ├── Enums │ │ └── PlatformType.cs │ ├── Extensions │ │ ├── ICollectionExtensions.cs │ │ ├── KeyValuePairExtensions.cs │ │ └── TypeExtensions.cs │ ├── Global.cs │ ├── Helpers │ │ ├── IpHelper.cs │ │ ├── ObjectHelper.cs │ │ ├── RandomHelper.cs │ │ ├── RegexHelper.cs │ │ └── ZipHelper.cs │ ├── JsonSerializerOptionsBuilder.cs │ ├── JsonSerializerOptionsBuilderExtensions.cs │ └── Ray.BiliBiliTool.Infrastructure.csproj ├── Ray.BiliBiliTool.Web.Client │ ├── Pages │ │ └── Counter.razor │ ├── Program.cs │ ├── Ray.BiliBiliTool.Web.Client.csproj │ ├── _Imports.razor │ └── wwwroot │ │ ├── appsettings.Development.json │ │ └── appsettings.json └── Ray.BiliBiliTool.Web │ ├── Components │ ├── App.razor │ ├── Comps │ │ ├── BlazingJob.razor │ │ ├── BlazingJob.razor.cs │ │ ├── BlazingJob.razor.css │ │ ├── BlazingJob.razor.js │ │ ├── BlazingTrigger.razor │ │ ├── BlazingTrigger.razor.cs │ │ ├── BlazingTrigger.razor.css │ │ ├── BlazingTrigger.razor.js │ │ ├── DefaultJobUI.razor │ │ ├── DefaultJobUI.razor.cs │ │ └── ScheduleDialog.razor │ ├── Layout │ │ ├── MainLayout.razor │ │ ├── MainLayout.razor.css │ │ ├── NavMenu.razor │ │ └── NavMenu.razor.css │ ├── Pages │ │ ├── Error.razor │ │ ├── Home.razor │ │ └── Schedules │ │ │ ├── HistoryDialog.razor │ │ │ ├── HistoryDialog.razor.cs │ │ │ ├── LogsDialog.razor │ │ │ ├── LogsDialog.razor.cs │ │ │ ├── LogsDialog.razor.css │ │ │ ├── Schedules.razor │ │ │ ├── Schedules.razor.cs │ │ │ ├── Schedules.razor.css │ │ │ └── Schedules.razor.js │ ├── Routes.razor │ └── _Imports.razor │ ├── Constants.cs │ ├── Extensions │ ├── ExecutionLogExtensions.cs │ ├── ModelExtensions.cs │ └── ServiceCollectionQuartzConfiguratorExtensions.cs │ ├── Jobs │ ├── BaseJob.cs │ ├── DailyJob.cs │ ├── LiveFansMedalJob.cs │ ├── LiveLotteryJob.cs │ ├── LoginJob.cs │ ├── TestBiliJob.cs │ ├── UnfollowBatchedJob.cs │ └── VipBigPointJob.cs │ ├── Program.cs │ ├── Properties │ └── launchSettings.json │ ├── Ray.BiliBiliTool.Web.csproj │ ├── Services │ └── IJobUIProvider.cs │ ├── appsettings.Development.json │ ├── appsettings.json │ └── wwwroot │ ├── app.css │ ├── bootstrap │ ├── bootstrap.min.css │ └── bootstrap.min.css.map │ └── favicon.png ├── tencentScf ├── README.md ├── bootstrap ├── index.sh ├── publish.bat ├── publish.sh └── serverless.yml └── test ├── AppServiceTest ├── AppServiceTest.csproj ├── DailyTask │ └── DonateCoinsTest.cs ├── Usings.cs └── VipServiceTest.cs ├── BiliAgentTest ├── BiliAgentTest.csproj ├── LiveTraceApiTest.cs └── VideoApiTest.cs ├── ConfigTest ├── ConfigTest.csproj ├── TestDefaultValue.cs └── UnitTest1.cs ├── DomainServiceTest ├── ArticleDomainServiceTest.cs ├── CalculateUpgradeTimeTest.cs ├── DomainServiceTest.csproj ├── DonateCoinDomainServiceTest.cs ├── Usings.cs └── VideoDomainServiceTest.cs ├── InfrastructureTest ├── InfrastructureTest.csproj ├── Usings.cs └── WbiHelperTest.cs ├── LogTest ├── LogConstants.cs ├── LogTest.csproj ├── TestCoolPush.cs ├── TestDingTalk.cs ├── TestMicrosoftTeams.cs ├── TestPushPlus.cs ├── TestServerChan.cs ├── TestTelegram.cs ├── TestWorkWeiXin.cs └── TestWorkWeiXinApp.cs └── Ray.BiliBiliTool.Agent.FunctionalTests ├── AccountApiTests.cs ├── ArticleApiTests.cs ├── ChargeApiTest.cs ├── DailyTaskApiTests.cs ├── HomeApiTests.cs ├── LiveApiTest.cs ├── Ray.BiliBiliTool.Agent.FunctionalTests.csproj ├── VipBigPointApiTest.cs ├── VipMallApiTests.cs └── WbiServiceTest.cs /.config/dotnet-tools.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "isRoot": true, 4 | "tools": { 5 | "csharpier": { 6 | "version": "1.0.1", 7 | "commands": [ 8 | "csharpier" 9 | ] 10 | }, 11 | "husky": { 12 | "version": "0.7.2", 13 | "commands": [ 14 | "husky" 15 | ] 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | # .dockerignore 2 | 3 | .git 4 | .gitattributes 5 | .gitignore 6 | .github 7 | 8 | .editorconfig 9 | 10 | README.md 11 | 12 | Dockerfile 13 | 14 | [b|B]in 15 | [O|o]bj 16 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug-report----.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report(缺陷) 3 | about: 缺陷或异常 4 | title: "【Bug】<请在标题中清晰地概述你要反馈的异常或缺陷>" 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | 11 | 12 | 13 | ### 版本 14 | 15 | BiliTool版本号:`x.x.x` 16 | 17 | ### 确认 18 | 19 | - [ ] 是的,我已搜索并确认,没有其他相同的议题 20 | - [ ] 是的,我确认,已尝试升级到最新版,但未解决 21 | 22 | ### 服务器架构 23 | 24 | - [ ] x64 25 | - [ ] arm64 26 | - [ ] arm 27 | - [ ] 其他(请在下面补充) 28 | 29 | ### 服务器系统 30 | 31 | - [ ] Windows 32 | - [ ] macOS 33 | - [ ] Linux 34 | - [ ] Debian 35 | - [ ] Ubuntu 36 | - [ ] Windows 37 | - [ ] Alpine 38 | - [ ] Centos 39 | - [ ] 其他(请在下面补充) 40 | 41 | ### 选择的BiliTool运行模式 42 | 43 | - [ ] docker 44 | - [ ] podman 45 | - [ ] 下载的Release包 46 | - [ ] 其他(请在下面补充) 47 | 48 | ### 问题描述 49 | 50 | 51 | <这里> 52 | 53 | ### 日志信息 54 | 55 | 56 | 57 |
58 | 59 | ``` 60 | <这里> 61 | ``` 62 | 63 |
64 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature-request----.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request(建议) 3 | about: 建议或需求 4 | title: "【建议】<请在标题中清晰地概述你的建议>" 5 | labels: 建议/enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | 11 | 12 | 13 | ### 确认 14 | 15 | - [ ] 是的,我已搜索并确认,没有其他相同的议题 16 | 17 | ### 建议内容 18 | 19 | 20 | 21 | <这里> 22 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/other----.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Other(其他) 3 | about: 既不是Bug也不是建议的或不能确定的其他议题 4 | title: "【其他】<请在标题中清晰地概述内容>" 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | ### 确认 11 | 12 | - [ ] 是的,我确认要选Other,因为我的内容既不是Bug,也不是Feature 13 | - [ ] 是的,我已搜索并确认,没有其他相同的议题 14 | 15 | ### 描述 16 | 17 | 18 | <这里> 19 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ### 内容 4 | 5 | <请描述您将贡献的内容> 6 | -------------------------------------------------------------------------------- /.github/pull.yml: -------------------------------------------------------------------------------- 1 | version: "1" 2 | rules: # Array of rules 3 | - base: main # Required. Target branch 4 | upstream: RayWangQvQ:main # Required. Must be in the same fork network. 5 | mergeMethod: hardreset # Optional, one of [none, merge, squash, rebase, hardreset], Default: hardreset. 6 | mergeUnstable: true # Optional, merge pull request even when the mergeable_state is not clean. Default: true 7 | -------------------------------------------------------------------------------- /.github/workflows/auto-close-pr.yml: -------------------------------------------------------------------------------- 1 | # 自动关闭不规范PR 2 | name: AutoSetPR 3 | on: 4 | pull_request_target: 5 | types: [opened, edited] 6 | 7 | jobs: 8 | checkTargetBranch: 9 | runs-on: ubuntu-latest 10 | needs: Autoclose 11 | steps: 12 | - uses: Vankka/pr-target-branch-action@v1.1 13 | env: 14 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 15 | with: 16 | target: main 17 | change-to: develop 18 | comment: | 19 | Your PR was set to `main`, but PRs should be sent to `develop` 20 | The base branch of this PR has been automatically changed to `develop`, please check that there are no merge conflicts. 21 | -------------------------------------------------------------------------------- /.github/workflows/no-response.yml: -------------------------------------------------------------------------------- 1 | name: Close Stale Issues 2 | on: 3 | schedule: 4 | - cron: "0 8 * * *" # 每天的 00:00 运行 5 | workflow_dispatch: 6 | 7 | permissions: 8 | contents: read 9 | issues: write 10 | pull-requests: write 11 | 12 | jobs: 13 | close_stale_issues: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - name: Close Stale Issues 17 | uses: actions/stale@v5 18 | with: 19 | days-before-stale: 3 # 3 天不活跃后标记Stale 20 | days-before-close: 3 # 标记Stale后3天不活跃则关闭问题 21 | stale-issue-label: "Stale" # 标记为 "Stale" 的问题 22 | stale-issue-message: "🕸️ This has been inactive for 3 days, please confirm if it still needs attention~~" # Comment added 23 | close-issue-message: "🚫 This has been inactive for too long and is now closed, feel free to reopen it if needed!" # Comment added 24 | only-labels: "needs-more-info" # 只处理标签为 "help wanted" 的问题 25 | repo-token: ${{ secrets.GITHUB_TOKEN }} -------------------------------------------------------------------------------- /.github/workflows/no-toxic-comments.yml: -------------------------------------------------------------------------------- 1 | name: Check Toxic Comments 2 | on: [issue_comment, pull_request_review] 3 | 4 | jobs: 5 | toxic_check: 6 | runs-on: ubuntu-latest 7 | name: Safe space 8 | steps: 9 | - uses: actions/checkout@v2 10 | - name: Safe space - action step 11 | uses: charliegerard/safe-space@master 12 | with: 13 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -------------------------------------------------------------------------------- /.github/workflows/repo-sync.yml: -------------------------------------------------------------------------------- 1 | # 自动同步上游仓库 2 | 3 | name: repo-sync 4 | 5 | on: 6 | workflow_dispatch: 7 | schedule: 8 | - cron: '0 1 * * 1,3,5' 9 | # UTC时区,比我们东八区早8小时,上面示例为:每周一、三、五的9点。 10 | 11 | jobs: 12 | repo-sync: 13 | if: ${{ github.repository != 'RayWangQvQ/BiliBiliToolPro' }} 14 | 15 | runs-on: ubuntu-latest 16 | steps: 17 | - uses: actions/checkout@v2 18 | with: 19 | persist-credentials: false 20 | 21 | - name: repo-sync 22 | uses: repo-sync/github-sync@v2 23 | with: 24 | source_repo: "https://github.com/RayWangQvQ/BiliBiliToolPro.git" 25 | source_branch: "main" 26 | destination_branch: "main" 27 | sync_tags: "true" 28 | github_token: ${{ secrets.PAT }} 29 | -------------------------------------------------------------------------------- /.github/workflows/tag.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/.github/workflows/tag.yml -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | echo "This is pre commit" 5 | dotnet husky run --group pre-commit -------------------------------------------------------------------------------- /.husky/task-runner.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://alirezanet.github.io/Husky.Net/schema.json", 3 | "tasks": [ 4 | { 5 | "name": "welcome-message-example", 6 | "command": "bash", 7 | "args": [ "-c", "echo Husky.Net is awesome!" ], 8 | "windows": { 9 | "command": "cmd", 10 | "args": ["/c", "echo Husky.Net is awesome!" ] 11 | } 12 | }, 13 | { 14 | "name": "csharpier-install", 15 | "group": "pre-commit", 16 | "command": "dotnet", 17 | "args": [ "tool", "install", "csharpier" ] 18 | }, 19 | { 20 | "name": "csharpier-fotmat", 21 | "group": "pre-commit", 22 | "command": "dotnet", 23 | "args": [ "csharpier", "format", "${staged}" ], 24 | "include": [ "**/*.cs" ] 25 | } 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Ray 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /bruno/.env.sample: -------------------------------------------------------------------------------- 1 | phone= 2 | pwd= 3 | mid= 4 | buvid= 5 | csrf= 6 | access_key= 7 | cookieStr= 8 | device_id= -------------------------------------------------------------------------------- /bruno/api.bilibili.com/x/space/folder.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: space 3 | } 4 | -------------------------------------------------------------------------------- /bruno/big.bilibili.com/pgc/activity/score/task/sign.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: sign 3 | type: http 4 | seq: 1 5 | } 6 | 7 | post { 8 | url: https://api.bilibili.com/pgc/activity/score/task/sign 9 | body: formUrlEncoded 10 | auth: none 11 | } 12 | 13 | headers { 14 | Host: api.bilibili.com 15 | Cookie: {{cookieStr}} 16 | native_api_from: h5 17 | buvid: {{buvid}} 18 | accept: application/json, text/plain, */* 19 | referer: https://big.bilibili.com/mobile/index?exp_symbol=release_version&oflAb=1 20 | user-agent: {{user-agent}} 21 | x-bili-trace-id: 9c642fae280ce80077653eef826774e3:77653eef826774e3:0:0 22 | x-bili-aurora-eid: UlAAQFkMBVkH 23 | x-bili-mid: {{mid}} 24 | x-bili-aurora-zone: 25 | x-bili-gaia-vtoken: 26 | x-bili-ticket: eyJhbGciOiJIUzI1NiIsImtpZCI6InMwMyIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MzU3MzgxMTEsImlhdCI6MTczNTcwOTAxMSwiYnV2aWQiOiJYVzcyNEQxNzI0Njg3MTlDQzI1NjA1REIyNDI0NzhEMkUxMjE5In0.J28IlxZ6SjllQEQkq_OvFUiRYAEL2VhQG_WWBcmNppE 27 | bili-http-engine: cronet 28 | } 29 | 30 | body:form-urlencoded { 31 | access_key: {{access_key}} 32 | appkey: {{appKey}} 33 | csrf: {{csrf}} 34 | disable_rcmd: 0 35 | mobi_app: android 36 | platform: android 37 | statistics: {"appId":1,"platform":3,"version":"7.72.0","abtest":""} 38 | ts: 1735713546 39 | sign: aeaeff881a147dd5cd2c6e24df9dc21b 40 | } 41 | -------------------------------------------------------------------------------- /bruno/big.bilibili.com/x/vip/experience/add.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: add 3 | type: http 4 | seq: 2 5 | } 6 | 7 | post { 8 | url: https://big.bilibili.com/x/vip/experience/add 9 | body: formUrlEncoded 10 | auth: none 11 | } 12 | 13 | headers { 14 | Host: api.bilibili.com 15 | Cookie: {{cookieStr}} 16 | native_api_from: h5 17 | buvid: {{buvid}} 18 | accept: application/json, text/plain, */* 19 | referer: https://big.bilibili.com/mobile/index?exp_symbol=release_version&oflAb=1 20 | user-agent: {{user-agent}} 21 | x-bili-trace-id: 46656ec97cb019beac1da03fd56774d6:ac1da03fd56774d6:0:0 22 | x-bili-aurora-eid: UlAAQFkMBVkH 23 | x-bili-mid: {{mid}} 24 | x-bili-aurora-zone: 25 | x-bili-gaia-vtoken: 26 | x-bili-ticket: eyJhbGciOiJIUzI1NiIsImtpZCI6InMwMyIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MzU3MzgxMTEsImlhdCI6MTczNTcwOTAxMSwiYnV2aWQiOiJYVzcyNEQxNzI0Njg3MTlDQzI1NjA1REIyNDI0NzhEMkUxMjE5In0.J28IlxZ6SjllQEQkq_OvFUiRYAEL2VhQG_WWBcmNppE 27 | bili-http-engine: cronet 28 | } 29 | 30 | body:form-urlencoded { 31 | access_key: {{access_key}} 32 | appkey: {{appKey}} 33 | buvid: {{buvid}} 34 | csrf: {{csrf}} 35 | disable_rcmd: 0 36 | mobi_app: android 37 | platform: android 38 | statistics: {"appId":1,"platform":3,"version":"7.72.0","abtest":""} 39 | ts: 1735710395 40 | sign: 694521e34b88ec0593a8cc3edbc4e117 41 | } 42 | -------------------------------------------------------------------------------- /bruno/bruno.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1", 3 | "name": "Bili", 4 | "type": "collection", 5 | "ignore": [ 6 | "node_modules", 7 | ".git" 8 | ] 9 | } -------------------------------------------------------------------------------- /bruno/environments/default.bru: -------------------------------------------------------------------------------- 1 | vars { 2 | phone: {{process.env.phone}} 3 | pwd: {{process.env.pwd}} 4 | mid: {{process.env.mid}} 5 | buvid: {{process.env.buvid}} 6 | csrf: {{process.env.csrf}} 7 | appKey: 1d8b6e7d45233436 8 | access_key: {{process.env.access_key}} 9 | cookieStr: {{process.env.cookieStr}} 10 | user-agent: Mozilla/5.0 (Linux; Android 10; Nexus Build/KOT49H; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/74.0.3729.186 Mobile Safari/537.36 os/android model/Nexus build/7720200 osVer/10 sdkInt/29 network/2 BiliApp/7720200 mobi_app/android channel/yingyongbao Buvid/{{buvid}} sessionID/92c5ad7a innerVer/7720210 c_locale/zh_CN s_locale/zh_CN disable_rcmd/0 7.72.0 os/android model/Nexus mobi_app/android build/7720200 channel/yingyongbao innerVer/7720210 osVer/10 network/2 11 | device_id: {{process.env.device_id}} 12 | user-agent-simple: Mozilla/5.0 (Linux; Android 12; SM-S9080 Build/V417IR; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/91.0.4472.114 Mobile Safari/537.36 os/android model/SM-S9080 build/7760700 osVer/12 sdkInt/32 network/2 BiliApp/7760700 mobi_app/android channel/bili innerVer/7760710 c_locale/zh_CN s_locale/zh_CN disable_rcmd/0 7.76.0 os/android model/SM-S9080 mobi_app/android build/7760700 channel/bili innerVer/7760710 osVer/12 network/2 13 | appSec: 560c52ccd288fed045859ed18bffd973 14 | } 15 | -------------------------------------------------------------------------------- /bruno/passport.bilibili.com/x/passport-login/web/key.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: key 3 | type: http 4 | seq: 1 5 | } 6 | 7 | get { 8 | url: https://passport.bilibili.com/x/passport-login/web/key 9 | body: none 10 | auth: none 11 | } 12 | 13 | headers { 14 | Host: passport.bilibili.com 15 | buvid: {{buvid}} 16 | env: prod 17 | app-key: android64 18 | user-agent: Mozilla/5.0 BiliDroid/7.72.0 (bbcallen@gmail.com) os/android model/Nexus mobi_app/android build/7720200 channel/yingyongbao innerVer/7720210 osVer/10 network/2 19 | x-bili-trace-id: 43e1a54f60cfbf0bb9788d4d9e6774bf:b9788d4d9e6774bf:0:0 20 | x-bili-aurora-eid: 21 | x-bili-mid: 22 | x-bili-aurora-zone: 23 | x-bili-gaia-vtoken: 24 | x-bili-ticket: eyJhbGciOiJIUzI1NiIsImtpZCI6InMwMyIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MzU3MzI4OTIsImlhdCI6MTczNTcwMzc5MiwiYnV2aWQiOiJYVzcyNEQxNzI0Njg3MTlDQzI1NjA1REIyNDI0NzhEMkUxMjE5In0.hEDtIHZoN5Wyoja2hNuPcfy-laa1r05ObiEhJ5gPSt4 25 | bili-http-engine: cronet 26 | } 27 | -------------------------------------------------------------------------------- /bruno/passport.bilibili.com/x/v2/feed/index.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: index 3 | type: http 4 | seq: 1 5 | } 6 | 7 | get { 8 | url: https://passport.bilibili.com/x/v2/feed/index 9 | body: none 10 | auth: none 11 | } 12 | 13 | headers { 14 | Host: app.bilibili.com 15 | buvid: {{buvid}} 16 | fp_local: {{device_id}} 17 | fp_remote: {{device_id}} 18 | session_id: 3160e892 19 | env: prod 20 | app-key: android64 21 | user-agent: Mozilla/5.0 BiliDroid/7.72.0 (bbcallen@gmail.com) os/android model/Nexus mobi_app/android build/7720200 channel/yingyongbao innerVer/7720210 osVer/10 network/2 22 | x-bili-trace-id: ce74f22f44dec31cc331a61b2a6774bf:c331a61b2a6774bf:0:0 23 | x-bili-aurora-eid: UlAAQFkMBVkH 24 | x-bili-mid: {{mid}} 25 | x-bili-aurora-zone: 26 | x-bili-gaia-vtoken: 27 | x-bili-ticket: eyJhbGciOiJIUzI1NiIsImtpZCI6InMwMyIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MzU3MzI4OTIsImlhdCI6MTczNTcwMzc5MiwiYnV2aWQiOiJYVzcyNEQxNzI0Njg3MTlDQzI1NjA1REIyNDI0NzhEMkUxMjE5In0.hEDtIHZoN5Wyoja2hNuPcfy-laa1r05ObiEhJ5gPSt4 28 | bili-http-engine: cronet 29 | } 30 | -------------------------------------------------------------------------------- /bruno/passport.bilibili.com/x/vip/web/vip_center/v2.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: v2 3 | type: http 4 | seq: 1 5 | } 6 | 7 | get { 8 | url: https://api.bilibili.com/x/vip/web/vip_center/v2 9 | body: none 10 | auth: none 11 | } 12 | 13 | headers { 14 | Host: api.bilibili.com 15 | Cookie: {{cookieStr}} 16 | native_api_from: h5 17 | buvid: {{buvid}} 18 | accept: application/json, text/plain, */* 19 | referer: https://big.bilibili.com/mobile/index?exp_symbol=release_version&oflAb=1 20 | content-type: application/json 21 | user-agent: {{user-agent}} 22 | x-bili-trace-id: 0b9853d9388b01892edb6939c16774d4:2edb6939c16774d4:0:0 23 | x-bili-aurora-eid: UlAAQFkMBVkH 24 | x-bili-mid: {{mid}} 25 | x-bili-aurora-zone: 26 | x-bili-gaia-vtoken: 27 | x-bili-ticket: eyJhbGciOiJIUzI1NiIsImtpZCI6InMwMyIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MzU3MzgxMTEsImlhdCI6MTczNTcwOTAxMSwiYnV2aWQiOiJYVzcyNEQxNzI0Njg3MTlDQzI1NjA1REIyNDI0NzhEMkUxMjE5In0.J28IlxZ6SjllQEQkq_OvFUiRYAEL2VhQG_WWBcmNppE 28 | bili-http-engine: cronet 29 | } 30 | -------------------------------------------------------------------------------- /common.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | Ray 4 | 3.1.0 5 | $(NoWarn);CS1591;CS0436 6 | 7 | 8 | -------------------------------------------------------------------------------- /docker/build/buildAndPushImage_multiArch.ps1: -------------------------------------------------------------------------------- 1 | echo "start to build" 2 | # https://www.docker.com/blog/multi-arch-build-and-images-the-simple-way/ 3 | # https://segmentfault.com/a/1190000021166703 4 | # linux/arm/v6,linux/riscv64,linux/s390x,linux/ppc64le,linux/386,,linux/arm/v7 偶发异常,待进一步测试 5 | echo "Start to build docker image with multi-arch" 6 | # $image="zai7lou/bilibili_tool_pro" 7 | # $version="0.0.5" 8 | docker buildx build --tag "zai7lou/bilibili_tool_pro:0.0.5" --tag "zai7lou/bilibili_tool_pro:latest" --output "type=image,push=true" --platform linux/amd64,linux/arm64 ../.. 9 | -------------------------------------------------------------------------------- /docker/build/buildImage.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | REM start to build 4 | echo Start to build docker image 5 | @echo on 6 | docker build --tag zai7lou/bilibili_tool_pro:latest ../.. 7 | @echo off 8 | pause 9 | -------------------------------------------------------------------------------- /docker/build/buildImage_amd64.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | REM start to build 4 | REM https://www.docker.com/blog/multi-arch-build-and-images-the-simple-way/ 5 | REM https://segmentfault.com/a/1190000021166703 6 | echo Start to build docker image with amd64-arch 7 | @echo on 8 | docker buildx build --tag zai7lou/bilibili_tool_pro:latest --output "type=image,push=false" --platform linux/amd64 ../.. 9 | @echo off 10 | pause 11 | -------------------------------------------------------------------------------- /docker/build/buildImage_arm64.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | REM start to build 4 | REM https://www.docker.com/blog/multi-arch-build-and-images-the-simple-way/ 5 | REM https://segmentfault.com/a/1190000021166703 6 | echo Start to build docker image with arm64-arch 7 | @echo on 8 | docker buildx build --platform linux/arm64 -o type=docker -t zai7lou/bilibili_tool ../.. 9 | @echo off 10 | pause 11 | -------------------------------------------------------------------------------- /docker/sample/config/cookies.json: -------------------------------------------------------------------------------- 1 | { 2 | "BiliBiliCookies":[ 3 | ] 4 | } 5 | -------------------------------------------------------------------------------- /docker/sample/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | bili_tool_web: 3 | image: ghcr.io/raywangqvq/bili_tool_web 4 | container_name: bili_tool_web 5 | restart: unless-stopped 6 | tty: true 7 | volumes: 8 | - ./Logs:/app/Logs 9 | - ./config:/app/config 10 | ports: 11 | - "22330:8080" 12 | environment: 13 | TZ: "Asia/Shanghai" 14 | DailyTaskConfig__Cron: "0 0 15 * * ?" 15 | -------------------------------------------------------------------------------- /docs/imgs/2233.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/2233.png -------------------------------------------------------------------------------- /docs/imgs/Tencent-log-bill-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/Tencent-log-bill-1.png -------------------------------------------------------------------------------- /docs/imgs/Tencent-log-docs-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/Tencent-log-docs-1.png -------------------------------------------------------------------------------- /docs/imgs/Tencent-logpage-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/Tencent-logpage-1.png -------------------------------------------------------------------------------- /docs/imgs/appsettings-cookie.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/appsettings-cookie.png -------------------------------------------------------------------------------- /docs/imgs/docker-login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/docker-login.png -------------------------------------------------------------------------------- /docs/imgs/donate.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/donate.jpg -------------------------------------------------------------------------------- /docs/imgs/dotnet-login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/dotnet-login.png -------------------------------------------------------------------------------- /docs/imgs/get-bilibili-web-cookie.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/get-bilibili-web-cookie.jpg -------------------------------------------------------------------------------- /docs/imgs/get-up-id.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/get-up-id.png -------------------------------------------------------------------------------- /docs/imgs/get-user-agent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/get-user-agent.png -------------------------------------------------------------------------------- /docs/imgs/git-secrets-add-cookie.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/git-secrets-add-cookie.png -------------------------------------------------------------------------------- /docs/imgs/git-secrets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/git-secrets.png -------------------------------------------------------------------------------- /docs/imgs/github-actions-close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/github-actions-close.png -------------------------------------------------------------------------------- /docs/imgs/github-actions-log-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/github-actions-log-1.png -------------------------------------------------------------------------------- /docs/imgs/github-actions-log-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/github-actions-log-2.png -------------------------------------------------------------------------------- /docs/imgs/github-env-count-down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/github-env-count-down.png -------------------------------------------------------------------------------- /docs/imgs/github-env-list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/github-env-list.png -------------------------------------------------------------------------------- /docs/imgs/github-env-wait-timer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/github-env-wait-timer.png -------------------------------------------------------------------------------- /docs/imgs/github-secrets-other-configs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/github-secrets-other-configs.png -------------------------------------------------------------------------------- /docs/imgs/node-support.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/node-support.png -------------------------------------------------------------------------------- /docs/imgs/push-ding.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/push-ding.png -------------------------------------------------------------------------------- /docs/imgs/push-tg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/push-tg.png -------------------------------------------------------------------------------- /docs/imgs/push-workweixin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/push-workweixin.png -------------------------------------------------------------------------------- /docs/imgs/qinglong-application-key.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/qinglong-application-key.png -------------------------------------------------------------------------------- /docs/imgs/qinglong-application.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/qinglong-application.png -------------------------------------------------------------------------------- /docs/imgs/qinglong-config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/qinglong-config.png -------------------------------------------------------------------------------- /docs/imgs/qinglong-env.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/qinglong-env.png -------------------------------------------------------------------------------- /docs/imgs/qinglong-extra.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/qinglong-extra.png -------------------------------------------------------------------------------- /docs/imgs/qinglong-login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/qinglong-login.png -------------------------------------------------------------------------------- /docs/imgs/qinglong-run-as-bilitool.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/qinglong-run-as-bilitool.png -------------------------------------------------------------------------------- /docs/imgs/qinglong-tasks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/qinglong-tasks.png -------------------------------------------------------------------------------- /docs/imgs/run-exe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/run-exe.png -------------------------------------------------------------------------------- /docs/imgs/run-workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/run-workflow.png -------------------------------------------------------------------------------- /docs/imgs/tencent-scf-actions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/tencent-scf-actions.png -------------------------------------------------------------------------------- /docs/imgs/tencent-scf-create-async.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/tencent-scf-create-async.png -------------------------------------------------------------------------------- /docs/imgs/tencent-scf-create-basic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/tencent-scf-create-basic.png -------------------------------------------------------------------------------- /docs/imgs/tencent-scf-create-env.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/tencent-scf-create-env.png -------------------------------------------------------------------------------- /docs/imgs/tencent-scf-create.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/tencent-scf-create.png -------------------------------------------------------------------------------- /docs/imgs/tencent-scf-secret.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/tencent-scf-secret.png -------------------------------------------------------------------------------- /docs/imgs/tencent-scf-secret_yml.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/tencent-scf-secret_yml.png -------------------------------------------------------------------------------- /docs/imgs/tencent-scf-test-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/tencent-scf-test-1.png -------------------------------------------------------------------------------- /docs/imgs/tencent-scf-test-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/tencent-scf-test-2.png -------------------------------------------------------------------------------- /docs/imgs/tencent-scf-trigger-add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/tencent-scf-trigger-add.png -------------------------------------------------------------------------------- /docs/imgs/tencent-scf-trigger-create.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/tencent-scf-trigger-create.png -------------------------------------------------------------------------------- /docs/imgs/web-schedules-log.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/web-schedules-log.png -------------------------------------------------------------------------------- /docs/imgs/web-schedules.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/web-schedules.png -------------------------------------------------------------------------------- /docs/imgs/web-trigger-login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/web-trigger-login.png -------------------------------------------------------------------------------- /docs/imgs/wechat-push.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/docs/imgs/wechat-push.png -------------------------------------------------------------------------------- /helm/bilibili-tool/Chart.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v2 2 | name: bilibili-tool 3 | description: A Helm chart for running bilibili tool in Kubernetes 4 | 5 | # A chart can be either an 'application' or a 'library' chart. 6 | # 7 | # Application charts are a collection of templates that can be packaged into versioned archives 8 | # to be deployed. 9 | # 10 | # Library charts provide useful utilities or functions for the chart developer. They're included as 11 | # a dependency of application charts to inject those utilities and functions into the rendering 12 | # pipeline. Library charts do not define any templates and therefore cannot be deployed. 13 | type: application 14 | 15 | # This is the chart version. This version number should be incremented each time you make changes 16 | # to the chart and its templates, including the app version. 17 | # Versions are expected to follow Semantic Versioning (https://semver.org/) 18 | version: 1.0.1 19 | 20 | # This is the version number of the application being deployed. This version number should be 21 | # incremented each time you make changes to the application. Versions are not expected to 22 | # follow Semantic Versioning. They should reflect the version the application is using. 23 | # It is recommended to use it with quotes. 24 | appVersion: "1.0.1" 25 | -------------------------------------------------------------------------------- /helm/bilibili-tool/templates/NOTES.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/helm/bilibili-tool/templates/NOTES.txt -------------------------------------------------------------------------------- /krew/.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | bilipro -------------------------------------------------------------------------------- /krew/cmd/kubectl-bilipro.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | 7 | "github.com/spf13/pflag" 8 | 9 | "github.com/RayWangQvQ/BiliBiliToolPro/krew/pkg/cmd" 10 | helper "github.com/RayWangQvQ/BiliBiliToolPro/krew/pkg/utils" 11 | "k8s.io/cli-runtime/pkg/genericclioptions" 12 | ) 13 | 14 | func main() { 15 | flags := pflag.NewFlagSet("kubectl-bilipro", pflag.ExitOnError) 16 | pflag.CommandLine = flags 17 | 18 | cmd := cmd.NewExecutor(genericclioptions.IOStreams{In: os.Stdin, Out: os.Stdout, ErrOut: os.Stderr}) 19 | if err := cmd.Execute(); err != nil { 20 | fmt.Println(helper.GenErrorMsg(helper.SERVER_ERROR, err.Error()).Error()) 21 | os.Exit(1) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /krew/config.yaml: -------------------------------------------------------------------------------- 1 | - name: Ray_BiliBiliCookies__1 2 | value: "cookie" 3 | # DailyTrigger - required 4 | - name: Ray_DailyTaskConfig__Cron 5 | value: "11 11 * * *" -------------------------------------------------------------------------------- /krew/pkg/cmd/cmd.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import ( 4 | "log" 5 | 6 | "github.com/spf13/cobra" 7 | "k8s.io/cli-runtime/pkg/genericclioptions" 8 | ) 9 | 10 | const ( 11 | biliproDesc = `Manage and deploy bilibili pro tools on k8s` 12 | kubeconfig = "kubeconfig" 13 | ) 14 | 15 | var ( 16 | confPath string 17 | rootCmd = &cobra.Command{ 18 | Use: "bilipro", 19 | Long: biliproDesc, 20 | SilenceUsage: true, 21 | } 22 | ) 23 | 24 | func init() { 25 | rootCmd.PersistentFlags().StringVar(&confPath, kubeconfig, "", "Custom kubeconfig path") 26 | 27 | log.SetFlags(log.Ldate | log.Ltime | log.Lshortfile) 28 | } 29 | 30 | // New creates a new root command for kubectl-bilipro 31 | func NewExecutor(streams genericclioptions.IOStreams) *cobra.Command { 32 | cobra.EnableCommandSorting = false 33 | rootCmd.AddCommand(newInitCmd(rootCmd.OutOrStdout(), rootCmd.ErrOrStderr())) 34 | // If you want to update, just init again 35 | rootCmd.AddCommand(newGetCmd(rootCmd.OutOrStdout(), rootCmd.ErrOrStderr())) 36 | rootCmd.AddCommand(newDeleteCmd(rootCmd.OutOrStdout(), rootCmd.ErrOrStderr())) 37 | rootCmd.AddCommand(newVersionCmd(rootCmd.OutOrStdout(), rootCmd.ErrOrStderr())) 38 | return rootCmd 39 | } 40 | -------------------------------------------------------------------------------- /krew/pkg/cmd/version.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import ( 4 | "fmt" 5 | "io" 6 | 7 | "github.com/spf13/cobra" 8 | ) 9 | 10 | // version provides the version of this plugin 11 | var version = "NO.VERSION" 12 | 13 | const ( 14 | versionDesc = ` 15 | 'version' command displays the kubectl plugin version.` 16 | versionExample = ` kubectl bilipro version` 17 | ) 18 | 19 | type versionCmd struct { 20 | out io.Writer 21 | errOut io.Writer 22 | } 23 | 24 | func newVersionCmd(out io.Writer, errOut io.Writer) *cobra.Command { 25 | o := &versionCmd{out: out, errOut: errOut} 26 | 27 | cmd := &cobra.Command{ 28 | Use: "version", 29 | Short: "Display plugin version", 30 | Long: versionDesc, 31 | Example: versionExample, 32 | Args: cobra.MaximumNArgs(0), 33 | RunE: func(cmd *cobra.Command, args []string) error { 34 | err := o.run() 35 | if err != nil { 36 | fmt.Println(err) 37 | return err 38 | } 39 | return nil 40 | }, 41 | } 42 | 43 | return cmd 44 | } 45 | 46 | // run initializes local config and installs BilibiliPro Plugin to Kubernetes cluster. 47 | func (o *versionCmd) run() error { 48 | fmt.Println(version) 49 | return nil 50 | } 51 | -------------------------------------------------------------------------------- /krew/pkg/options/deployment.go: -------------------------------------------------------------------------------- 1 | package options 2 | 3 | // DeployOptions encapsulates the CLI options for a BiliBiliPro 4 | type DeployOptions struct { 5 | Name string 6 | Image string 7 | Namespace string 8 | ImagePullSecret string 9 | ConfigFilePath string 10 | } 11 | -------------------------------------------------------------------------------- /krew/pkg/resources/asset.go: -------------------------------------------------------------------------------- 1 | package resources 2 | 3 | import ( 4 | "embed" 5 | ) 6 | 7 | //go:embed * 8 | var fs embed.FS 9 | 10 | // GetStaticResources returns the fs with the embedded assets 11 | func GetStaticResources() embed.FS { 12 | return fs 13 | } 14 | -------------------------------------------------------------------------------- /krew/pkg/resources/base/bilibiliPro/deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: bilibilipro 5 | spec: 6 | selector: 7 | matchLabels: 8 | app: bilibilipro 9 | template: 10 | metadata: 11 | labels: 12 | app: bilibilipro 13 | spec: 14 | containers: 15 | - name: bilibilipro 16 | image: zai7lou/bilibili_tool_pro:2.0.1 17 | imagePullPolicy: IfNotPresent 18 | resources: 19 | requests: 20 | cpu: 80m 21 | memory: 100M 22 | limits: 23 | cpu: 100m 24 | memory: 120M 25 | 26 | -------------------------------------------------------------------------------- /krew/pkg/resources/base/bilibiliPro/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization -------------------------------------------------------------------------------- /krew/pkg/resources/base/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization -------------------------------------------------------------------------------- /krew/pkg/resources/base/ns/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization -------------------------------------------------------------------------------- /krew/pkg/resources/base/ns/namespace.yaml: -------------------------------------------------------------------------------- 1 | 2 | apiVersion: v1 3 | kind: Namespace 4 | metadata: 5 | name: bilipro -------------------------------------------------------------------------------- /krew/pkg/resources/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | 4 | resources: 5 | - base/ns/namespace.yaml 6 | - base/bilibiliPro/deployment.yaml 7 | -------------------------------------------------------------------------------- /krew/pkg/utils/client_test.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import ( 4 | "testing" 5 | ) 6 | 7 | func TestGetK8sClient(t *testing.T) { 8 | client, _, err := GetK8sClient() 9 | if err != nil { 10 | t.Logf("test failed due to %s", err.Error()) 11 | t.FailNow() 12 | } 13 | 14 | if client == nil { 15 | t.Logf("test failed for returned client is empty, this should not happen") 16 | t.FailNow() 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /krew/pkg/utils/cmd.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import ( 4 | "bufio" 5 | "fmt" 6 | "io" 7 | "os/exec" 8 | ) 9 | 10 | func Run(cmd *exec.Cmd, in io.Reader) error { 11 | cmd.Stdin = in 12 | 13 | stdoutReader, _ := cmd.StdoutPipe() 14 | stdoutScanner := bufio.NewScanner(stdoutReader) 15 | go func() { 16 | for stdoutScanner.Scan() { 17 | fmt.Println(stdoutScanner.Text()) 18 | } 19 | }() 20 | stderrReader, _ := cmd.StderrPipe() 21 | stderrScanner := bufio.NewScanner(stderrReader) 22 | go func() { 23 | for stderrScanner.Scan() { 24 | fmt.Println(stderrScanner.Text()) 25 | } 26 | }() 27 | err := cmd.Start() 28 | if err != nil { 29 | return GenErrorMsg(EXEC_ERROR, err.Error()) 30 | } 31 | 32 | // Stuck here until there are out and err 33 | err = cmd.Wait() 34 | if err != nil { 35 | return GenErrorMsg(EXEC_ERROR, err.Error()) 36 | } 37 | return nil 38 | } 39 | -------------------------------------------------------------------------------- /krew/pkg/utils/cmd_test.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import ( 4 | "os/exec" 5 | "testing" 6 | ) 7 | 8 | func TestRun(t *testing.T) { 9 | 10 | // Just make sure there is no error... 11 | testCmd := exec.Command("ls") 12 | err := Run(testCmd, nil) 13 | if err != nil { 14 | t.Logf("test failed due to %s", err.Error()) 15 | t.FailNow() 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /krew/pkg/utils/error.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import ( 4 | "errors" 5 | "fmt" 6 | ) 7 | 8 | const ( 9 | // For errors about kustomize 10 | TEMPLATE_ERROR = "template error" 11 | // For errors about file system 12 | FILE_ERROR = "file system error" 13 | // For errors about create/delete/... resources in cluster 14 | SERVER_ERROR = "cluster operation error" 15 | // For exec errors 16 | EXEC_ERROR = "exec error" 17 | ) 18 | 19 | func GenErrorMsg(errType, customMsg string) error { 20 | errorMsg := fmt.Sprintf("[ERROR] %s: %s", errType, customMsg) 21 | return errors.New(errorMsg) 22 | } 23 | -------------------------------------------------------------------------------- /krew/pkg/utils/error_test.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import ( 4 | "strings" 5 | "testing" 6 | ) 7 | 8 | func TestServerGenErrorMsg(t *testing.T) { 9 | expectedErr := GenErrorMsg(SERVER_ERROR, "test for server") 10 | if !strings.Contains(expectedErr.Error(), SERVER_ERROR) { 11 | t.Logf("server error generate failed") 12 | t.FailNow() 13 | } 14 | } 15 | 16 | func TestTemplateGenErrorMsg(t *testing.T) { 17 | expectedErr := GenErrorMsg(TEMPLATE_ERROR, "test for template") 18 | if !strings.Contains(expectedErr.Error(), TEMPLATE_ERROR) { 19 | t.Logf("template error generate failed") 20 | t.FailNow() 21 | } 22 | } 23 | 24 | func TestExecGenErrorMsg(t *testing.T) { 25 | expectedErr := GenErrorMsg(EXEC_ERROR, "test for exec") 26 | if !strings.Contains(expectedErr.Error(), EXEC_ERROR) { 27 | t.Logf("error error generate failed") 28 | t.FailNow() 29 | } 30 | } 31 | 32 | func TestFileGenErrorMsg(t *testing.T) { 33 | expectedErr := GenErrorMsg(FILE_ERROR, "test for file") 34 | if !strings.Contains(expectedErr.Error(), FILE_ERROR) { 35 | t.Logf("file error generate failed") 36 | t.FailNow() 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /podman/build/buildImage.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | REM start to build 4 | echo Start to build image 5 | @echo on 6 | podman build -t docker.io/zai7lou/bilibili_tool_pro:latest ../.. 7 | @echo off 8 | pause 9 | -------------------------------------------------------------------------------- /qinglong/DefaultTasks/bili_task_daily.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # cron:0 9 * * * 3 | # new Env("bili每日任务") 4 | 5 | . bili_task_base.sh 6 | 7 | target_task_code="Daily" 8 | run_task "${target_task_code}" -------------------------------------------------------------------------------- /qinglong/DefaultTasks/bili_task_liveFansMedal.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # cron:5 0 * * * 3 | # new Env("bili直播粉丝牌") 4 | 5 | . bili_task_base.sh 6 | 7 | target_task_code="LiveFansMedal" 8 | run_task "${target_task_code}" -------------------------------------------------------------------------------- /qinglong/DefaultTasks/bili_task_liveLottery.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # cron:0 13 * * * 3 | # new Env("bili天选时刻") 4 | 5 | . bili_task_base.sh 6 | 7 | target_task_code="LiveLottery" 8 | run_task "${target_task_code}" -------------------------------------------------------------------------------- /qinglong/DefaultTasks/bili_task_login.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # cron:0 0 1 1 * 3 | # new Env("bili扫码登录") 4 | 5 | . bili_task_base.sh 6 | 7 | target_task_code="Login" 8 | run_task "${target_task_code}" -------------------------------------------------------------------------------- /qinglong/DefaultTasks/bili_task_test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # cron:0 8 * * * 3 | # new Env("bili测试ck") 4 | 5 | . bili_task_base.sh 6 | 7 | target_task_code="Test" 8 | run_task "${target_task_code}" -------------------------------------------------------------------------------- /qinglong/DefaultTasks/bili_task_tryFix.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # cron:0 0 1 1 * 3 | # new Env("bili尝试修复异常") 4 | 5 | dir_shell=$QL_DIR/shell 6 | . $dir_shell/share.sh 7 | . /root/.bashrc 8 | 9 | bili_repo="raywangqvq_bilibilitoolpro" 10 | bili_branch="" 11 | 12 | echo "青龙repo目录: $dir_repo" 13 | qinglong_bili_repo="$(echo "$bili_repo" | sed 's/\//_/g')${bili_branch}" 14 | qinglong_bili_repo_dir="$(find $dir_repo -type d \( -iname $qinglong_bili_repo -o -iname ${qinglong_bili_repo}_main \) | head -1)" 15 | echo "bili仓库目录: $qinglong_bili_repo_dir" 16 | 17 | echo -e "清理缓存...\n" 18 | cd $qinglong_bili_repo_dir 19 | find . -type d -name "bin" -exec rm -rf {} + 20 | find . -type d -name "obj" -exec rm -rf {} + 21 | echo -e "清理完成\n" 22 | 23 | echo "检测dotnet..." 24 | dotnetVersion=$(dotnet --version) 25 | echo "当前dotnet版本:$dotnetVersion" 26 | if [[ $(echo "$dotnetVersion" | grep -oE '^[0-9]+') -ge 8 ]]; then 27 | echo "已安装,且版本满足" 28 | else 29 | echo "which dotnet: $(which dotnet)" 30 | echo "Path: $PATH" 31 | rm -f /usr/local/bin/dotnet 32 | fi 33 | echo "检测dotnet结束" -------------------------------------------------------------------------------- /qinglong/DefaultTasks/bili_task_unfollowBatched.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # cron:0 12 1 * * 3 | # new Env("bili批量取关主播") 4 | 5 | . bili_task_base.sh 6 | 7 | target_task_code="UnfollowBatched" 8 | run_task "${target_task_code}" -------------------------------------------------------------------------------- /qinglong/DefaultTasks/bili_task_vipBigPoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # cron:7 1 * * * 3 | # new Env("bili大会员大积分") 4 | 5 | . bili_task_base.sh 6 | 7 | target_task_code="VipBigPoint" 8 | run_task "${target_task_code}" -------------------------------------------------------------------------------- /qinglong/DefaultTasks/dev/bili_dev_task_daily.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # cron:5 9 * * * 3 | # new Env('bili每日任务[dev先行版]'); 4 | 5 | . bili_dev_task_base.sh 6 | 7 | target_task_code="Daily" 8 | run_task "${target_task_code}" 9 | -------------------------------------------------------------------------------- /qinglong/DefaultTasks/dev/bili_dev_task_liveFansMedal.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # cron:5 0 * * * 3 | # new Env("bili直播粉丝牌[dev先行版]") 4 | 5 | . bili_dev_task_base.sh 6 | 7 | target_task_code="LiveFansMedal" 8 | run_task "${target_task_code}" -------------------------------------------------------------------------------- /qinglong/DefaultTasks/dev/bili_dev_task_liveLottery.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # cron:0 13 * * * 3 | # new Env("bili天选时刻[dev先行版]") 4 | 5 | . bili_dev_task_base.sh 6 | 7 | target_task_code="LiveLottery" 8 | run_task "${target_task_code}" -------------------------------------------------------------------------------- /qinglong/DefaultTasks/dev/bili_dev_task_login.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # cron:0 0 1 1 * 3 | # new Env("bili扫码登录[dev先行版]") 4 | 5 | . bili_dev_task_base.sh 6 | 7 | target_task_code="Login" 8 | run_task "${target_task_code}" -------------------------------------------------------------------------------- /qinglong/DefaultTasks/dev/bili_dev_task_test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # cron:0 8 * * * 3 | # new Env("bili测试ck[dev先行版]") 4 | 5 | . bili_dev_task_base.sh 6 | 7 | target_task_code="Test" 8 | run_task "${target_task_code}" -------------------------------------------------------------------------------- /qinglong/DefaultTasks/dev/bili_dev_task_tryFix.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # cron:0 0 1 1 * 3 | # new Env("bili尝试修复异常[dev先行版]") 4 | 5 | dir_shell=$QL_DIR/shell 6 | . $dir_shell/share.sh 7 | . /root/.bashrc 8 | 9 | bili_repo="raywangqvq/bilibilitoolpro" 10 | bili_branch="_develop" 11 | 12 | echo "青龙repo目录: $dir_repo" 13 | qinglong_bili_repo="$(echo "$bili_repo" | sed 's/\//_/g')${bili_branch}" 14 | qinglong_bili_repo_dir="$(find $dir_repo -type d \( -iname $qinglong_bili_repo -o -iname ${qinglong_bili_repo}_main \) | head -1)" 15 | echo "bili仓库目录: $qinglong_bili_repo_dir" 16 | 17 | 18 | echo -e "清理缓存...\n" 19 | cd $qinglong_bili_repo_dir 20 | find . -type d -name "bin" -exec rm -rf {} + 21 | find . -type d -name "obj" -exec rm -rf {} + 22 | echo -e "清理完成\n" 23 | 24 | echo "检测dotnet..." 25 | dotnetVersion=$(dotnet --version) 26 | echo "当前dotnet版本:$dotnetVersion" 27 | if [[ $(echo "$dotnetVersion" | grep -oE '^[0-9]+') -ge 8 ]]; then 28 | echo "已安装,且版本满足" 29 | else 30 | echo "which dotnet: $(which dotnet)" 31 | echo "Path: $PATH" 32 | rm -f /usr/local/bin/dotnet 33 | fi 34 | echo "检测dotnet结束" -------------------------------------------------------------------------------- /qinglong/DefaultTasks/dev/bili_dev_task_unfollowBatched.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # cron:0 12 1 * * 3 | # new Env("bili批量取关主播[dev先行版]") 4 | 5 | . bili_dev_task_base.sh 6 | 7 | target_task_code="UnfollowBatched" 8 | run_task "${target_task_code}" -------------------------------------------------------------------------------- /qinglong/DefaultTasks/dev/bili_dev_task_vipBigPoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # cron:7 1 * * * 3 | # new Env("bili大会员大积分[dev先行版]") 4 | 5 | . bili_dev_task_base.sh 6 | 7 | target_task_code="VipBigPoint" 8 | run_task "${target_task_code}" -------------------------------------------------------------------------------- /qinglong/extra.sh: -------------------------------------------------------------------------------- 1 | ## 添加你需要重启自动执行的任意命令,比如 ql repo 2 | ## 安装node依赖使用 pnpm install -g xxx xxx 3 | ## 安装python依赖使用 pip3 install xxx 4 | 5 | # 安装 dotnet 环境 6 | # dotnet --version || (curl -sSL https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/main/qinglong/ray-dotnet-install.sh | bash /dev/stdin --no-official) && (echo "已安装dotnet") 7 | dotnet --version || (curl -sSL https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/main/qinglong/ray-dotnet-install.sh | bash /dev/stdin) && (echo "已安装dotnet") 8 | # 其他代码... 9 | -------------------------------------------------------------------------------- /qinglong/ray-dotnet-install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | echo -e "\n-------set up dot net env-------" 3 | 4 | ## 安装dotnet 5 | 6 | # 安装依赖 7 | install_dependency() { 8 | echo "安装依赖..." 9 | apk add bash icu-libs krb5-libs libgcc libintl libssl1.1 libstdc++ zlib 10 | } 11 | 12 | # 通过官方脚本安装dotnet 13 | install_by_offical() { 14 | echo "install by offical script..." 15 | curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel 8.0 --no-cdn --verbose 16 | } 17 | 18 | # 创建软链接 19 | create_soft_link() { 20 | # echo "创建软链接..." 21 | # rm -f /usr/bin/dotnet 22 | # ln -s ~/.dotnet/dotnet /usr/bin/dotnet 23 | 24 | echo "添加PATH" 25 | local exportFile="/root/.bashrc" 26 | touch $exportFile 27 | echo '' >> $exportFile 28 | echo 'export DOTNET_ROOT=$HOME/.dotnet' >> $exportFile 29 | echo 'export PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools' >> $exportFile 30 | . $exportFile 31 | } 32 | 33 | args=("$@") 34 | 35 | install_dependency 36 | 37 | install_by_offical 38 | 39 | create_soft_link 40 | 41 | dotnet --info 42 | 43 | echo -e "\n-------set up dot net env finish-------" -------------------------------------------------------------------------------- /scripts/clean.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | cd .. 3 | REM start to clean 4 | echo Start to clean all bin and obj folder under Noodle repo 5 | @echo on 6 | @for /d /r %%c in (obj) do @if exist "%%c" (@rd /s /q "%%c" & echo Delete %%c) 7 | @for /d /r %%c in (bin) do @if exist "%%c" (@rd /s /q "%%c" & echo Delete %%c) 8 | @for /d /r %%c in (packages) do @if exist "%%c" (@rd /s /q "%%c" & echo Delete %%c) 9 | @for /d /r %%c in (.vs) do @if exist "%%c" (@rd /s /q "%%c" & echo Delete %%c) 10 | @for /d /r %%c in (temp) do @if exist "%%c" (@rd /s /q "%%c" & echo Delete %%c) 11 | @echo off 12 | pause -------------------------------------------------------------------------------- /scripts/publish.bat: -------------------------------------------------------------------------------- 1 | ::https://docs.microsoft.com/zh-cn/dotnet/core/tools/dotnet-publish 2 | ::关闭回显 3 | @echo off 4 | 5 | dotnet publish --configuration Release --self-contained false -o ./bin/Publish/net5-dependent 6 | echo "dotnet Ray.BiliBiliTool.Console.dll" > ./bin/Publish/net5-dependent/start.bat 7 | 8 | ::dotnet publish --configuration Release --runtime win-x86 --self-contained true -p:PublishTrimmed=true -o ./bin/Publish/win-x86-x64 9 | ::dotnet publish --configuration Release --runtime linux-x64 --self-contained true -p:PublishTrimmed=true -o ./bin/Publish/linux-x64 10 | ::dotnet publish --configuration Release --runtime linux-arm --self-contained true -p:PublishTrimmed=true -o ./bin/Publish/linux-arm 11 | ::dotnet publish --configuration Release --runtime linux-arm64 --self-contained true -p:PublishTrimmed=true -o ./bin/Publish/linux-arm64 12 | ::dotnet publish --configuration Release --runtime osx-x64 --self-contained true -p:PublishTrimmed=true -o ./bin/Publish/osx-x64 13 | 14 | pause 15 | -------------------------------------------------------------------------------- /scripts/ut.ps1: -------------------------------------------------------------------------------- 1 | Set-Location .. 2 | 3 | # 安装 ReportGenerator 工具 4 | Write-Output "Installing ReportGenerator tool..." 5 | dotnet tool install -g dotnet-reportgenerator-globaltool 6 | 7 | # 运行单元测试并生成覆盖率报告 8 | Write-Output "Running unit tests and generating coverage report..." 9 | dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=./TestResults/coverage.opencover.xml 10 | 11 | # 生成html报告 12 | $coverageFiles = Get-ChildItem -Path . -Recurse -Filter "coverage.cobertura.xml" 13 | $coverageFiles | ForEach-Object { Write-Output $_.FullName } 14 | $reportPaths = ($coverageFiles | ForEach-Object { $_.FullName }) -join ";" 15 | reportgenerator "-reports:$reportPaths" "-targetdir:coveragereport" -reporttypes:Html 16 | 17 | # 检查生成的覆盖率报告文件是否存在 18 | Write-Output "Coverage report generated successfully." 19 | Start-Process "coveragereport/index.htm" -------------------------------------------------------------------------------- /src/BlazingQuartz.Core/BlazingQuartzCoreOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BlazingQuartz.Core 4 | { 5 | public class BlazingQuartzCoreOptions 6 | { 7 | /// 8 | /// Assembly files that contain IJob or IJobUI implementation use for creating schedule. 9 | /// Ex. Quartz.Jobs 10 | /// Or Jobs/Quartz.Jobs - if this file is under Job folder 11 | /// 12 | public string[]? AllowedJobAssemblyFiles { get; set; } 13 | 14 | /// 15 | /// Job types that are not allowed to be used for creating new Jobs using UI. 16 | /// Ex. Quartz.Job.NativeJob 17 | /// 18 | public string[]? DisallowedJobTypes { get; set; } 19 | 20 | /// 21 | /// Storage to use to store execution history 22 | /// 23 | public DataStoreProvider DataStoreProvider { get; set; } = DataStoreProvider.Sqlite; 24 | public bool AutoMigrateDb { get; set; } = true; 25 | public string? HousekeepingCronSchedule { get; set; } = "0 0 1 * * ?"; 26 | public int ExecutionLogsDaysToKeep { get; set; } = 21; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/BlazingQuartz.Core/Events/EventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BlazingQuartz.Core.Events 4 | { 5 | public class EventArgs : EventArgs 6 | { 7 | public TArgs Args { get; init; } 8 | public CancellationToken CancelToken { get; init; } 9 | 10 | public EventArgs(TArgs args, CancellationToken cancelToken = default(CancellationToken)) 11 | { 12 | Args = args; 13 | CancelToken = cancelToken; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/BlazingQuartz.Core/Events/JobWasExecutedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Quartz; 3 | 4 | namespace BlazingQuartz.Core.Events 5 | { 6 | public class JobWasExecutedEventArgs : EventArgs 7 | { 8 | public IJobExecutionContext JobExecutionContext { get; init; } 9 | public JobExecutionException? JobException { get; init; } 10 | public CancellationToken CancelToken { get; set; } 11 | 12 | public JobWasExecutedEventArgs( 13 | IJobExecutionContext context, 14 | JobExecutionException? exception, 15 | CancellationToken cancelToken = default(CancellationToken) 16 | ) 17 | { 18 | JobExecutionContext = context; 19 | JobException = exception; 20 | CancelToken = cancelToken; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/BlazingQuartz.Core/Events/SchedulerErrorEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Quartz; 3 | 4 | namespace BlazingQuartz.Core.Events 5 | { 6 | public class SchedulerErrorEventArgs : EventArgs 7 | { 8 | public string ErrorMessage { get; init; } = null!; 9 | public SchedulerException Exception { get; init; } = null!; 10 | public CancellationToken CancelToken { get; init; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/BlazingQuartz.Core/Events/TriggerEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Quartz; 3 | 4 | namespace BlazingQuartz.Core.Events 5 | { 6 | public class TriggerEventArgs : EventArgs 7 | { 8 | public ITrigger Trigger { get; init; } 9 | public IJobExecutionContext JobExecutionContext { get; init; } 10 | public CancellationToken CancelToken { get; init; } 11 | 12 | public TriggerEventArgs( 13 | ITrigger trigger, 14 | IJobExecutionContext context, 15 | CancellationToken cancelToken = default(CancellationToken) 16 | ) 17 | { 18 | Trigger = trigger; 19 | JobExecutionContext = context; 20 | CancelToken = cancelToken; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/BlazingQuartz.Core/Helpers/CronExpressionHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Quartz; 3 | 4 | namespace BlazingQuartz.Core.Helpers 5 | { 6 | public static class CronExpressionHelper 7 | { 8 | public static bool IsValidExpression(string cronExpression) 9 | { 10 | return CronExpression.IsValidExpression(cronExpression); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/BlazingQuartz.Core/History/BaseExecutionLogRawSqlProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BlazingQuartz.Core.History 4 | { 5 | public class BaseExecutionLogRawSqlProvider : IExecutionLogRawSqlProvider 6 | { 7 | public virtual string DeleteLogsByDays { get; } = 8 | @"DELETE FROM bili_execution_logs 9 | WHERE date_added_utc < {0}"; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/BlazingQuartz.Core/History/IExecutionLogRawSqlProvider.cs: -------------------------------------------------------------------------------- 1 | namespace BlazingQuartz.Core.History 2 | { 3 | public interface IExecutionLogRawSqlProvider 4 | { 5 | string DeleteLogsByDays { get; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/BlazingQuartz.Core/History/IExecutionLogStore.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Ray.BiliBiliTool.Domain; 3 | 4 | namespace BlazingQuartz.Core.History 5 | { 6 | public interface IExecutionLogStore 7 | { 8 | bool Exists(ExecutionLog log); 9 | Task DeleteLogsByDays(int daysToKeep, CancellationToken cancelToken = default); 10 | Task AddExecutionLog(ExecutionLog log, CancellationToken cancelToken = default); 11 | ValueTask UpdateExecutionLog(ExecutionLog log); 12 | Task SaveChangesAsync(CancellationToken cancelToken = default); 13 | Task MarkExecutingJobAsIncomplete(CancellationToken cancellToken = default); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/BlazingQuartz.Core/History/ISchedulerEventLoggingService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BlazingQuartz.Core.History 4 | { 5 | internal interface ISchedulerEventLoggingService { } 6 | } 7 | -------------------------------------------------------------------------------- /src/BlazingQuartz.Core/Jobs/HousekeepExecutionLogsJob.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using BlazingQuartz.Core.History; 3 | using BlazingQuartz.Jobs.Abstractions; 4 | using Microsoft.Extensions.Options; 5 | using Quartz; 6 | 7 | namespace BlazingQuartz.Core.Jobs 8 | { 9 | public class HousekeepExecutionLogsJob : IJob 10 | { 11 | private readonly IExecutionLogStore _logStore; 12 | private readonly BlazingQuartzCoreOptions _options; 13 | 14 | public HousekeepExecutionLogsJob( 15 | IExecutionLogStore logStore, 16 | IOptions options 17 | ) 18 | { 19 | _logStore = logStore; 20 | _options = options.Value; 21 | } 22 | 23 | public async Task Execute(IJobExecutionContext context) 24 | { 25 | try 26 | { 27 | var count = await _logStore.DeleteLogsByDays(_options.ExecutionLogsDaysToKeep); 28 | context.Result = $"Deleted {count} record(s)"; 29 | context.SetIsSuccess(true); 30 | } 31 | catch (Exception ex) 32 | { 33 | throw new JobExecutionException("Failed to delete execution logs", ex); 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/BlazingQuartz.Core/Models/JobDetailModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BlazingQuartz.Core.Models 4 | { 5 | public class JobDetailModel 6 | { 7 | public string Name { get; set; } = string.Empty; 8 | public string Group { get; set; } = Constants.DEFAULT_GROUP; 9 | public string? Description { get; set; } 10 | public Type? JobClass { get; set; } 11 | public IDictionary JobDataMap { get; set; } = 12 | new Dictionary(StringComparer.OrdinalIgnoreCase); 13 | 14 | /// 15 | /// Flag indicate whether Job should stay in scheduler even there are no more triggers assgined to it. 16 | /// 17 | public bool IsDurable { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/BlazingQuartz.Core/Models/JobExecutionStatusSummaryModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BlazingQuartz.Core.Models 4 | { 5 | public class JobExecutionStatusSummaryModel 6 | { 7 | public DateTime StartDateTimeUtc { get; set; } 8 | public List> Data { get; set; } = new(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/BlazingQuartz.Core/Models/Key.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BlazingQuartz.Core.Models 4 | { 5 | public class Key 6 | { 7 | public string Name { get; set; } 8 | public string? Group { get; set; } 9 | 10 | public Key(string name) 11 | { 12 | Name = name; 13 | } 14 | 15 | public Key(string name, string group) 16 | : this(name) 17 | { 18 | Group = group; 19 | } 20 | 21 | public Key(Key key) 22 | { 23 | Name = key.Name; 24 | Group = key.Group; 25 | } 26 | 27 | public bool Equals(string name, string? group) 28 | { 29 | return Name == name && Group == group; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/BlazingQuartz.Core/Models/PagedList.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BlazingQuartz.Core.Models 4 | { 5 | public class PagedList : List 6 | { 7 | public PageMetadata? PageMetadata { get; set; } 8 | 9 | public PagedList(IEnumerable collection) 10 | : this(collection, null) { } 11 | 12 | public PagedList(IEnumerable collection, PageMetadata? metadata) 13 | : base(collection) 14 | { 15 | PageMetadata = metadata; 16 | } 17 | } 18 | 19 | public record PageMetadata 20 | { 21 | /// 22 | /// Page number. Start at 0 23 | /// 24 | public int Page { get; init; } = 0; 25 | 26 | /// 27 | /// Total number of records 28 | /// 29 | public int TotalCount { get; init; } 30 | 31 | /// 32 | /// Max number of records per page 33 | /// 34 | public int PageSize { get; init; } = 500; 35 | 36 | public PageMetadata(int Page, int PageSize) 37 | { 38 | this.Page = Page; 39 | this.PageSize = PageSize; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/BlazingQuartz.Core/Models/ScheduleJobFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BlazingQuartz.Core.Models 4 | { 5 | public class ScheduleJobFilter : ICloneable 6 | { 7 | public bool IncludeSystemJobs { get; set; } = false; 8 | 9 | public object Clone() 10 | { 11 | return (ScheduleJobFilter)this.MemberwiseClone(); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/BlazingQuartz.Core/Services/ISchedulerDefinitionService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BlazingQuartz.Core.Services 4 | { 5 | public interface ISchedulerDefinitionService 6 | { 7 | IEnumerable GetTriggerIntervalUnits(TriggerType triggerType); 8 | IEnumerable GetMisfireActions(TriggerType triggerType); 9 | 10 | /// 11 | /// Return available IJob implementations 12 | /// 13 | /// 14 | /// 15 | IEnumerable GetJobTypes(bool reload = false); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/BlazingQuartz.Jobs.Abstractions/BlazingQuartz.Jobs.Abstractions.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net8.0 4 | enable 5 | enable 6 | 7 | 8 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | <_Parameter1>$(AssemblyName).Test 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/BlazingQuartz.Jobs.Abstractions/DataMapValueType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BlazingQuartz.Jobs.Abstractions 4 | { 5 | public enum DataMapValueType 6 | { 7 | InterpolatedString, 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/BlazingQuartz.Jobs.Abstractions/IDataMapValueResolver.cs: -------------------------------------------------------------------------------- 1 | namespace BlazingQuartz.Jobs.Abstractions 2 | { 3 | public interface IDataMapValueResolver 4 | { 5 | string? Resolve(DataMapValue? dmv); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/BlazingQuartz.Jobs.Abstractions/IJobUI.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BlazingQuartz.Jobs.Abstractions 4 | { 5 | public interface IJobUI 6 | { 7 | string JobClass { get; } 8 | 9 | bool IsReadOnly { get; set; } 10 | 11 | IDictionary JobDataMap { get; set; } 12 | 13 | /// 14 | /// Remove all the JobUI keys that was added to JobDataMap 15 | /// 16 | /// 17 | Task ClearChanges(); 18 | 19 | /// 20 | /// Apply the changes to JobDataMap 21 | /// 22 | /// true if no validation error and all changes applied 23 | Task ApplyChanges(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/BlazingQuartz.Jobs.Abstractions/JobDataMapKeys.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BlazingQuartz.Jobs.Abstractions 4 | { 5 | public static class JobDataMapKeys 6 | { 7 | public const string ExecutionDetails = "__execDetails"; 8 | public const string IsSuccess = "__isSuccess"; 9 | public const string ReturnCode = "__returnCode"; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/BlazingQuartz.Jobs.Abstractions/Resolvers/IResolver.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BlazingQuartz.Jobs.Abstractions.Resolvers 4 | { 5 | public interface IResolver 6 | { 7 | string Resolve(string varBlock); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/BlazingQuartz.Jobs.Abstractions/Resolvers/V1/GuidVariableResolver.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BlazingQuartz.Jobs.Abstractions.Resolvers.V1 4 | { 5 | internal class GuidVariableResolver : IResolver 6 | { 7 | const string Format = $"{{{{{VariableNameContants.Guid}}}}}"; 8 | 9 | public GuidVariableResolver() { } 10 | 11 | public string Resolve(string varBlock) 12 | { 13 | if (varBlock != Format) 14 | throw new FormatException( 15 | $"Invalid {VariableNameContants.Guid} format. Expected format is {Format}." 16 | ); 17 | return Guid.NewGuid().ToString(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/BlazingQuartz.Jobs.Abstractions/Resolvers/V1/LocalDateTimeVariableResolver.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BlazingQuartz.Jobs.Abstractions.Resolvers.V1 4 | { 5 | internal class LocalDateTimeVariableResolver : DateTimeVariableResolver 6 | { 7 | const string DatetimeRegex = 8 | $"\\{VariableNameContants.LocalDateTime}\\s(rfc1123|iso8601|\'.+\'|\\\".+\\\")(?:\\s(\\-?\\d+)\\s(y|M|d|h|m|s|ms))?"; 9 | 10 | internal override string GetVariableName() 11 | { 12 | return VariableNameContants.LocalDateTime; 13 | } 14 | 15 | internal override string GetVariableRegex() 16 | { 17 | return DatetimeRegex; 18 | } 19 | 20 | internal override DateTimeOffset GetDateTimeOffset() 21 | { 22 | return DateTimeOffset.Now; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/BlazingQuartz.Jobs.Abstractions/ServiceCollectionExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.Extensions.DependencyInjection; 3 | using Microsoft.Extensions.DependencyInjection.Extensions; 4 | 5 | namespace BlazingQuartz.Jobs.Abstractions 6 | { 7 | public static class ServiceCollectionExtensions 8 | { 9 | public static IServiceCollection AddBlazingQuartzJobs(this IServiceCollection services) 10 | { 11 | services.TryAddTransient(); 12 | 13 | return services; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/BlazingQuartz.Jobs.Abstractions/VariableNameContants.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BlazingQuartz.Jobs.Abstractions 4 | { 5 | public static class VariableNameContants 6 | { 7 | public const string DateTime = "$datetime"; 8 | public const string LocalDateTime = "$localDatetime"; 9 | public const string Guid = "$guid"; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/BlazingQuartz.Jobs/BlazingQuartz.Jobs.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net8.0 4 | enable 5 | enable 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/BlazingQuartz.Jobs/Constants.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BlazingQuartz.Jobs 4 | { 5 | public abstract class Constants 6 | { 7 | public const string HttpClientIgnoreVerifySsl = "IgnoreSsl"; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/BlazingQuartz.Jobs/HttpAction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BlazingQuartz.Jobs 4 | { 5 | public enum HttpAction 6 | { 7 | Get, 8 | Post, 9 | Put, 10 | Delete, 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/BlazingQuartz.Jobs/ServiceCollectionExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using BlazingQuartz.Jobs.Abstractions; 3 | using Microsoft.Extensions.DependencyInjection; 4 | 5 | namespace BlazingQuartz.Jobs 6 | { 7 | public static class ServiceCollectionExtensions 8 | { 9 | public static IServiceCollection AddBlazingQuartzJobs(this IServiceCollection services) 10 | { 11 | // require to run BlazingQuartz.Jobs.HttpJob 12 | services.AddHttpClient(); 13 | services 14 | .AddHttpClient(Constants.HttpClientIgnoreVerifySsl) 15 | .ConfigurePrimaryHttpMessageHandler(() => 16 | new HttpClientHandler 17 | { 18 | ServerCertificateCustomValidationCallback = 19 | HttpClientHandler.DangerousAcceptAnyServerCertificateValidator, 20 | } 21 | ); 22 | 23 | return Abstractions.ServiceCollectionExtensions.AddBlazingQuartzJobs(services); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/Attributes/AppendHeaderType.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.Attributes; 2 | 3 | public enum AppendHeaderType 4 | { 5 | Add, 6 | AddIfNotExist, 7 | AddOrReplace, 8 | } 9 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/AddCoinRequest.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos; 2 | 3 | public class AddCoinRequest 4 | { 5 | public AddCoinRequest(long aid, string csrf) 6 | { 7 | Aid = aid; 8 | Csrf = csrf; 9 | } 10 | 11 | public long Aid { get; set; } 12 | 13 | public int Multiply { get; set; } = 1; 14 | 15 | public int Select_like { get; set; } = 1; 16 | 17 | public string Cross_domain { get; set; } = "true"; 18 | 19 | public string Csrf { get; set; } 20 | 21 | public string Eab_x { get; set; } = "2"; 22 | 23 | public string Ramval { get; set; } = "3"; 24 | 25 | public string Source { get; set; } = "web_normal"; 26 | 27 | public string Ga { get; set; } = "1"; 28 | } 29 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/Article/AddCoinForArticleRequest.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.Article; 2 | 3 | public class AddCoinForArticleRequest 4 | { 5 | public AddCoinForArticleRequest(long cvid, long mid, string csrf) 6 | { 7 | Aid = cvid; 8 | Upid = mid; 9 | Csrf = csrf; 10 | } 11 | 12 | public long Aid { get; set; } 13 | 14 | public long Upid { get; set; } 15 | 16 | public int Multiply { get; set; } = 1; 17 | 18 | // 必须为2 19 | public int Avtype { get; private set; } = 2; 20 | 21 | public string Csrf { get; set; } 22 | } 23 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/Article/SearchArticleInfoResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.Article; 2 | 3 | public class SearchArticleInfoResponse 4 | { 5 | public int Like { get; set; } 6 | 7 | public int Coin { get; set; } 8 | 9 | public long Mid { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/Article/SearchArticlesByUpIdFullFto.cs: -------------------------------------------------------------------------------- 1 | using Ray.BiliBiliTool.Agent.BiliBiliAgent.Services; 2 | 3 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.Article; 4 | 5 | public class SearchArticlesByUpIdDto : IWrid 6 | { 7 | public long mid { get; set; } 8 | 9 | public int pn { get; set; } = 1; 10 | 11 | public int ps { get; set; } = 12; 12 | 13 | public string sort { get; set; } = "publish_time"; 14 | 15 | public long web_location { get; set; } = 1550101; 16 | 17 | public string platform { get; set; } = "web"; 18 | 19 | public string? w_rid { get; set; } 20 | public long wts { get; set; } 21 | } 22 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/Article/SearchUpArticlesResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.Article; 4 | 5 | public class SearchUpArticlesResponse 6 | { 7 | public List Articles { get; set; } = []; 8 | public int Count { get; set; } 9 | } 10 | 11 | public class ArticleInfo 12 | { 13 | public long Id { get; set; } 14 | 15 | public required string Title { get; set; } 16 | } 17 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/BaseAppRequest.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos; 2 | 3 | public class BaseAppRequest 4 | { 5 | // public string access_key { get; set; } 6 | // public string appkey { get; set; } 7 | 8 | public string build { get; } = "7720200"; 9 | 10 | public string c_locale { get; } = "zh_CN"; 11 | 12 | public string channel { get; } = Constants.Channel; 13 | 14 | public int disable_rcmd { get; } = 0; 15 | 16 | public string from_spmid { get; } = "united.player-video-detail.player.continue"; 17 | 18 | public string mobi_app { get; } = "android"; 19 | 20 | public string platform { get; } = "android"; 21 | 22 | public string s_locale { get; } = "zh_CN"; 23 | 24 | public string statistics { get; } = 25 | "{\"appId\":1,\"platform\":3,\"version\":\"7.72.0\",\"abtest\":\"\"}"; 26 | 27 | // public long ts { get; set; } 28 | 29 | public string? sign { get; set; } 30 | } 31 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/BiliApiResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos; 2 | 3 | public class BiliApiResponse : BiliApiResponse { } 4 | 5 | public class BiliApiResponse 6 | { 7 | public int Code { get; set; } = int.MinValue; 8 | 9 | public string? Message { get; set; } 10 | 11 | public TData? Data { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/BiliPageResult.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos; 2 | 3 | public class BiliPageResult 4 | { 5 | /// 6 | /// 视频总数量 7 | /// 8 | public int Count { get; set; } 9 | 10 | /// 11 | /// 页码 12 | /// 13 | public int Pn { get; set; } 14 | 15 | /// 16 | /// 每页条数 17 | /// 18 | public int Ps { get; set; } 19 | } 20 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/ChargeCommentRequest.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos; 2 | 3 | public class ChargeCommentRequest 4 | { 5 | public ChargeCommentRequest(string order_id, string message, string csrf) 6 | { 7 | Order_id = order_id; 8 | Message = message; 9 | Csrf = csrf; 10 | } 11 | 12 | public string Order_id { get; set; } 13 | 14 | public string Message { get; set; } 15 | 16 | public string Csrf { get; set; } 17 | } 18 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/ChargeRequest.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos; 2 | 3 | public class ChargeRequest 4 | { 5 | public ChargeRequest(decimal bp_num, long upId, string csrf) 6 | { 7 | Bp_num = bp_num; 8 | Up_mid = upId; 9 | Oid = upId; 10 | Csrf = csrf; 11 | } 12 | 13 | /// 14 | /// B币个数 15 | /// 16 | public decimal Bp_num { get; set; } 17 | 18 | public string Is_bp_remains_prior { get; set; } = "true"; 19 | 20 | /// 21 | /// 对方Id 22 | /// 23 | public long Up_mid { get; set; } 24 | 25 | /// 26 | /// 27 | /// 28 | public string Otype { get; set; } = "up"; 29 | 30 | /// 31 | /// 对方来源代码(空间充电:充电对象用户UID;视频充电:稿件avID) 32 | /// 33 | public long Oid { get; set; } 34 | 35 | /// 36 | /// 自己的bili_jct 37 | /// 38 | public string Csrf { get; set; } 39 | } 40 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/ChargeResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos; 2 | 3 | public class ChargeResponse 4 | { 5 | public int Status { get; set; } 6 | 7 | public required string Order_no { get; set; } 8 | } 9 | 10 | public class ChargeV2Response 11 | { 12 | public string Bp_num { get; set; } 13 | 14 | public decimal Exp { get; set; } 15 | 16 | public long Mid { get; set; } 17 | 18 | public string Msg { get; set; } 19 | 20 | public string Order_no { get; set; } 21 | 22 | public int Status { get; set; } 23 | 24 | public long Up_mid { get; set; } 25 | } 26 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/CoinBalance.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos; 2 | 3 | /// 4 | /// 硬币余额 5 | /// 6 | public class CoinBalance 7 | { 8 | public decimal? Money { get; set; } = int.MinValue; 9 | } 10 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/DailyTaskInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos; 2 | 3 | public class DailyTaskInfo 4 | { 5 | public bool Login { get; set; } 6 | 7 | public bool Watch { get; set; } 8 | 9 | public long Coins { get; set; } 10 | 11 | public bool Share { get; set; } 12 | 13 | public bool Email { get; set; } 14 | 15 | public bool Tel { get; set; } 16 | 17 | public bool Safe_question { get; set; } 18 | 19 | public bool Identify_card { get; set; } 20 | } 21 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/DonatedCoinsForVideo.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos; 2 | 3 | public class DonatedCoinsForVideo 4 | { 5 | public int Multiply { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/GetAlreadyDonatedCoinsRequest.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos; 2 | 3 | public class GetAlreadyDonatedCoinsRequest 4 | { 5 | public GetAlreadyDonatedCoinsRequest(long aid) 6 | { 7 | Aid = aid; 8 | } 9 | 10 | public string Jsonp { get; set; } = "jsonp"; 11 | 12 | public long Aid { get; set; } 13 | 14 | //public string Callback { get; set; } = $"jsonCallback_bili_{new Random().Next(10000, 99999)}{new Random().Next(10000, 99999)}"; 15 | } 16 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/GetSpaceInfoFullDto.cs: -------------------------------------------------------------------------------- 1 | using Ray.BiliBiliTool.Agent.BiliBiliAgent.Services; 2 | 3 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos; 4 | 5 | public class GetSpaceInfoDto : IWrid 6 | { 7 | public long mid { get; set; } 8 | 9 | public string? w_rid { get; set; } 10 | public long wts { get; set; } 11 | } 12 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/GetSpaceInfoResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos; 2 | 3 | public class GetSpaceInfoResponse 4 | { 5 | public long Mid { get; set; } 6 | 7 | public required string Name { get; set; } 8 | 9 | public SpaceLiveRoomInfoDto? Live_room { get; set; } 10 | } 11 | 12 | public class SpaceLiveRoomInfoDto 13 | { 14 | public required string Title { get; set; } 15 | 16 | public long Roomid { get; set; } 17 | } 18 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/GetSpecialFollowingsRequest.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos; 2 | 3 | public class GetSpecialFollowingsRequest 4 | { 5 | public GetSpecialFollowingsRequest(long userId) 6 | { 7 | Mid = userId; 8 | } 9 | 10 | public GetSpecialFollowingsRequest(long userId, long tagId) 11 | { 12 | Mid = userId; 13 | Tagid = tagId; 14 | } 15 | 16 | public long Mid { get; set; } 17 | 18 | /// 19 | /// TagId 20 | /// 21 | /// -10:特别关注 22 | public long Tagid { get; set; } = -10; 23 | 24 | public int Pn { get; set; } = 1; 25 | 26 | public int Ps { get; set; } = 20; 27 | 28 | public string Jsonp { get; set; } = "jsonp"; 29 | 30 | //public string Callback { get; set; } 31 | } 32 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/GetVideosResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos; 4 | 5 | public class GetVideosResponse 6 | { 7 | public List Media_list { get; set; } 8 | } 9 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/Live/AreaDto.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.Live; 4 | 5 | public class GetArteaListResponse 6 | { 7 | public List Data { get; set; } 8 | } 9 | 10 | public class AreaDto 11 | { 12 | public long Id { get; set; } 13 | 14 | public string Name { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/Live/EnterRoomRequest.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.Live; 4 | 5 | public class EnterRoomRequest 6 | { 7 | public EnterRoomRequest( 8 | long roomId, 9 | long parentId, 10 | long areaID, 11 | int seqNumber, // 心跳包编号 12 | long timestamp, 13 | string userAgent, 14 | string csrf, 15 | long ruid, 16 | string device 17 | ) 18 | { 19 | Id = JsonConvert.SerializeObject(new[] { parentId, areaID, seqNumber, roomId }); 20 | Ts = timestamp; 21 | Ua = userAgent; 22 | Csrf = csrf; 23 | Ruid = ruid; 24 | 25 | Is_patch = 0; 26 | Heart_beat = "[]"; 27 | Visit_id = ""; 28 | Device = device; 29 | } 30 | 31 | public string Id { get; set; } 32 | 33 | public long Ruid { get; set; } 34 | 35 | public long Ts { get; set; } 36 | 37 | public int Is_patch { get; set; } 38 | 39 | public string Heart_beat { get; set; } 40 | 41 | public string Ua { get; set; } 42 | 43 | public string Csrf_token => Csrf; 44 | 45 | public string Csrf { get; set; } 46 | 47 | public string Visit_id { get; set; } 48 | 49 | public string Device { get; set; } 50 | } 51 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/Live/ExchangeSilverStatusResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.Live; 2 | 3 | public class ExchangeSilverStatusResponse 4 | { 5 | public int Silver { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/Live/GetListRequest.cs: -------------------------------------------------------------------------------- 1 | using Ray.BiliBiliTool.Agent.BiliBiliAgent.Services; 2 | 3 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.Live; 4 | 5 | public class GetListRequest : IWrid 6 | { 7 | public string platform { get; set; } = "web"; 8 | public long parent_area_id { get; set; } 9 | public long area_id { get; set; } 10 | public string sort_type { get; set; } 11 | public int page { get; set; } 12 | public long wts { get; set; } 13 | public string? w_rid { get; set; } 14 | } 15 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/Live/GetLiveRoomInfoResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.Live; 2 | 3 | public class GetLiveRoomInfoResponse 4 | { 5 | public long Room_id { get; set; } 6 | 7 | public long Area_id { get; set; } 8 | 9 | public long Parent_area_id { get; set; } 10 | 11 | public int Live_Status { get; set; } 12 | 13 | public long Uid { get; set; } 14 | } 15 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/Live/HeartBeatResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.Live; 4 | 5 | public class HeartBeatResponse 6 | { 7 | public int Heartbeat_interval { get; set; } 8 | 9 | public string Secret_key { get; set; } 10 | 11 | public List Secret_rule { get; set; } 12 | 13 | public long Timestamp { get; set; } 14 | } 15 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/Live/JoinTianXuanResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.Live; 2 | 3 | public class JoinTianXuanResponse 4 | { 5 | public long Discount_id { get; set; } 6 | 7 | public long Gold { get; set; } 8 | 9 | public long Silver { get; set; } 10 | 11 | public long Cur_gift_num { get; set; } 12 | 13 | public long Goods_id { get; set; } 14 | 15 | public string New_order_id { get; set; } 16 | } 17 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/Live/LikeLiveRoomRequest.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.Live; 2 | 3 | public class LikeLiveRoomRequest 4 | { 5 | public LikeLiveRoomRequest(long roomid, string csrf, int clickTime, long anchorId, string uid) 6 | { 7 | Roomid = roomid; 8 | Csrf = csrf; 9 | Click_Time = clickTime; 10 | Anchor_Id = anchorId; 11 | Uid = uid; 12 | } 13 | 14 | public long Roomid { get; set; } 15 | 16 | public string Csrf { get; set; } 17 | 18 | public string Csrf_Token => Csrf; 19 | 20 | public int Click_Time { get; set; } 21 | 22 | public long Anchor_Id { get; set; } 23 | 24 | public string Uid { get; set; } 25 | 26 | public string RawTextBuild() 27 | { 28 | return $"click_time={Click_Time.ToString()}&room_id={Roomid.ToString()}&uid={Uid}&anchor_id={Anchor_Id}&csrf_token={Csrf_Token}&csrf={Csrf}"; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/Live/LiveSignResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos; 2 | 3 | public class LiveSignResponse 4 | { 5 | public string Text { get; set; } 6 | 7 | public string SpecialText { get; set; } 8 | } 9 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/Live/LiveWalletStatusResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.Live; 2 | 3 | public class LiveWalletStatusResponse 4 | { 5 | /// 6 | /// 硬币余额 7 | /// 8 | public decimal Coin { get; set; } 9 | 10 | /// 11 | /// 金瓜子余额 12 | /// 13 | public decimal Gold { get; set; } 14 | 15 | /// 16 | /// 银瓜子余额 17 | /// 18 | public decimal Silver { get; set; } 19 | 20 | /// 21 | /// 银瓜子兑换硬币剩余次数 22 | /// 23 | public int Silver_2_coin_left { get; set; } 24 | 25 | /// 26 | /// 硬币兑换银瓜子剩余次数 27 | /// 28 | public int Coin_2_silver_left { get; set; } 29 | } 30 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/Live/MedalWallDto.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.Live; 4 | 5 | public class MedalWallResponse 6 | { 7 | public List List { get; set; } 8 | } 9 | 10 | public class MedalWallDto 11 | { 12 | public int Live_status { get; set; } 13 | 14 | public string Target_name { get; set; } 15 | 16 | public string Link { get; set; } 17 | 18 | public MedalInfoDto Medal_info { get; set; } 19 | } 20 | 21 | public class MedalInfoDto 22 | { 23 | public string Medal_name { get; set; } 24 | 25 | public long Medal_id { get; set; } 26 | 27 | public long Target_id { get; set; } 28 | 29 | public int Level { get; set; } 30 | } 31 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/Live/SendLiveDanmukuRequest.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.Live; 2 | 3 | public class SendLiveDanmukuRequest 4 | { 5 | public SendLiveDanmukuRequest(string csrf, long room_id, string message) 6 | { 7 | this.Csrf = csrf; 8 | this.Msg = message; 9 | this.Roomid = room_id; 10 | this.Bubble = "0"; 11 | this.Mode = "1"; 12 | this.Fontsize = "25"; 13 | this.Rnd = "1672305761"; 14 | this.Color = "16777215"; 15 | } 16 | 17 | public string Bubble { get; set; } 18 | 19 | public string Msg { get; set; } 20 | 21 | public string Color { get; set; } 22 | 23 | public string Mode { get; set; } 24 | 25 | public string Fontsize { get; set; } 26 | 27 | public string Rnd { get; set; } 28 | 29 | public long Roomid { get; set; } 30 | 31 | public string Csrf { get; set; } 32 | 33 | public string Csrf_token => Csrf; 34 | } 35 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/Live/Silver2CoinRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Ray.BiliBiliTool.Infrastructure.Helpers; 3 | 4 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.Live; 5 | 6 | public class Silver2CoinRequest 7 | { 8 | public Silver2CoinRequest(string csrf) 9 | { 10 | Csrf = csrf; 11 | } 12 | 13 | public string Csrf { get; set; } 14 | 15 | public string Csrf_token => Csrf; 16 | 17 | /// 18 | /// 19 | /// 20 | /// 8u0w3cesz1o0 21 | /// 33moy4vugle0 22 | /// 9zys612vo0c0 23 | /// 3uu2mkxt21c0 24 | /// 8orqn5vf4i00 25 | public string Visit_id { get; set; } = _visitId; //todo 26 | 27 | public static string GetRandomVisitId() 28 | { 29 | var ran = new Random(); 30 | int first = ran.Next(1, 10); 31 | int last = 0; 32 | 33 | var s = new RandomHelper().GenerateCode(10).ToLower(); 34 | 35 | return $"{first}{s}{last}"; 36 | } 37 | 38 | private static string _visitId = GetRandomVisitId(); 39 | } 40 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/Live/Silver2CoinResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.Live; 2 | 3 | public class Silver2CoinResponse 4 | { 5 | public long Coin { get; set; } 6 | 7 | public long Gold { get; set; } 8 | 9 | public long Silver { get; set; } 10 | 11 | public string Tid { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/Live/WearMedalWallRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Ray.BiliBiliTool.Infrastructure.Helpers; 3 | 4 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.Live; 5 | 6 | public class WearMedalWallRequest 7 | { 8 | public WearMedalWallRequest(string csrf, int medal_id) 9 | { 10 | Csrf = csrf; 11 | Medal_id = medal_id; 12 | } 13 | 14 | public int Medal_id { get; set; } 15 | 16 | public string Csrf { get; set; } 17 | 18 | public string Csrf_token => Csrf; 19 | 20 | /// 21 | /// 22 | /// 23 | /// 8u0w3cesz1o0 24 | /// 33moy4vugle0 25 | /// 9zys612vo0c0 26 | /// 3uu2mkxt21c0 27 | /// 8orqn5vf4i00 28 | public string Visit_id { get; set; } = _visitId; //todo 29 | 30 | public static string GetRandomVisitId() 31 | { 32 | var ran = new Random(); 33 | int first = ran.Next(1, 10); 34 | int last = 0; 35 | 36 | var s = new RandomHelper().GenerateCode(10).ToLower(); 37 | 38 | return $"{first}{s}{last}"; 39 | } 40 | 41 | private static string _visitId = GetRandomVisitId(); 42 | } 43 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/Live/WebHeartBeatRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | 4 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.Live; 5 | 6 | public class WebHeartBeatRequest 7 | { 8 | public WebHeartBeatRequest(int room_id, int next_interval) 9 | { 10 | this.RoomId = room_id; 11 | this.NextInterval = next_interval; 12 | } 13 | 14 | public long RoomId { set; get; } 15 | 16 | public int NextInterval { set; get; } 17 | 18 | public override string ToString() 19 | { 20 | string arg = $"{this.NextInterval}|{this.RoomId}|1|0"; 21 | return Convert.ToBase64String(Encoding.UTF8.GetBytes(arg)); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/Live/WebHeartBeatResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.Live; 2 | 3 | public class WebHeartBeatResponse 4 | { 5 | public int Next_interval { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/MangaVipRewardResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos; 2 | 3 | public class MangaVipRewardResponse 4 | { 5 | public int Amount { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/Passport/GetSsoListResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.Passport; 4 | 5 | public class GetSsoListResponse 6 | { 7 | public List sso { get; set; } 8 | } 9 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/Passport/QrCodeDto.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.Passport; 2 | 3 | public class QrCodeDto 4 | { 5 | public string Qrcode_key { get; set; } 6 | 7 | public string Url { get; set; } 8 | } 9 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/Passport/TokenDto.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.Passport; 2 | 3 | public class TokenDto 4 | { 5 | public string Url { get; set; } 6 | public string Refresh_token { get; set; } 7 | public long Timestamp { get; set; } 8 | public int Code { get; set; } 9 | public string Message { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/RankingInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos; 4 | 5 | public class Ranking 6 | { 7 | public List List { get; set; } 8 | } 9 | 10 | /// 11 | /// 排行榜信息 12 | /// 13 | public class RankingInfo 14 | { 15 | public long Aid { get; set; } 16 | 17 | public string Bvid { get; set; } 18 | 19 | public long Cid { get; set; } 20 | 21 | public string Title { get; set; } 22 | 23 | /// 24 | /// 是否转载 25 | /// 1:原创 26 | /// 2:转载 27 | /// 28 | public int Copyright { get; set; } 29 | 30 | public int Duration { get; set; } 31 | } 32 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/Relation/CopyUserToGroupRequest.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.Relation; 4 | 5 | public class CopyUserToGroupRequest 6 | { 7 | public CopyUserToGroupRequest(List fids, string tagid, string csrf) 8 | { 9 | Fids = string.Join(",", fids); 10 | Tagids = tagid; 11 | Csrf = csrf; 12 | } 13 | 14 | public string Fids { get; set; } 15 | 16 | public string Tagids { get; set; } 17 | 18 | public string Csrf { get; set; } 19 | 20 | public string Jsonp { get; set; } = "jsonp"; 21 | } 22 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/Relation/CreateTagRequest.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.Relation; 2 | 3 | public class CreateTagRequest 4 | { 5 | public string Tag { get; set; } 6 | 7 | public string Csrf { get; set; } 8 | } 9 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/Relation/CreateTagResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.Relation; 2 | 3 | public class CreateTagResponse 4 | { 5 | public long Tagid { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/Relation/GetFollowingsRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Ray.BiliBiliTool.Agent.BiliBiliAgent.Interfaces; 3 | 4 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.Relation; 5 | 6 | public class GetFollowingsRequest 7 | { 8 | public GetFollowingsRequest( 9 | long userId, 10 | FollowingsOrderType followingsOrder = FollowingsOrderType.AttentionDesc 11 | ) 12 | { 13 | Vmid = userId; 14 | Order_type = followingsOrder.DefaultValue(); 15 | } 16 | 17 | public long Vmid { get; set; } 18 | 19 | public string Order_type { get; set; } 20 | 21 | public int Pn { get; set; } = 1; 22 | 23 | public int Ps { get; set; } = 20; 24 | 25 | public string Order { get; set; } = "desc"; 26 | 27 | public string Jsonp { get; set; } = "jsonp"; 28 | 29 | //public string Callback { get; set; } 30 | } 31 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/Relation/GetFollowingsResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.Relation; 4 | 5 | public class GetFollowingsResponse 6 | { 7 | public List List { get; set; } 8 | 9 | public int Total { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/Relation/ModifyRelationRequest.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.Relation; 2 | 3 | public class ModifyRelationRequest 4 | { 5 | public ModifyRelationRequest(long fid, string csrf) 6 | { 7 | Fid = fid; 8 | Csrf = csrf; 9 | } 10 | 11 | public long Fid { get; set; } 12 | 13 | public string Csrf { get; set; } 14 | 15 | /// 16 | /// 动作 17 | /// 18 | /// 2:取关 19 | public int Act { get; set; } = 2; 20 | 21 | public int Re_src { get; set; } = 11; 22 | 23 | public string Jsonp { get; set; } = "jsonp"; 24 | } 25 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/Relation/TagDto.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.Relation; 2 | 3 | public class TagDto 4 | { 5 | public long Tagid { get; set; } 6 | 7 | public string Name { get; set; } 8 | 9 | /// 10 | /// 关注up个数 11 | /// 12 | public int Count { get; set; } 13 | 14 | public string Tip { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/ShareVideoRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos; 4 | 5 | public class ShareVideoRequest 6 | { 7 | public ShareVideoRequest(long aid, string csrf) 8 | { 9 | Aid = aid; 10 | Csrf = csrf; 11 | } 12 | 13 | public long Aid { get; set; } 14 | 15 | public string Csrf { get; set; } 16 | 17 | public string Eab_x { get; set; } = "1"; 18 | 19 | public string Ramval { get; set; } = $"{new Random().Next(3, 20)}"; 20 | 21 | public string Source { get; set; } = "web_normal"; 22 | 23 | public string Ga { get; set; } = "1"; 24 | } 25 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/UpInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos; 2 | 3 | public class UpInfo 4 | { 5 | public long Mid { get; set; } 6 | 7 | public string Uname { get; set; } 8 | } 9 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/Video/GetBangumiBySsidResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.Video; 4 | 5 | public class GetBangumiBySsidResponse 6 | { 7 | public int Code { get; set; } = int.MinValue; 8 | 9 | public string Message { get; set; } 10 | 11 | public Result Result { get; set; } 12 | } 13 | 14 | public class Result 15 | { 16 | public List episodes { get; set; } 17 | } 18 | 19 | public class Episode 20 | { 21 | public int aid { get; set; } 22 | 23 | public string bvid { get; set; } 24 | 25 | public int cid { get; set; } 26 | 27 | public int duration { get; set; } 28 | 29 | public int ep_id { get; set; } 30 | 31 | public int id { get; set; } 32 | 33 | public string long_title { get; set; } 34 | 35 | public string share_copy { get; set; } 36 | 37 | public int status { get; set; } 38 | } 39 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/Video/SearchVideosByUpIdFullDto.cs: -------------------------------------------------------------------------------- 1 | using Ray.BiliBiliTool.Agent.BiliBiliAgent.Services; 2 | 3 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.Video; 4 | 5 | public class SearchVideosByUpIdDto : IWrid 6 | { 7 | /// 8 | /// upId 9 | /// 10 | public long mid { get; set; } 11 | 12 | /// 13 | /// pageSize 14 | /// 15 | public int ps { get; set; } = 30; 16 | 17 | /// 18 | /// pageNumber 19 | /// 20 | public int pn { get; set; } = 1; 21 | 22 | public int tid { get; set; } = 0; 23 | 24 | public string keyword { get; set; } = ""; 25 | 26 | public string order { get; set; } = "pubdate"; 27 | 28 | public string platform { get; set; } = "web"; 29 | 30 | public int web_location { get; set; } = 1550101; 31 | 32 | public string order_avoided { get; set; } = "true"; 33 | 34 | public string? w_rid { get; set; } 35 | 36 | public long wts { get; set; } 37 | } 38 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/VideoInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos; 2 | 3 | public class VideoInfo 4 | { 5 | public long Id { get; set; } 6 | 7 | public string Bv_id { get; set; } 8 | 9 | public string Title { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/ViewMall/ViewvipMallRequest.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.ViewMall; 2 | 3 | public class ViewVipMallRequest 4 | { 5 | public string Csrf { get; set; } 6 | public string EventId { get; set; } = "hevent_oy4b7h3epeb"; 7 | } 8 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/VipPrivilegeType.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos; 2 | 3 | public enum VipPrivilegeType 4 | { 5 | BCoinCoupon = 1, 6 | MembershipBenefits = 2, 7 | } 8 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/VipStatus.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos; 4 | 5 | public enum VipStatus 6 | { 7 | [Description("无/过期")] 8 | Disable = 0, 9 | 10 | [Description("正常")] 11 | Enable = 1, 12 | } 13 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/VipTask/CompleteOgvWatchRequest.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.VipTask; 2 | 3 | public class CompleteOgvWatchRequest : BaseAppRequest 4 | { 5 | public CompleteOgvWatchRequest(long taskId, string token) 6 | { 7 | task_id = taskId; 8 | this.token = token; 9 | } 10 | 11 | public long task_id { get; set; } 12 | 13 | public string token { get; set; } 14 | 15 | public string task_sign { get; set; } 16 | 17 | public long timestamp { get; set; } 18 | } 19 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/VipTask/ReceiveOrCompleteTaskRequest.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.VipTask; 2 | 3 | public class ReceiveOrCompleteTaskRequest 4 | { 5 | public ReceiveOrCompleteTaskRequest(string taskCode) 6 | { 7 | TaskCode = taskCode; 8 | } 9 | 10 | public string TaskCode { get; set; } 11 | } 12 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/VipTask/SignRequest.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.VipTask; 2 | 3 | public class SignRequest 4 | { 5 | public string csrf { get; set; } 6 | 7 | public string statistics { get; set; } = 8 | "{\"appId\":1,\"platform\":3,\"version\":\"6.85.0\",\"abtest\":\"\"}"; 9 | } 10 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/VipTask/StartOgvWatchRequest.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.VipTask; 2 | 3 | public class StartOgvWatchRequest : BaseAppRequest 4 | { 5 | public long ep_id { get; } = 328482; 6 | 7 | public long season_id { get; } = 12548; 8 | 9 | public string Activity_code { get; } = ""; 10 | 11 | public string spmid { get; } = "united.player-video-detail.0.0"; 12 | } 13 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/VipTask/StartOgvWatchResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.VipTask; 2 | 3 | public class StartOgvWatchResponse 4 | { 5 | public string closeType { get; set; } 6 | 7 | public string showTime { get; set; } 8 | 9 | public long task_id { get; set; } 10 | 11 | public string token { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/VipTask/ViewRequest.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.VipTask; 2 | 3 | public class ViewRequest 4 | { 5 | public ViewRequest(string position) 6 | { 7 | this.position = position; 8 | } 9 | 10 | public string position { get; } 11 | 12 | public string c_locale { get; } = "zh_CN"; 13 | 14 | public string channel { get; } = Constants.Channel; 15 | 16 | public int disable_rcmd { get; } = 0; 17 | 18 | public string mobi_app { get; } = "android"; 19 | 20 | public string platform { get; } = "android"; 21 | 22 | public string s_locale { get; } = "zh_CN"; 23 | 24 | public string statistics { get; } = 25 | "{\"appId\":1,\"platform\":3,\"version\":\"6.85.0\",\"abtest\":\"\"}"; 26 | } 27 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/VipTask/VipExperienceRequest.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.VipTask; 2 | 3 | public class VipExperienceRequest 4 | { 5 | public string csrf { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/VipTask/VouchersInfoResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.VipTask; 4 | 5 | public class VouchersInfoResponse 6 | { 7 | public List List { get; set; } = []; 8 | public bool IsShortVip { get; set; } 9 | public bool IsFreightOpen { get; set; } 10 | public int Level { get; set; } 11 | public int CurExp { get; set; } 12 | public int NextExp { get; set; } 13 | public bool IsVip { get; set; } 14 | public int IsSeniorMember { get; set; } 15 | public int Format060102 { get; set; } 16 | } 17 | 18 | public class List 19 | { 20 | public int Type { get; set; } 21 | public int State { get; set; } 22 | public int ExpireTime { get; set; } 23 | public int VipType { get; set; } 24 | public int NextReceiveDays { get; set; } 25 | public int PeriodEndUnix { get; set; } 26 | } 27 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Dtos/VipType.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos; 4 | 5 | public enum VipType 6 | { 7 | [Description("无")] 8 | None = 0, 9 | 10 | [Description("月度大会员")] 11 | Mensual = 1, 12 | 13 | [Description("年度大会员")] 14 | Annual = 2, 15 | } 16 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Interfaces/IAccountApi.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos; 3 | using WebApiClientCore.Attributes; 4 | 5 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Interfaces; 6 | 7 | [Header("Host", "account.bilibili.com")] 8 | public interface IAccountApi : IBiliBiliApi 9 | { 10 | /// 11 | /// 获取硬币余额 12 | /// 13 | /// 14 | [Header("Referer", "https://account.bilibili.com/account/coin")] 15 | [HttpGet("/site/getCoin")] 16 | Task> GetCoinBalanceAsync([Header("Cookie")] string ck); 17 | } 18 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Interfaces/IBiliBiliApi.cs: -------------------------------------------------------------------------------- 1 | using Ray.BiliBiliTool.Agent.Attributes; 2 | 3 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Interfaces; 4 | 5 | [AppendHeader("Accept", "application/json, text/plain, */*", AppendHeaderType.AddIfNotExist)] 6 | //[Header("Accept-Encoding", "gzip, deflate, br")] 7 | [AppendHeader( 8 | "Accept-Language", 9 | "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6", 10 | AppendHeaderType.AddIfNotExist 11 | )] 12 | [AppendHeader("Sec-Fetch-Dest", "empty", AppendHeaderType.AddIfNotExist)] 13 | [AppendHeader("Sec-Fetch-Mode", "cors", AppendHeaderType.AddIfNotExist)] 14 | [AppendHeader("Sec-Fetch-Site", "same-site", AppendHeaderType.AddIfNotExist)] 15 | [AppendHeader("Connection", "keep-alive", AppendHeaderType.AddIfNotExist)] 16 | [LogFilter] 17 | public interface IBiliBiliApi; 18 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Interfaces/IHomeApi.cs: -------------------------------------------------------------------------------- 1 | using System.Net.Http; 2 | using System.Threading.Tasks; 3 | using WebApiClientCore.Attributes; 4 | 5 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Interfaces; 6 | 7 | /// 8 | /// 主站首页接口API 9 | /// 10 | public interface IHomeApi : IBiliBiliApi 11 | { 12 | [HttpGet("")] 13 | Task GetHomePageAsync([Header("Cookie")] string ck); 14 | } 15 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Interfaces/ILiveTraceApi.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos; 3 | using Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.Live; 4 | using WebApiClientCore.Attributes; 5 | 6 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Interfaces; 7 | 8 | [Header("Host", "live-trace.bilibili.com")] 9 | public interface ILiveTraceApi : IBiliBiliApi 10 | { 11 | [HttpGet("/xlive/rdata-interface/v1/heartbeat/webHeartBeat?hb={request}&pf=web")] 12 | Task> WebHeartBeat( 13 | WebHeartBeatRequest request, 14 | [Header("Cookie")] string ck 15 | ); 16 | 17 | [HttpPost("/xlive/data-interface/v1/x25Kn/E")] 18 | Task> EnterRoom( 19 | [FormContent] EnterRoomRequest request, 20 | [Header("Cookie")] string ck 21 | ); 22 | 23 | [HttpPost("/xlive/data-interface/v1/x25Kn/X")] 24 | Task> HeartBeat( 25 | [FormContent] HeartBeatRequest request, 26 | [Header("Cookie")] string ck 27 | ); 28 | } 29 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Interfaces/IPassportApi.cs: -------------------------------------------------------------------------------- 1 | using System.Net.Http; 2 | using System.Threading.Tasks; 3 | using Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos; 4 | using Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.Passport; 5 | using WebApiClientCore.Attributes; 6 | 7 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Interfaces; 8 | 9 | [Header("Host", "passport.bilibili.com")] 10 | public interface IPassportApi : IBiliBiliApi 11 | { 12 | [HttpGet("/x/passport-login/web/qrcode/generate")] 13 | Task> GenerateQrCode(); 14 | 15 | [HttpGet("/x/passport-login/web/qrcode/poll?qrcode_key={qrcode_key}&source=main_mini")] 16 | //Task> CheckQrCodeHasScaned(string qrcode_key); 17 | Task CheckQrCodeHasScaned(string qrcode_key); 18 | 19 | [HttpGet("/x/passport-login/web/sso/list?biliCSRF={csrf}")] 20 | Task> GetSsoListAsync(string csrf); 21 | } 22 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Interfaces/IUpInfoApi.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Ray.BiliBiliTool.Agent.BiliBiliAgent.Attributes; 3 | using Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos; 4 | using WebApiClientCore.Attributes; 5 | 6 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Interfaces; 7 | 8 | /// 9 | /// 用户信息接口API 10 | /// 11 | [Header("Referer", "https://www.bilibili.com/")] 12 | [Header("Origin", "https://www.bilibili.com")] 13 | [Header("Host", "api.bilibili.com")] 14 | public interface IUpInfoApi : IBiliBiliApi 15 | { 16 | /// 17 | /// 获取用户空间信息 18 | /// 19 | /// uid 20 | /// 21 | [HttpGet("/x/space/wbi/acc/info")] 22 | Task> GetSpaceInfo( 23 | [PathQuery] GetSpaceInfoDto request, 24 | [Header("Cookie")] string ck 25 | ); 26 | } 27 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Interfaces/IUserInfoApi.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Ray.BiliBiliTool.Agent.BiliBiliAgent.Attributes; 3 | using Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos; 4 | using WebApiClientCore.Attributes; 5 | 6 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Interfaces; 7 | 8 | /// 9 | /// 用户信息接口API 10 | /// 11 | [Header("Referer", "https://www.bilibili.com/")] 12 | [Header("Origin", "https://www.bilibili.com")] 13 | [Header("Host", "api.bilibili.com")] 14 | public interface IUserInfoApi : IBiliBiliApi 15 | { 16 | /// 17 | /// 登录 18 | /// 19 | /// 20 | [HttpGet("/x/web-interface/nav")] 21 | Task> LoginByCookie([Header("Cookie")] string ck); 22 | } 23 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Interfaces/IVipMallApi.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos; 3 | using Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.ViewMall; 4 | using WebApiClientCore.Attributes; 5 | 6 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Interfaces; 7 | 8 | [Header("Host", "show.bilibili.com")] 9 | public interface IVipMallApi 10 | { 11 | [HttpPost("/api/activity/fire/common/event/dispatch")] 12 | Task ViewVipMallAsync( 13 | [JsonContent] ViewVipMallRequest request, 14 | [Header("Cookie")] string ck 15 | ); 16 | } 17 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Services/IWbiService.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading.Tasks; 3 | 4 | namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Services; 5 | 6 | /// 7 | /// 防爬 8 | /// 9 | public interface IWbiService 10 | { 11 | Task GetWridAsync(Dictionary parameters, BiliCookie ck); 12 | 13 | /// 14 | /// 获取WbiKey 15 | /// 16 | /// 17 | Task SetWridAsync(T ob, BiliCookie ck) 18 | where T : IWrid; 19 | 20 | WridDto EncWbi( 21 | Dictionary parameters, 22 | string imgKey, 23 | string subKey, 24 | long timespan = 0 25 | ); 26 | } 27 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/BiliHosts.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent; 2 | 3 | public static class BiliHosts 4 | { 5 | public const string Api = "https://api.bilibili.com"; 6 | public const string App = "https://app.bilibili.com"; 7 | public const string Show = "https://show.bilibili.com"; 8 | public const string Passport = "http://passport.bilibili.com"; 9 | public const string LiveTrace = "https://live-trace.bilibili.com"; 10 | public const string Www = "https://www.bilibili.com"; 11 | public const string Manga = "https://manga.bilibili.com"; 12 | public const string Account = "https://account.bilibili.com"; 13 | public const string Live = "https://api.live.bilibili.com"; 14 | } 15 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/Constants.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent; 2 | 3 | public static class Constants 4 | { 5 | public const string Channel = "yingyongbao"; 6 | } 7 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/HttpClientDelegatingHandlers/LogDelegatingHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Net.Http; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using Microsoft.Extensions.Logging; 5 | 6 | namespace Ray.BiliBiliTool.Agent.HttpClientDelegatingHandlers; 7 | 8 | public class LogDelegatingHandler(ILogger logger) : DelegatingHandler 9 | { 10 | protected override async Task SendAsync( 11 | HttpRequestMessage request, 12 | CancellationToken cancellationToken 13 | ) 14 | { 15 | //记录请求内容 16 | logger.LogDebug("发起请求:[{method}] {uri}", request.Method, request.RequestUri); 17 | 18 | if (request.Content != null) 19 | { 20 | var requestContent = await request.Content.ReadAsStringAsync(cancellationToken); 21 | logger.LogDebug("请求Content: {content}", requestContent); 22 | } 23 | 24 | HttpResponseMessage response = await base.SendAsync(request, cancellationToken); 25 | 26 | var content = await response.Content.ReadAsStringAsync(cancellationToken); 27 | logger.LogDebug("返回Content:{content}", content); 28 | 29 | return response; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/QingLong/Dtos/AddQingLongEnv.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.QingLong.Dtos; 2 | 3 | public class AddQingLongEnv 4 | { 5 | public required string name { get; set; } 6 | public required string value { get; set; } 7 | public string? remarks { get; set; } 8 | } 9 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/QingLong/Dtos/QingLongEnv.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Ray.BiliBiliTool.Agent.QingLong.Dtos; 4 | 5 | public class QingLongEnv : UpdateQingLongEnv 6 | { 7 | public required string timestamp { get; set; } 8 | public int status { get; set; } 9 | 10 | //public long position { get; set; } 11 | public DateTime createdAt { get; set; } 12 | public DateTime updatedAt { get; set; } 13 | } 14 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/QingLong/Dtos/QingLongGenericResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.QingLong.Dtos; 2 | 3 | public class QingLongGenericResponse 4 | { 5 | public int Code { get; set; } 6 | 7 | public T? Data { get; set; } 8 | } 9 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/QingLong/Dtos/TokenResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.QingLong.Dtos; 2 | 3 | public class TokenResponse 4 | { 5 | public required string token { get; set; } 6 | 7 | public required string token_type { get; set; } 8 | } 9 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/QingLong/Dtos/UpdateQingLongEnv.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Agent.QingLong.Dtos; 2 | 3 | public class UpdateQingLongEnv : AddQingLongEnv 4 | { 5 | public long id { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Agent/Ray.BiliBiliTool.Agent.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | net8.0 4 | enable 5 | enable 6 | $(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8618 7 | 8 | 9 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Application.Contracts/IAppService.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using System.Threading.Tasks; 3 | 4 | namespace Ray.BiliBiliTool.Application.Contracts; 5 | 6 | public interface IAppService 7 | { 8 | Task DoTaskAsync(CancellationToken cancellationToken = default); 9 | } 10 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Application.Contracts/IDailyTaskAppService.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace Ray.BiliBiliTool.Application.Contracts; 4 | 5 | /// 6 | /// 每日自动任务 7 | /// 8 | [Description("Daily")] 9 | public interface IDailyTaskAppService : IAppService; 10 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Application.Contracts/ILiveFansMedalAppService.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace Ray.BiliBiliTool.Application.Contracts; 4 | 5 | /// 6 | /// 直播粉丝牌任务 7 | /// 8 | [Description("LiveFansMedal")] 9 | public interface ILiveFansMedalAppService : IAppService; 10 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Application.Contracts/ILiveLotteryTaskAppService.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace Ray.BiliBiliTool.Application.Contracts; 4 | 5 | /// 6 | /// 每日自动任务 7 | /// 8 | [Description("LiveLottery")] 9 | public interface ILiveLotteryTaskAppService : IAppService; 10 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Application.Contracts/ILoginTaskAppService.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace Ray.BiliBiliTool.Application.Contracts; 4 | 5 | /// 6 | /// 登录任务 7 | /// 8 | [Description("Login")] 9 | public interface ILoginTaskAppService : IAppService; 10 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Application.Contracts/ITestAppService.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace Ray.BiliBiliTool.Application.Contracts; 4 | 5 | /// 6 | /// 每日自动任务 7 | /// 8 | [Description("Test")] 9 | public interface ITestAppService : IAppService; 10 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Application.Contracts/IUnfollowBatchedTaskAppService.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace Ray.BiliBiliTool.Application.Contracts; 4 | 5 | /// 6 | /// 每日自动任务 7 | /// 8 | [Description("UnfollowBatched")] 9 | public interface IUnfollowBatchedTaskAppService : IAppService; 10 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Application.Contracts/IVipBigPointAppService.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace Ray.BiliBiliTool.Application.Contracts; 4 | 5 | /// 6 | /// 每日自动任务 7 | /// 8 | [Description("VipBigPoint")] 9 | public interface IVipBigPointAppService : IAppService; 10 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Application.Contracts/Ray.BiliBiliTool.Application.Contracts.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | net8.0 4 | enable 5 | enable 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Application/AppService.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using System.Threading.Tasks; 3 | using Ray.BiliBiliTool.Application.Contracts; 4 | 5 | namespace Ray.BiliBiliTool.Application; 6 | 7 | public abstract class AppService : IAppService 8 | { 9 | public abstract Task DoTaskAsync(CancellationToken cancellationToken = default); 10 | } 11 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Application/Attributes/TaskLevel.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace Ray.BiliBiliTool.Application.Attributes; 4 | 5 | public enum TaskLevel 6 | { 7 | [DefaultValue(5)] 8 | One, 9 | 10 | [DefaultValue(3)] 11 | Two, 12 | 13 | [DefaultValue(2)] 14 | Three, 15 | } 16 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Application/Extensions/ServiceCollectionExtension.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.DependencyInjection; 2 | using Ray.BiliBiliTool.Application.Contracts; 3 | 4 | namespace Ray.BiliBiliTool.Application.Extensions; 5 | 6 | public static class ServiceCollectionExtension 7 | { 8 | public static IServiceCollection AddAppServices(this IServiceCollection services) 9 | { 10 | services.Scan(scan => 11 | scan.FromAssemblyOf() 12 | .AddClasses(classes => classes.AssignableTo()) 13 | .AsImplementedInterfaces() 14 | .WithTransientLifetime() 15 | ); 16 | 17 | return services; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Application/FodyWeavers.xml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Application/TestAppService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using Microsoft.Extensions.Logging; 5 | using Ray.BiliBiliTool.Agent; 6 | using Ray.BiliBiliTool.Application.Attributes; 7 | using Ray.BiliBiliTool.Application.Contracts; 8 | using Ray.BiliBiliTool.DomainService.Interfaces; 9 | using Ray.BiliBiliTool.Infrastructure.Cookie; 10 | 11 | namespace Ray.BiliBiliTool.Application; 12 | 13 | public class TestAppService( 14 | ILogger logger, 15 | IAccountDomainService accountDomainService, 16 | CookieStrFactory cookieStrFactory 17 | ) : BaseMultiAccountsAppService(logger, cookieStrFactory), ITestAppService 18 | { 19 | [TaskInterceptor("测试Cookie")] 20 | protected override async Task DoTaskAccountAsync( 21 | BiliCookie ck, 22 | CancellationToken cancellationToken = default 23 | ) 24 | { 25 | await accountDomainService.LoginByCookie(ck); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Application/UnfollowBatchedTaskAppService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using Microsoft.Extensions.Logging; 5 | using Ray.BiliBiliTool.Agent; 6 | using Ray.BiliBiliTool.Application.Attributes; 7 | using Ray.BiliBiliTool.Application.Contracts; 8 | using Ray.BiliBiliTool.DomainService.Interfaces; 9 | using Ray.BiliBiliTool.Infrastructure.Cookie; 10 | 11 | namespace Ray.BiliBiliTool.Application; 12 | 13 | public class UnfollowBatchedTaskAppService( 14 | ILogger logger, 15 | IAccountDomainService accountDomainService, 16 | CookieStrFactory cookieStrFactory 17 | ) : BaseMultiAccountsAppService(logger, cookieStrFactory), IUnfollowBatchedTaskAppService 18 | { 19 | [TaskInterceptor("批量取关", TaskLevel.One)] 20 | protected override async Task DoTaskAccountAsync( 21 | BiliCookie ck, 22 | CancellationToken cancellationToken = default 23 | ) 24 | { 25 | await accountDomainService.UnfollowBatched(ck); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Config/IHasCron.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Config; 2 | 3 | public interface IHasCron 4 | { 5 | public string? Cron { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Config/Options/BiliBiliCookieOptions.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Config.Options; 2 | 3 | /// 4 | /// Cookie信息 5 | /// 6 | public class BiliBiliCookieOptions 7 | { 8 | public string? CookieStr { get; set; } 9 | } 10 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Config/Options/LiveLotteryTaskOptions.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Config.Options; 2 | 3 | public class LiveLotteryTaskOptions : IHasCron 4 | { 5 | public string? IncludeAwardNames { get; set; } 6 | 7 | public string? ExcludeAwardNames { get; set; } 8 | 9 | public List IncludeAwardNameList => 10 | IncludeAwardNames 11 | ?.Split("|", StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries) 12 | .ToList() ?? new List(); 13 | 14 | public List ExcludeAwardNameList => 15 | ExcludeAwardNames 16 | ?.Split("|", StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries) 17 | .ToList() ?? new List(); 18 | 19 | public bool AutoGroupFollowings { get; set; } = true; 20 | 21 | public string? DenyUids { get; set; } 22 | 23 | public List DenyUidList => 24 | DenyUids 25 | ?.Split(",", StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries) 26 | .ToList() ?? new List(); 27 | 28 | public string? Cron { get; set; } 29 | } 30 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Config/Options/QingLongOptions.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Config.Options; 2 | 3 | public class QingLongOptions 4 | { 5 | public string? ClientId { get; set; } 6 | 7 | public string? ClientSecret { get; set; } 8 | } 9 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Config/Options/UnfollowBatchedTaskOptions.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Config.Options; 2 | 3 | public class UnfollowBatchedTaskOptions : IHasCron 4 | { 5 | public string? GroupName { get; set; } 6 | 7 | public int Count { get; set; } = 0; 8 | 9 | public string? RetainUids { get; set; } 10 | 11 | public List RetainUidList => 12 | RetainUids 13 | ?.Split(",", StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries) 14 | .ToList() ?? new List(); 15 | 16 | public string? Cron { get; set; } 17 | } 18 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Config/Options/VipBigPointOptions.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Config.Options; 2 | 3 | public class VipBigPointOptions : IHasCron 4 | { 5 | public string? ViewBangumis { get; set; } 6 | 7 | public List ViewBangumiList 8 | { 9 | get 10 | { 11 | List re = []; 12 | if (string.IsNullOrWhiteSpace(ViewBangumis) | ViewBangumis == "-1") 13 | return re; 14 | 15 | string[] array = ViewBangumis?.Split(',') ?? []; 16 | foreach (string item in array) 17 | { 18 | if (long.TryParse(item.Trim(), out long upId)) 19 | re.Add(upId); 20 | else 21 | re.Add(long.MinValue); 22 | } 23 | return re; 24 | } 25 | } 26 | 27 | public string? Cron { get; set; } 28 | } 29 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Config/Options/VipPrivilegeOptions.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Config.Options; 2 | 3 | public class VipPrivilegeOptions 4 | { 5 | public bool IsEnable { get; set; } = true; 6 | } 7 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Config/Ray.BiliBiliTool.Config.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | net8.0 4 | enable 5 | enable 6 | 7 | 8 | 9 | 13 | 17 | 18 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Console/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Ray.BiliBiliTool.Console": { 4 | "commandName": "Project", 5 | "environmentVariables": { 6 | "DOTNET_ENVIRONMENT": "Development" 7 | } 8 | }, 9 | "Docker": { 10 | "commandName": "Docker" 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Console/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "DailyTaskConfig": { 3 | "SupportUpIds": "", 4 | "AutoChargeUpId": "341688380" 5 | }, 6 | "Security": { 7 | "IsSkipDailyTask": false, 8 | "RandomSleepMaxMin": 0, 9 | "IntervalSecondsBetweenRequestApi": 7 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Console/appsettings.Production.json: -------------------------------------------------------------------------------- 1 | { 2 | "DailyTaskConfig": { 3 | "SupportUpIds": "", 4 | "AutoChargeUpId": "341688380" 5 | }, 6 | //用于UT验证 7 | "IsPrd": true 8 | } 9 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Domain/BiliLogs.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | namespace Ray.BiliBiliTool.Domain; 5 | 6 | [Table("bili_logs")] 7 | public class BiliLogs 8 | { 9 | [Key] 10 | [Column("id")] 11 | public long Id { get; set; } 12 | 13 | [Column("timeStamp")] 14 | public required DateTime Timestamp { get; set; } 15 | 16 | [Column("level")] 17 | public required string Level { get; set; } 18 | 19 | [Column("exception")] 20 | public string? Exception { get; set; } 21 | 22 | [Column("renderedMessage")] 23 | public string? RenderedMessage { get; set; } 24 | 25 | [Column("properties")] 26 | public string? Properties { get; set; } 27 | 28 | [Column("fireInstanceIdComputed")] 29 | public string? FireInstanceIdComputed { get; set; } 30 | 31 | public string FormattedLogLevel => 32 | Level.ToLower() switch 33 | { 34 | "verbose" => "VERB", 35 | "debug" => "DBG", 36 | "information" => "INFO", 37 | "warning" => "WARN", 38 | "error" => "ERR", 39 | "fatal" => "FATAL", 40 | _ => Level.ToUpper(), 41 | }; 42 | } 43 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Domain/ExecutionLogDetail.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | namespace Ray.BiliBiliTool.Domain; 4 | 5 | public class ExecutionLogDetail 6 | { 7 | public string? ExecutionDetails { get; set; } 8 | public string? ErrorStackTrace { get; set; } 9 | public int? ErrorCode { get; set; } 10 | 11 | [MaxLength(1000)] 12 | public string? ErrorHelpLink { get; set; } 13 | } 14 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Domain/LogType.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Domain; 2 | 3 | public enum LogType 4 | { 5 | ScheduleJob, 6 | Trigger, 7 | System, 8 | } 9 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Domain/Ray.BiliBiliTool.Domain.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | net8.0 4 | enable 5 | enable 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.DomainService/CoinDomainService.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Ray.BiliBiliTool.Agent; 3 | using Ray.BiliBiliTool.Agent.BiliBiliAgent.Interfaces; 4 | using Ray.BiliBiliTool.DomainService.Interfaces; 5 | 6 | namespace Ray.BiliBiliTool.DomainService; 7 | 8 | /// 9 | /// 硬币 10 | /// 11 | public class CoinDomainService(IAccountApi accountApi, IDailyTaskApi dailyTaskApi) 12 | : ICoinDomainService 13 | { 14 | /// 15 | /// 获取账户硬币余额 16 | /// 17 | /// 18 | public async Task GetCoinBalance(BiliCookie ck) 19 | { 20 | var response = await accountApi.GetCoinBalanceAsync(ck.ToString()); 21 | return response.Data.Money ?? 0; 22 | } 23 | 24 | /// 25 | /// 获取今日已投币数 26 | /// 27 | /// 28 | public async Task GetDonatedCoins(BiliCookie ck) 29 | { 30 | return (await GetDonateCoinExp(ck)) / 10; 31 | } 32 | 33 | #region private 34 | /// 35 | /// 获取今日通过投币已获取的经验值 36 | /// 37 | /// 38 | private async Task GetDonateCoinExp(BiliCookie ck) 39 | { 40 | return (await dailyTaskApi.GetDonateCoinExpAsync(ck.ToString())).Data; 41 | } 42 | #endregion 43 | } 44 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.DomainService/Dtos/FansMedalInfoDto.cs: -------------------------------------------------------------------------------- 1 | using Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.Live; 2 | 3 | namespace Ray.BiliBiliTool.DomainService.Dtos; 4 | 5 | public class FansMedalInfoDto 6 | { 7 | public FansMedalInfoDto( 8 | long roomId, 9 | MedalWallDto medalInfo, 10 | GetLiveRoomInfoResponse liveRoomInfo 11 | ) 12 | { 13 | RoomId = roomId; 14 | MedalInfo = medalInfo; 15 | LiveRoomInfo = liveRoomInfo; 16 | } 17 | 18 | // 直播间 id 19 | public long RoomId { get; set; } 20 | 21 | // 粉丝牌信息 22 | public MedalWallDto MedalInfo { get; set; } 23 | 24 | // 直播间信息 25 | public GetLiveRoomInfoResponse LiveRoomInfo { get; set; } 26 | } 27 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.DomainService/Dtos/HeartBeatIterationInfoDto.cs: -------------------------------------------------------------------------------- 1 | using Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.Live; 2 | 3 | namespace Ray.BiliBiliTool.DomainService.Dtos; 4 | 5 | public class HeartBeatIterationInfoDto 6 | { 7 | public HeartBeatIterationInfoDto( 8 | long roomId, 9 | GetLiveRoomInfoResponse roomInfo, 10 | HeartBeatResponse heartBeatInfo, 11 | int heartBeatCount, 12 | long lastBeatTime 13 | ) 14 | { 15 | RoomId = roomId; 16 | RoomInfo = roomInfo; 17 | HeartBeatInfo = heartBeatInfo; 18 | HeartBeatCount = heartBeatCount; 19 | LastBeatTime = lastBeatTime; 20 | } 21 | 22 | public long RoomId { get; set; } = 0; 23 | 24 | public GetLiveRoomInfoResponse RoomInfo { get; set; } = new(); 25 | 26 | public HeartBeatResponse HeartBeatInfo { get; set; } = new(); 27 | 28 | // 成功发送的心跳包个数 29 | public int HeartBeatCount { get; set; } = 0; 30 | 31 | public long LastBeatTime { get; set; } = 0; 32 | 33 | // 连续失败的次数 34 | public int FailedTimes { get; set; } = 0; 35 | } 36 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.DomainService/Dtos/VideoInfoDto.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.DomainService.Dtos; 2 | 3 | public class VideoInfoDto 4 | { 5 | public string Aid { get; set; } 6 | 7 | public string Bvid { get; set; } 8 | 9 | public long Cid { get; set; } 10 | 11 | public string Title { get; set; } 12 | 13 | public int? Duration { get; set; } 14 | 15 | /// 16 | /// 是否转载 17 | /// 1:原创 18 | /// 2:转载 19 | /// 20 | public int Copyright { get; set; } 21 | } 22 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.DomainService/Extensions/ServiceCollectionExtensions.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.DependencyInjection; 2 | using Ray.BiliBiliTool.DomainService.Interfaces; 3 | 4 | namespace Ray.BiliBiliTool.DomainService.Extensions; 5 | 6 | public static class ServiceCollectionExtensions 7 | { 8 | public static IServiceCollection AddDomainServices(this IServiceCollection services) 9 | { 10 | services.Scan(scan => 11 | scan.FromAssemblyOf() 12 | .AddClasses(classes => classes.AssignableTo()) 13 | .AsImplementedInterfaces() 14 | .WithTransientLifetime() 15 | ); 16 | 17 | return services; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.DomainService/Interfaces/IAccountDomainService.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Ray.BiliBiliTool.Agent; 3 | using Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos; 4 | 5 | namespace Ray.BiliBiliTool.DomainService.Interfaces; 6 | 7 | /// 8 | /// 账户 9 | /// 10 | public interface IAccountDomainService : IDomainService 11 | { 12 | /// 13 | /// 使用Cookie登录 14 | /// 15 | /// 16 | Task LoginByCookie(BiliCookie cookie); 17 | 18 | /// 19 | /// 获取每日任务完成情况 20 | /// 21 | /// 22 | Task GetDailyTaskStatus(BiliCookie ck); 23 | 24 | /// 25 | /// 批量取关 26 | /// 27 | Task UnfollowBatched(BiliCookie ck); 28 | 29 | /// 30 | /// 计算升级时间 31 | /// 32 | /// 33 | /// 升级时间 34 | int CalculateUpgradeTime(UserInfo useInfo); 35 | } 36 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.DomainService/Interfaces/IArticleDomainService.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Ray.BiliBiliTool.Agent; 3 | 4 | namespace Ray.BiliBiliTool.DomainService.Interfaces; 5 | 6 | public interface IArticleDomainService : IDomainService 7 | { 8 | Task AddCoinForArticle(long cvid, long mid, BiliCookie ck); 9 | 10 | Task AddCoinForArticles(BiliCookie ck); 11 | 12 | Task LikeArticle(long cvid, BiliCookie ck); 13 | } 14 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.DomainService/Interfaces/IChargeDomainService.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Ray.BiliBiliTool.Agent; 3 | using Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos; 4 | 5 | namespace Ray.BiliBiliTool.DomainService.Interfaces; 6 | 7 | /// 8 | /// 充电 9 | /// 10 | public interface IChargeDomainService : IDomainService 11 | { 12 | /// 13 | /// 充电 14 | /// 15 | /// 16 | Task Charge(UserInfo userInfo, BiliCookie ck); 17 | 18 | /// 19 | /// 充电后留言 20 | /// 21 | /// 22 | Task ChargeComments(string token, BiliCookie ck); 23 | } 24 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.DomainService/Interfaces/ICoinDomainService.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Ray.BiliBiliTool.Agent; 3 | 4 | namespace Ray.BiliBiliTool.DomainService.Interfaces; 5 | 6 | /// 7 | /// B币 8 | /// 9 | public interface ICoinDomainService : IDomainService 10 | { 11 | /// 12 | /// 获取账户硬币余额 13 | /// 14 | /// 15 | Task GetCoinBalance(BiliCookie ck); 16 | 17 | /// 18 | /// 获取今日已投币数量 19 | /// 20 | /// 21 | Task GetDonatedCoins(BiliCookie ck); 22 | } 23 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.DomainService/Interfaces/IDomainService.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.DomainService.Interfaces; 2 | 3 | /// 4 | /// 定义一个领域服务 5 | /// 6 | public interface IDomainService { } 7 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.DomainService/Interfaces/IDonateCoinDomainService.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Ray.BiliBiliTool.Agent; 3 | using Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos; 4 | 5 | namespace Ray.BiliBiliTool.DomainService.Interfaces; 6 | 7 | /// 8 | /// 投币 9 | /// 10 | public interface IDonateCoinDomainService : IDomainService 11 | { 12 | Task AddCoinsForVideos(BiliCookie ck); 13 | 14 | Task TryGetCanDonatedVideo(BiliCookie ck); 15 | 16 | Task DoAddCoinForVideo(UpVideoInfo video, bool select_like, BiliCookie ck); 17 | } 18 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.DomainService/Interfaces/ILiveDomainService.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Ray.BiliBiliTool.Agent; 3 | using Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.Live; 4 | 5 | namespace Ray.BiliBiliTool.DomainService.Interfaces; 6 | 7 | /// 8 | /// 直播中心 9 | /// 10 | public interface ILiveDomainService : IDomainService 11 | { 12 | /// 13 | /// 签到 14 | /// 15 | Task LiveSign(BiliCookie ck); 16 | 17 | /// 18 | /// 银瓜子兑换硬币 19 | /// 20 | /// 21 | Task ExchangeSilver2Coin(BiliCookie ck); 22 | 23 | /// 24 | /// 天选抽奖 25 | /// 26 | Task TianXuan(BiliCookie ck); 27 | 28 | Task TryJoinTianXuan(ListItemDto target, BiliCookie ck); 29 | 30 | Task GroupFollowing(BiliCookie ck); 31 | 32 | /// 33 | /// 发送弹幕 34 | /// 35 | Task SendDanmakuToFansMedalLive(BiliCookie ck); 36 | 37 | /// 38 | /// 直播时长挂机 39 | /// 40 | Task SendHeartBeatToFansMedalLive(BiliCookie ck); 41 | 42 | /// 43 | /// 点赞直播间 44 | /// 45 | Task LikeFansMedalLive(BiliCookie ck); 46 | } 47 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.DomainService/Interfaces/ILoginDomainService.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using System.Threading.Tasks; 3 | using Ray.BiliBiliTool.Agent; 4 | 5 | namespace Ray.BiliBiliTool.DomainService.Interfaces; 6 | 7 | /// 8 | /// 账户 9 | /// 10 | public interface ILoginDomainService : IDomainService 11 | { 12 | /// 13 | /// 扫描二维码登录 14 | /// 15 | /// 16 | Task LoginByQrCodeAsync(CancellationToken cancellationToken); 17 | 18 | /// 19 | /// Set Cookie 20 | /// 21 | /// 22 | /// 23 | Task SetCookieAsync(BiliCookie cookie, CancellationToken cancellationToken); 24 | 25 | /// 26 | /// 持久化Cookie到配置文件 27 | /// 28 | /// 29 | Task SaveCookieToJsonFileAsync(BiliCookie ckInfo, CancellationToken cancellationToken); 30 | 31 | /// 32 | /// 持久化Cookie到青龙环境变量 33 | /// 34 | /// 35 | /// 36 | /// 37 | Task SaveCookieToQinLongAsync(BiliCookie ckInfo, CancellationToken cancellationToken); 38 | } 39 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.DomainService/Interfaces/IMangaDomainService.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Ray.BiliBiliTool.Agent; 3 | using Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos; 4 | 5 | namespace Ray.BiliBiliTool.DomainService.Interfaces; 6 | 7 | /// 8 | /// 漫画 9 | /// 10 | public interface IMangaDomainService : IDomainService 11 | { 12 | /// 13 | /// 签到 14 | /// 15 | Task MangaSign(BiliCookie ck); 16 | 17 | /// 18 | /// 阅读 19 | /// 20 | Task MangaRead(BiliCookie ck); 21 | 22 | /// 23 | /// 获取大会员权益 24 | /// 25 | /// 26 | /// 27 | Task ReceiveMangaVipReward(int reason_id, UserInfo userIfo, BiliCookie ck); 28 | } 29 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.DomainService/Interfaces/IVipPrivilegeDomainService.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Ray.BiliBiliTool.Agent; 3 | using Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos; 4 | 5 | namespace Ray.BiliBiliTool.DomainService.Interfaces; 6 | 7 | /// 8 | /// 大会员权益 9 | /// 10 | public interface IVipPrivilegeDomainService : IDomainService 11 | { 12 | /// 13 | /// 获取大会员权益 14 | /// 15 | /// 16 | Task ReceiveVipPrivilege(UserInfo userInfo, BiliCookie ck); 17 | } 18 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.DomainService/Ray.BiliBiliTool.DomainService.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | net8.0 4 | enable 5 | enable 6 | $(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8618 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Infrastructure.EF/Extensions/ServiceCollectionExtension.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.DependencyInjection; 2 | 3 | namespace Ray.BiliBiliTool.Infrastructure.EF.Extensions; 4 | 5 | public static class ServiceCollectionExtension 6 | { 7 | public static IServiceCollection AddEF(this IServiceCollection services) 8 | { 9 | services.AddDbContextFactory(); 10 | return services; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Infrastructure.EF/Ray.BiliBiliTool.Infrastructure.EF.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | net8.0 4 | enable 5 | enable 6 | 7 | 8 | 12 | 13 | all 14 | runtime; build; native; contentfiles; analyzers; buildtransitive 15 | 16 | 17 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Infrastructure/Enums/PlatformType.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Infrastructure.Enums; 2 | 3 | public enum PlatformType 4 | { 5 | Unknown, 6 | GitHubActions, 7 | Docker, 8 | QingLong, 9 | Web, 10 | } 11 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Infrastructure/Extensions/ICollectionExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Infrastructure.Extensions; 2 | 3 | public static class ICollectionExtensions 4 | { 5 | public static void AddIfNotExist(this ICollection source, T add) 6 | { 7 | if (!source.Any(x => x != null && x.Equals(add))) 8 | source.Add(add); 9 | } 10 | 11 | public static void AddIfNotExist(this ICollection source, T add, Func exist) 12 | { 13 | if (!source.Any(exist)) 14 | source.Add(add); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Infrastructure/Extensions/TypeExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace Ray.BiliBiliTool.Infrastructure.Extensions; 4 | 5 | public static class TypeExtensions 6 | { 7 | /// 8 | /// 获取属性的Description 9 | /// 10 | /// 11 | /// 12 | /// 13 | public static string GetPropertyDescription(this Type type, string propertyName) 14 | { 15 | var desc = (DescriptionAttribute?) 16 | type.GetProperty(propertyName) 17 | ?.GetCustomAttributes(typeof(DescriptionAttribute), false) 18 | .FirstOrDefault(); 19 | 20 | return desc?.Description ?? ""; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Infrastructure/Global.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Configuration; 2 | 3 | namespace Ray.BiliBiliTool.Infrastructure; 4 | 5 | public class Global 6 | { 7 | /// 8 | /// 根配置 9 | /// 10 | public static IConfigurationRoot? ConfigurationRoot { get; set; } 11 | 12 | /// 13 | /// 根容器 14 | /// 15 | public static IServiceProvider? ServiceProviderRoot { get; set; } 16 | } 17 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Infrastructure/Helpers/IpHelper.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Infrastructure.Helpers; 2 | 3 | public class IpHelper 4 | { 5 | public static string? GetIp() 6 | { 7 | try 8 | { 9 | var re = new HttpClient().GetAsync("http://api.ipify.org/").Result; 10 | return re.IsSuccessStatusCode ? re.Content.ReadAsStringAsync().Result : null; 11 | } 12 | catch (Exception) 13 | { 14 | return null; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Infrastructure/Helpers/ObjectHelper.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | namespace Ray.BiliBiliTool.Infrastructure.Helpers; 4 | 5 | public static class ObjectHelper 6 | { 7 | public static Dictionary ObjectToDictionary(object obj) 8 | { 9 | // 获取对象的所有属性 10 | PropertyInfo[] properties = obj.GetType().GetProperties(); 11 | 12 | // 遍历所有属性并将其添加到字典中 13 | return properties.ToDictionary( 14 | property => property.Name, 15 | property => property.GetValue(obj) 16 | ); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Infrastructure/Helpers/RandomHelper.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Infrastructure.Helpers; 2 | 3 | public class RandomHelper 4 | { 5 | private int rep = 0; 6 | 7 | public string GenerateCode(int codeCount) 8 | { 9 | string str = string.Empty; 10 | long num2 = DateTime.Now.Ticks + this.rep; 11 | rep++; 12 | Random random = new Random((int)((ulong)num2 & 0xffffffL) | (int)(num2 >> this.rep)); 13 | for (int i = 0; i < codeCount; i++) 14 | { 15 | char ch; 16 | int num = random.Next(); 17 | if ((num % 2) == 0) 18 | { 19 | ch = (char)(0x30 + ((ushort)(num % 10))); 20 | } 21 | else 22 | { 23 | ch = (char)(0x41 + ((ushort)(num % 0x1a))); 24 | } 25 | 26 | str += ch.ToString(); 27 | } 28 | 29 | return str; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Infrastructure/Helpers/ZipHelper.cs: -------------------------------------------------------------------------------- 1 | using System.IO.Compression; 2 | using System.Text; 3 | 4 | namespace Ray.BiliBiliTool.Infrastructure.Helpers; 5 | 6 | /// 7 | /// 解压缩Helper 8 | /// 9 | public class ZipHelper 10 | { 11 | /// 12 | /// 将Gzip的byte数组读取为字符串 13 | /// 14 | /// 15 | /// 16 | /// 17 | public static string ReadGzip(byte[] bytes, string encoding = "UTF-8") 18 | { 19 | string result = string.Empty; 20 | using (MemoryStream ms = new MemoryStream(bytes)) 21 | { 22 | using (GZipStream decompressedStream = new GZipStream(ms, CompressionMode.Decompress)) 23 | { 24 | using ( 25 | StreamReader sr = new StreamReader( 26 | decompressedStream, 27 | Encoding.GetEncoding(encoding) 28 | ) 29 | ) 30 | { 31 | result = sr.ReadToEnd(); 32 | } 33 | } 34 | } 35 | return result; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Infrastructure/JsonSerializerOptionsBuilder.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json; 2 | 3 | namespace Ray.BiliBiliTool.Infrastructure; 4 | 5 | /// 6 | /// System.Text.Json的序列化OptionsBuilder 7 | /// 8 | public sealed class JsonSerializerOptionsBuilder 9 | { 10 | static JsonSerializerOptionsBuilder() 11 | { 12 | DefaultOptions = Create().GetOrBuildDefaultOptions(); 13 | } 14 | 15 | /// 16 | /// 默认配置 17 | /// 18 | public static readonly JsonSerializerOptions DefaultOptions; 19 | 20 | public List> BuildActionList { get; } 21 | 22 | private JsonSerializerOptionsBuilder() 23 | { 24 | BuildActionList = new List>(); 25 | } 26 | 27 | public static JsonSerializerOptionsBuilder Create() 28 | { 29 | return new JsonSerializerOptionsBuilder(); 30 | } 31 | 32 | public JsonSerializerOptions Build() 33 | { 34 | JsonSerializerOptions options = new(); //这里没有使用 JsonSerializerDefaults.General 避免后续版本更新后设置改变 35 | 36 | foreach (Action item in BuildActionList) 37 | { 38 | item?.Invoke(options); 39 | } 40 | 41 | return options; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Infrastructure/Ray.BiliBiliTool.Infrastructure.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | net8.0 4 | enable 5 | enable 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Web.Client/Pages/Counter.razor: -------------------------------------------------------------------------------- 1 | @page "/counter" 2 | @rendermode InteractiveAuto 3 | 4 | Counter 5 | 6 |

Counter

7 | 8 |

Current count: @currentCount

9 | 10 | 11 | 12 | @code { 13 | private int currentCount = 0; 14 | 15 | private void IncrementCount() 16 | { 17 | currentCount++; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Web.Client/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Components.WebAssembly.Hosting; 2 | using MudBlazor.Services; 3 | 4 | var builder = WebAssemblyHostBuilder.CreateDefault(args); 5 | 6 | builder.Services.AddMudServices(); 7 | 8 | await builder.Build().RunAsync(); 9 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Web.Client/Ray.BiliBiliTool.Web.Client.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net8.0 4 | enable 5 | enable 6 | true 7 | Default 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Web.Client/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using System.Net.Http.Json 3 | @using Microsoft.AspNetCore.Components.Forms 4 | @using Microsoft.AspNetCore.Components.Routing 5 | @using Microsoft.AspNetCore.Components.Web 6 | @using static Microsoft.AspNetCore.Components.Web.RenderMode 7 | @using Microsoft.AspNetCore.Components.Web.Virtualization 8 | @using Microsoft.JSInterop 9 | @using Ray.BiliBiliTool.Web.Client 10 | @using MudBlazor 11 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Web.Client/wwwroot/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Web.Client/wwwroot/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Web/Components/App.razor: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Web/Components/Comps/BlazingJob.razor: -------------------------------------------------------------------------------- 1 |

BlazingJob

2 | 3 | @code { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Web/Components/Comps/BlazingJob.razor.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/src/Ray.BiliBiliTool.Web/Components/Comps/BlazingJob.razor.css -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Web/Components/Comps/BlazingJob.razor.js: -------------------------------------------------------------------------------- 1 | export class BlazingJob { 2 | 3 | } 4 | 5 | window.BlazingJob = BlazingJob; -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Web/Components/Comps/BlazingTrigger.razor: -------------------------------------------------------------------------------- 1 |

BlazingTrigger

2 | 3 | @code { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Web/Components/Comps/BlazingTrigger.razor.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Components; 2 | 3 | namespace Ray.BiliBiliTool.Web.Components.Comps; 4 | 5 | public partial class BlazingTrigger : ComponentBase 6 | { 7 | public Task Validate() 8 | { 9 | throw new NotImplementedException(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Web/Components/Comps/BlazingTrigger.razor.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/src/Ray.BiliBiliTool.Web/Components/Comps/BlazingTrigger.razor.css -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Web/Components/Comps/BlazingTrigger.razor.js: -------------------------------------------------------------------------------- 1 | export class BlazingTrigger { 2 | 3 | } 4 | 5 | window.BlazingTrigger = BlazingTrigger; -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Web/Components/Comps/DefaultJobUI.razor: -------------------------------------------------------------------------------- 1 |

DefaultJobUI

2 | 3 | @code { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Web/Components/Comps/DefaultJobUI.razor.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Components; 2 | 3 | namespace Ray.BiliBiliTool.Web.Components.Comps; 4 | 5 | public partial class DefaultJobUI : ComponentBase { } 6 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Web/Components/Layout/MainLayout.razor: -------------------------------------------------------------------------------- 1 | @inherits LayoutComponentBase 2 | 3 |
4 | 7 | 8 |
9 |
10 | About 11 |
12 | 13 |
14 | @Body 15 |
16 |
17 |
18 | 19 |
20 | An unhandled error has occurred. 21 | Reload 22 | 🗙 23 |
24 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Web/Components/Layout/NavMenu.razor: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 27 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Web/Components/Pages/Home.razor: -------------------------------------------------------------------------------- 1 | @page "/" 2 | 3 | Home 4 | 5 |

Hello, world!

6 | 7 | Welcome to your new app. 8 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Web/Components/Pages/Schedules/Schedules.razor.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/src/Ray.BiliBiliTool.Web/Components/Pages/Schedules/Schedules.razor.css -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Web/Components/Pages/Schedules/Schedules.razor.js: -------------------------------------------------------------------------------- 1 | export class Schedules { 2 | 3 | } 4 | 5 | window.Schedules = Schedules; -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Web/Components/Routes.razor: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Web/Components/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using System.Net.Http.Json 3 | @using Microsoft.AspNetCore.Components.Forms 4 | @using Microsoft.AspNetCore.Components.Routing 5 | @using Microsoft.AspNetCore.Components.Web 6 | @using static Microsoft.AspNetCore.Components.Web.RenderMode 7 | @using Microsoft.AspNetCore.Components.Web.Virtualization 8 | @using Microsoft.JSInterop 9 | @using Ray.BiliBiliTool.Web 10 | @using Ray.BiliBiliTool.Web.Client 11 | @using Ray.BiliBiliTool.Web.Components 12 | @using MudBlazor 13 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Web/Constants.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Web; 2 | 3 | public static class Constants 4 | { 5 | public const string BiliJobGroup = "BiliJob"; 6 | } 7 | 8 | public enum ScheduleDialogTab 9 | { 10 | Job, 11 | Trigger, 12 | } 13 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Web/Jobs/BaseJob.cs: -------------------------------------------------------------------------------- 1 | using Quartz; 2 | using Serilog.Context; 3 | 4 | namespace Ray.BiliBiliTool.Web.Jobs; 5 | 6 | public abstract class BaseJob(ILogger logger) : IJob 7 | where TJob : BaseJob 8 | { 9 | public async Task Execute(IJobExecutionContext context) 10 | { 11 | var fireInstanceId = context.FireInstanceId; 12 | using (LogContext.PushProperty("FireInstanceId", fireInstanceId)) 13 | { 14 | try 15 | { 16 | await DoExecuteAsync(context); 17 | } 18 | catch (Exception e) 19 | { 20 | logger.LogError(e, e.Message); 21 | } 22 | } 23 | } 24 | 25 | protected abstract Task DoExecuteAsync(IJobExecutionContext context); 26 | } 27 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Web/Jobs/DailyJob.cs: -------------------------------------------------------------------------------- 1 | using Quartz; 2 | using Ray.BiliBiliTool.Application.Contracts; 3 | 4 | namespace Ray.BiliBiliTool.Web.Jobs; 5 | 6 | public class DailyJob(ILogger logger, IDailyTaskAppService appService) 7 | : BaseJob(logger) 8 | { 9 | private readonly ILogger _logger = logger; 10 | public static readonly JobKey Key = new(nameof(DailyJob), Constants.BiliJobGroup); 11 | 12 | protected override async Task DoExecuteAsync(IJobExecutionContext context) 13 | { 14 | _logger.LogInformation($"{nameof(DailyJob)} started."); 15 | await appService.DoTaskAsync(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Web/Jobs/LiveFansMedalJob.cs: -------------------------------------------------------------------------------- 1 | using Quartz; 2 | using Ray.BiliBiliTool.Application.Contracts; 3 | 4 | namespace Ray.BiliBiliTool.Web.Jobs; 5 | 6 | public class LiveFansMedalJob(ILogger logger, ILiveFansMedalAppService appService) 7 | : BaseJob(logger) 8 | { 9 | private readonly ILogger _logger = logger; 10 | public static readonly JobKey Key = new(nameof(LiveFansMedalJob), Constants.BiliJobGroup); 11 | 12 | protected override async Task DoExecuteAsync(IJobExecutionContext context) 13 | { 14 | _logger.LogInformation($"{nameof(LiveFansMedalJob)} started."); 15 | await appService.DoTaskAsync(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Web/Jobs/LiveLotteryJob.cs: -------------------------------------------------------------------------------- 1 | using Quartz; 2 | using Ray.BiliBiliTool.Application.Contracts; 3 | 4 | namespace Ray.BiliBiliTool.Web.Jobs; 5 | 6 | public class LiveLotteryJob(ILogger logger, ILiveLotteryTaskAppService appService) 7 | : BaseJob(logger) 8 | { 9 | private readonly ILogger _logger = logger; 10 | public static readonly JobKey Key = new(nameof(LiveLotteryJob), Constants.BiliJobGroup); 11 | 12 | protected override async Task DoExecuteAsync(IJobExecutionContext context) 13 | { 14 | _logger.LogInformation($"{nameof(LiveLotteryJob)} started."); 15 | await appService.DoTaskAsync(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Web/Jobs/LoginJob.cs: -------------------------------------------------------------------------------- 1 | using Quartz; 2 | using Ray.BiliBiliTool.Application.Contracts; 3 | 4 | namespace Ray.BiliBiliTool.Web.Jobs; 5 | 6 | public class LoginJob(ILogger logger, ILoginTaskAppService appService) 7 | : BaseJob(logger) 8 | { 9 | private readonly ILogger _logger = logger; 10 | public static readonly JobKey Key = new(nameof(LoginJob), Constants.BiliJobGroup); 11 | 12 | protected override async Task DoExecuteAsync(IJobExecutionContext context) 13 | { 14 | _logger.LogInformation($"{nameof(LoginJob)} started."); 15 | await appService.DoTaskAsync(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Web/Jobs/TestBiliJob.cs: -------------------------------------------------------------------------------- 1 | using Quartz; 2 | using Ray.BiliBiliTool.Application.Contracts; 3 | 4 | namespace Ray.BiliBiliTool.Web.Jobs; 5 | 6 | public class TestBiliJob(ILogger logger, ITestAppService appService) 7 | : BaseJob(logger) 8 | { 9 | private readonly ILogger _logger = logger; 10 | public static readonly JobKey Key = new(nameof(TestBiliJob), Constants.BiliJobGroup); 11 | 12 | protected override async Task DoExecuteAsync(IJobExecutionContext context) 13 | { 14 | _logger.LogInformation($"{nameof(TestBiliJob)} started."); 15 | await appService.DoTaskAsync(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Web/Jobs/UnfollowBatchedJob.cs: -------------------------------------------------------------------------------- 1 | using Quartz; 2 | using Ray.BiliBiliTool.Application.Contracts; 3 | 4 | namespace Ray.BiliBiliTool.Web.Jobs; 5 | 6 | public class UnfollowBatchedJob( 7 | ILogger logger, 8 | IUnfollowBatchedTaskAppService appService 9 | ) : BaseJob(logger) 10 | { 11 | private readonly ILogger _logger = logger; 12 | public static readonly JobKey Key = new(nameof(UnfollowBatchedJob), Constants.BiliJobGroup); 13 | 14 | protected override async Task DoExecuteAsync(IJobExecutionContext context) 15 | { 16 | _logger.LogInformation($"{nameof(UnfollowBatchedJob)} started."); 17 | await appService.DoTaskAsync(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Web/Jobs/VipBigPointJob.cs: -------------------------------------------------------------------------------- 1 | using Quartz; 2 | using Ray.BiliBiliTool.Application.Contracts; 3 | 4 | namespace Ray.BiliBiliTool.Web.Jobs; 5 | 6 | public class VipBigPointJob(ILogger logger, IVipBigPointAppService appService) 7 | : BaseJob(logger) 8 | { 9 | private readonly ILogger _logger = logger; 10 | public static readonly JobKey Key = new(nameof(VipBigPointJob), Constants.BiliJobGroup); 11 | 12 | protected override async Task DoExecuteAsync(IJobExecutionContext context) 13 | { 14 | _logger.LogInformation($"{nameof(VipBigPointJob)} started."); 15 | await appService.DoTaskAsync(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Web/Services/IJobUIProvider.cs: -------------------------------------------------------------------------------- 1 | namespace Ray.BiliBiliTool.Web.Services; 2 | 3 | public interface IJobUIProvider 4 | { 5 | Type GetJobUIType(string? jobTypeFullName); 6 | } 7 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Web/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Debug", 5 | "Microsoft.AspNetCore": "Debug" 6 | } 7 | }, 8 | "DetailedErrors": true 9 | } 10 | -------------------------------------------------------------------------------- /src/Ray.BiliBiliTool.Web/wwwroot/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RayWangQvQ/BiliBiliToolPro/677fe3ad684eeb9a556248d90cf62c7f0d408736/src/Ray.BiliBiliTool.Web/wwwroot/favicon.png -------------------------------------------------------------------------------- /tencentScf/bootstrap: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | set -euo pipefail 3 | 4 | FuncFile="$(echo $_HANDLER | cut -d. -f1).sh" 5 | echo "[step 1]初始化,开始加载函数文件 $FuncFile" 6 | source ./$FuncFile 7 | echo "=>完成" 8 | 9 | echo "[step 2]初始化完成,开始发送ready信号" 10 | curl -d " " -X POST -s "http://$SCF_RUNTIME_API:$SCF_RUNTIME_API_PORT/runtime/init/ready" 11 | echo "=>完成" 12 | 13 | echo "[step 3]开始循环监听处理事件调用" 14 | while true 15 | do 16 | HEADERS="$(mktemp)" 17 | echo "=>长轮询获取事件" 18 | EVENT_DATA=$(curl -sS -LD "$HEADERS" -X GET -s "http://$SCF_RUNTIME_API:$SCF_RUNTIME_API_PORT/runtime/invocation/next") 19 | echo "=>监听到事件:$EVENT_DATA" 20 | echo "=>调用函数,开始处理事件" 21 | $(echo "$_HANDLER" | cut -d. -f2) "$EVENT_DATA" 22 | RESPONSE=$EVENT_DATA 23 | echo "=>返回 $RESPONSE" 24 | echo "=>推送函数处理结果" 25 | curl -X POST -s "http://$SCF_RUNTIME_API:$SCF_RUNTIME_API_PORT/runtime/invocation/response" -d "$RESPONSE" 26 | done -------------------------------------------------------------------------------- /tencentScf/index.sh: -------------------------------------------------------------------------------- 1 | echo "成功加载index.sh函数文件" 2 | 3 | function main_handler () { 4 | echo "进入main_handler" 5 | EVENT_DATA=$1 6 | echo "$EVENT_DATA" 1>&2; 7 | runTasks="" 8 | if [[ $EVENT_DATA == *Message* ]] 9 | then 10 | eventMsg=$(echo $EVENT_DATA | grep -Po 'Message[" :]+\K[^"]+') 11 | echo "触发事件中的附加消息(任务编码)为:$eventMsg" 12 | runTasks="--runTasks=$eventMsg" 13 | else 14 | echo "触发事件中未包含附加消息(任务编码)" 15 | fi 16 | echo "开始运行BiliBiliTool......" 17 | ./Ray.BiliBiliTool.Console $runTasks 18 | echo "函数结束" 19 | } 20 | -------------------------------------------------------------------------------- /tencentScf/publish.bat: -------------------------------------------------------------------------------- 1 | ::https://docs.microsoft.com/zh-cn/dotnet/core/tools/dotnet-publish 2 | 3 | cd ../src/Ray.BiliBiliTool.Console 4 | 5 | dotnet publish --configuration Release --runtime linux-x64 --self-contained true -p:PublishTrimmed=true -o ./bin/Publish/tencent-scf 6 | copy /y ..\..\tencentScf\* .\bin\Publish\tencent-scf\ 7 | 8 | pause 9 | -------------------------------------------------------------------------------- /tencentScf/publish.sh: -------------------------------------------------------------------------------- 1 | # https://docs.microsoft.com/zh-cn/dotnet/core/tools/dotnet-publish 2 | 3 | cd ../src/Ray.BiliBiliTool.Console 4 | 5 | dotnet publish --configuration Release --runtime linux-x64 --self-contained true -p:PublishTrimmed=true -o ../../tencentScf/bin/publish 6 | 7 | cd ../../tencentScf 8 | cp -r ./bootstrap ./index.sh ./bin/publish/ 9 | 10 | cd ./bin/publish 11 | chmod 755 index.sh bootstrap 12 | zip -r -q ../tencent-scf.zip ./* -------------------------------------------------------------------------------- /test/AppServiceTest/AppServiceTest.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | net8.0 4 | enable 5 | enable 6 | false 7 | 8 | 9 | 10 | 11 | 12 | runtime; build; native; contentfiles; analyzers; buildtransitive 13 | all 14 | 15 | 16 | runtime; build; native; contentfiles; analyzers; buildtransitive 17 | all 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /test/AppServiceTest/DailyTask/DonateCoinsTest.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.DependencyInjection; 2 | using Ray.BiliBiliTool.Agent.BiliBiliAgent.Interfaces; 3 | using Ray.BiliBiliTool.Application.Contracts; 4 | using Ray.BiliBiliTool.Infrastructure; 5 | 6 | namespace AppServiceTest.DailyTask 7 | { 8 | public class DonateCoinsTest 9 | { 10 | public DonateCoinsTest() 11 | { 12 | Program.CreateHost(new[] { "--ENVIRONMENT=Development" }); 13 | } 14 | 15 | [Fact] 16 | public void Test1() 17 | { 18 | using var scope = Global.ServiceProviderRoot.CreateScope(); 19 | var appService = scope.ServiceProvider.GetRequiredService(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /test/AppServiceTest/Usings.cs: -------------------------------------------------------------------------------- 1 | global using Ray.BiliBiliTool.Console; 2 | global using Xunit; 3 | -------------------------------------------------------------------------------- /test/AppServiceTest/VipServiceTest.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.DependencyInjection; 2 | using Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.VipTask; 3 | using Ray.BiliBiliTool.Agent.BiliBiliAgent.Interfaces; 4 | using Ray.BiliBiliTool.Application.Contracts; 5 | using Ray.BiliBiliTool.DomainService.Dtos; 6 | using Ray.BiliBiliTool.Infrastructure; 7 | 8 | namespace AppServiceTest; 9 | 10 | public class VipServiceTest 11 | { 12 | public VipServiceTest() 13 | { 14 | Program.CreateHost(new[] { "--ENVIRONMENT=Development" }); 15 | } 16 | 17 | [Fact] 18 | public async Task CompleteV2Test() 19 | { 20 | using var scope = Global.ServiceProviderRoot.CreateScope(); 21 | var api = scope.ServiceProvider.GetRequiredService(); 22 | var res = await api.CompleteV2(new ReceiveOrCompleteTaskRequest("dress-view"), null); 23 | Assert.True(res.Code == 0); 24 | } 25 | 26 | [Fact] 27 | public async Task ReceiveV2Test() 28 | { 29 | using var scope = Global.ServiceProviderRoot.CreateScope(); 30 | var api = scope.ServiceProvider.GetRequiredService(); 31 | var res = await api.ReceiveV2(new ReceiveOrCompleteTaskRequest("ogvwatchnew"), null); 32 | Assert.True(res.Code == 0); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /test/BiliAgentTest/BiliAgentTest.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | net8.0 4 | enable 5 | false 6 | a6e5b261-0fe9-49e1-82e1-02349db119b4 7 | 8 | 9 | 10 | 11 | 12 | runtime; build; native; contentfiles; analyzers; buildtransitive 13 | all 14 | 15 | 16 | runtime; build; native; contentfiles; analyzers; buildtransitive 17 | all 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /test/BiliAgentTest/LiveTraceApiTest.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.DependencyInjection; 2 | using Ray.BiliBiliTool.Agent; 3 | using Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos; 4 | using Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos.Live; 5 | using Ray.BiliBiliTool.Agent.BiliBiliAgent.Interfaces; 6 | using Ray.BiliBiliTool.Console; 7 | using Ray.BiliBiliTool.Infrastructure; 8 | using Ray.BiliBiliTool.Infrastructure.Cookie; 9 | using Xunit; 10 | 11 | namespace BiliAgentTest 12 | { 13 | public class LiveTraceApiTest 14 | { 15 | public LiveTraceApiTest() 16 | { 17 | Program.CreateHost(new[] { "--ENVIRONMENT=Development" }); 18 | } 19 | 20 | [Fact] 21 | public void WebHeartBeat_Normal_Success() 22 | { 23 | using var scope = Global.ServiceProviderRoot.CreateScope(); 24 | 25 | var ck = scope.ServiceProvider.GetRequiredService>(); 26 | var api = scope.ServiceProvider.GetRequiredService(); 27 | 28 | var request = new WebHeartBeatRequest(63666, 60); 29 | 30 | var re = api.WebHeartBeat(request, null).Result; 31 | 32 | Assert.Equal(0, re.Code); 33 | Assert.Equal("0", re.Message); 34 | Assert.Equal(60, re.Data.Next_interval); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /test/ConfigTest/ConfigTest.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | net8.0 4 | false 5 | 6 | 7 | 8 | 9 | 10 | all 11 | runtime; build; native; contentfiles; analyzers; buildtransitive 12 | 13 | 14 | all 15 | runtime; build; native; contentfiles; analyzers; buildtransitive 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /test/ConfigTest/TestDefaultValue.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Text.Json; 5 | using Microsoft.Extensions.DependencyInjection; 6 | using Microsoft.Extensions.Hosting; 7 | using Microsoft.Extensions.Options; 8 | using Ray.BiliBiliTool.Config; 9 | using Ray.BiliBiliTool.Config.Options; 10 | using Ray.BiliBiliTool.Console; 11 | using Ray.BiliBiliTool.Infrastructure; 12 | using Xunit; 13 | 14 | namespace ConfigTest 15 | { 16 | public class TestDefaultValue 17 | { 18 | public TestDefaultValue() 19 | { 20 | Program.CreateHost(null); 21 | } 22 | 23 | [Fact] 24 | public void Test1() 25 | { 26 | using var scope = Global.ServiceProviderRoot.CreateScope(); 27 | 28 | var options = scope.ServiceProvider.GetRequiredService< 29 | IOptionsMonitor 30 | >(); 31 | var re = options.CurrentValue.ChargeComment; 32 | Debug.WriteLine(re); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /test/DomainServiceTest/ArticleDomainServiceTest.cs: -------------------------------------------------------------------------------- 1 | using Xunit.Abstractions; 2 | 3 | namespace DomainServiceTest; 4 | 5 | public class ArticleDomainServiceTest 6 | { 7 | private readonly ITestOutputHelper _output; 8 | 9 | public ArticleDomainServiceTest(ITestOutputHelper output) 10 | { 11 | _output = output; 12 | Program.CreateHost(new[] { "--ENVIRONMENT=Development" }); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /test/DomainServiceTest/DomainServiceTest.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net8.0 4 | enable 5 | enable 6 | false 7 | 8 | 9 | 10 | 11 | 12 | runtime; build; native; contentfiles; analyzers; buildtransitive 13 | all 14 | 15 | 16 | runtime; build; native; contentfiles; analyzers; buildtransitive 17 | all 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /test/DomainServiceTest/DonateCoinDomainServiceTest.cs: -------------------------------------------------------------------------------- 1 | namespace DomainServiceTest; 2 | 3 | public class DonateCoinDomainServiceTest 4 | { 5 | public DonateCoinDomainServiceTest() 6 | { 7 | Program.CreateHost(new[] { "--ENVIRONMENT=Development" }); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/DomainServiceTest/Usings.cs: -------------------------------------------------------------------------------- 1 | global using Microsoft.Extensions.DependencyInjection; 2 | global using Ray.BiliBiliTool.Console; 3 | global using Ray.BiliBiliTool.DomainService.Interfaces; 4 | global using Ray.BiliBiliTool.Infrastructure; 5 | global using Xunit; 6 | -------------------------------------------------------------------------------- /test/DomainServiceTest/VideoDomainServiceTest.cs: -------------------------------------------------------------------------------- 1 | using Ray.BiliBiliTool.Infrastructure.Helpers; 2 | using Ray.Infrastructure.Helpers; 3 | 4 | namespace DomainServiceTest 5 | { 6 | public class VideoDomainServiceTest 7 | { 8 | public VideoDomainServiceTest() 9 | { 10 | Program.CreateHost(new[] { "--ENVIRONMENT=Development" }); 11 | } 12 | 13 | [Fact] 14 | public async Task GetVideoCountOfUp_Test() 15 | { 16 | using var scope = Global.ServiceProviderRoot.CreateScope(); 17 | var config = Global.ConfigurationRoot; 18 | var domainService = scope.ServiceProvider.GetRequiredService(); 19 | 20 | await domainService.GetVideoCountOfUp(1585227649, null); 21 | } 22 | 23 | [Fact] 24 | public async Task GetRandomVideoOfUp_Test() 25 | { 26 | using var scope = Global.ServiceProviderRoot.CreateScope(); 27 | var config = Global.ConfigurationRoot; 28 | var domainService = scope.ServiceProvider.GetRequiredService(); 29 | 30 | await domainService.GetRandomVideoOfUp(1585227649, 1, null); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /test/InfrastructureTest/InfrastructureTest.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net8.0 4 | enable 5 | enable 6 | false 7 | true 8 | 9 | 10 | 11 | 12 | 13 | runtime; build; native; contentfiles; analyzers; buildtransitive 14 | all 15 | 16 | 17 | runtime; build; native; contentfiles; analyzers; buildtransitive 18 | all 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /test/InfrastructureTest/Usings.cs: -------------------------------------------------------------------------------- 1 | global using Xunit; 2 | -------------------------------------------------------------------------------- /test/InfrastructureTest/WbiHelperTest.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using System.Text.RegularExpressions; 3 | 4 | namespace InfrastructureTest 5 | { 6 | public class WbiHelperTest 7 | { 8 | [Fact] 9 | public void Replace_Test() 10 | { 11 | string input = "����һ�ΰ��������ַ�!@#$%^&*(')���ַ���"; 12 | string pattern = "[!'()*]"; 13 | string replacement = ""; 14 | 15 | string output = Regex.Replace(input, pattern, replacement); 16 | Debug.WriteLine(output); 17 | 18 | Assert.Equal("����һ�ΰ��������ַ�@#$%^&���ַ���", output); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/LogTest/LogTest.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | net8.0 4 | false 5 | 5bc79f80-380e-4bcf-9c0b-30e98db3b935 6 | 7 | 8 | 9 | 10 | 11 | all 12 | runtime; build; native; contentfiles; analyzers; buildtransitive 13 | 14 | 15 | all 16 | runtime; build; native; contentfiles; analyzers; buildtransitive 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /test/LogTest/TestDingTalk.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Threading; 4 | using Microsoft.Extensions.DependencyInjection; 5 | using Microsoft.Extensions.Logging; 6 | using Ray.BiliBiliTool.Console; 7 | using Ray.BiliBiliTool.Infrastructure; 8 | using Ray.Serilog.Sinks.DingTalkBatched; 9 | using Ray.Serilog.Sinks.TelegramBatched; 10 | using Ray.Serilog.Sinks.WorkWeiXinBatched; 11 | //using Serilog; 12 | using Xunit; 13 | 14 | namespace LogTest 15 | { 16 | public class TestDingTalk 17 | { 18 | private string _key; 19 | 20 | public TestDingTalk() 21 | { 22 | Environment.SetEnvironmentVariable("ASPNETCORE_ENVIRONMENT", "Development"); 23 | Program.CreateHost(new string[] { "ENVIRONMENT=Development" }); 24 | 25 | _key = Global.ConfigurationRoot["Serilog:WriteTo:5:Args:webHookUrl"]; 26 | } 27 | 28 | [Fact] 29 | public void Test2() 30 | { 31 | var client = new DingTalkApiClient(_key); 32 | 33 | var title = "这是标题"; 34 | var msg = LogConstants.Msg2 + "开始推送"; 35 | 36 | var result = client.PushMessage(msg, title); 37 | Debug.WriteLine(result.Content.ReadAsStringAsync().Result); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /test/LogTest/TestWorkWeiXin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Threading; 4 | using Microsoft.Extensions.DependencyInjection; 5 | using Microsoft.Extensions.Logging; 6 | using Ray.BiliBiliTool.Console; 7 | using Ray.BiliBiliTool.Infrastructure; 8 | using Ray.Serilog.Sinks.WorkWeiXinBatched; 9 | using Xunit; 10 | 11 | namespace LogTest 12 | { 13 | public class TestWorkWeiXin 14 | { 15 | private string _key; 16 | 17 | public TestWorkWeiXin() 18 | { 19 | Environment.SetEnvironmentVariable("DOTNET_ENVIRONMENT", "Development"); 20 | Program.CreateHost(new string[] { "ENVIRONMENT=Development" }); 21 | 22 | _key = Global.ConfigurationRoot["Serilog:WriteTo:4:Args:webHookUrl"]; 23 | } 24 | 25 | [Fact] 26 | public void Test2() 27 | { 28 | var client = new WorkWeiXinApiClient(_key); 29 | 30 | //string msg = LogConstants.Msg; 31 | string msg = LogConstants.Msg2; 32 | 33 | var result = client.PushMessage(msg); 34 | Debug.WriteLine(result.Content.ReadAsStringAsync().Result); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /test/Ray.BiliBiliTool.Agent.FunctionalTests/AccountApiTests.cs: -------------------------------------------------------------------------------- 1 | using FluentAssertions; 2 | using Microsoft.Extensions.DependencyInjection; 3 | using Microsoft.Extensions.Hosting; 4 | using Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos; 5 | using Ray.BiliBiliTool.Agent.BiliBiliAgent.Interfaces; 6 | using Ray.BiliBiliTool.Console; 7 | 8 | namespace Ray.BiliBiliTool.Agent.FunctionalTests; 9 | 10 | public class AccountApiTests 11 | { 12 | private readonly IAccountApi _api; 13 | 14 | public AccountApiTests() 15 | { 16 | var envs = new List 17 | { 18 | "--ENVIRONMENT=Development", 19 | //"HTTP_PROXY=localhost:8888", 20 | //"HTTPS_PROXY=localhost:8888" 21 | }; 22 | IHost host = Program.CreateHost(envs.ToArray()); 23 | _api = host.Services.GetRequiredService(); 24 | } 25 | 26 | [Fact] 27 | public async Task GetCoinBalance_Normal_GetCoinBalance() 28 | { 29 | // Act 30 | BiliApiResponse re = await _api.GetCoinBalanceAsync(null); 31 | 32 | // Arrange 33 | 34 | // Assert 35 | re.Code.Should().Be(0); 36 | re.Data.Money.Should().IsNotNull(); 37 | } 38 | } 39 | --------------------------------------------------------------------------------