bpi-rs 0.1.3

Bilibili API client library for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
//! 番剧基本信息
//!
//! [查看 API 文档](https://github.com/Yuelioi/bilibili-API-collect/tree/cfc5fddcc8a94b74d91970bb5b4eaeb349addc47/docs/bangumi/info.md)
use crate::models::VipLabel;
use crate::{ BilibiliRequest, BpiClient, BpiError, BpiResponse };
use serde::{ Deserialize, Serialize };

/// 剧集地区
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum BangumiArea {
    /// 中国大陆
    MainlandChina = 1,
    /// 日本
    Japan = 2,
    /// 美国
    UnitedStates = 3,
    /// 英国
    UnitedKingdom = 4,
    /// 加拿大
    Canada = 5,
    /// 中国香港
    HongKong = 6,
    /// 中国台湾
    Taiwan = 7,
    /// 韩国
    SouthKorea = 8,
    /// 法国
    France = 9,
    /// 泰国
    Thailand = 10,
    /// 马来西亚
    Malaysia = 11,
    /// 新加坡
    Singapore = 12,
    /// 西班牙
    Spain = 13,
    /// 俄罗斯
    Russia = 14,
    /// 德国
    Germany = 15,
    /// 其他
    Other = 16,
    /// 丹麦
    Denmark = 17,
    /// 乌克兰
    Ukraine = 18,
    /// 以色列
    Israel = 19,
    /// 伊朗
    Iran = 20,
    /// 保加利亚
    Bulgaria = 21,
    /// 克罗地亚
    Croatia = 22,
    /// 冰岛
    Iceland = 23,
    /// 匈牙利
    Hungary = 24,
    /// 南非
    SouthAfrica = 25,
    /// 印尼
    Indonesia = 26,
    /// 印度
    India = 27,
    /// 哥伦比亚
    Colombia = 28,
    /// 土耳其
    Turkey = 30,
    /// 墨西哥
    Mexico = 31,
    /// 委内瑞拉
    Venezuela = 32,
    /// 巴西
    Brazil = 33,
    /// 希腊
    Greece = 34,
    /// 意大利
    Italy = 35,
    /// 挪威
    Norway = 36,
    /// 捷克
    CzechRepublic = 37,
    /// 摩洛哥
    Morocco = 38,
    /// 新西兰
    NewZealand = 39,
    /// 智利
    Chile = 40,
    /// 比利时
    Belgium = 41,
    /// 波兰
    Poland = 42,
    /// 澳大利亚
    Australia = 43,
    /// 爱尔兰
    Ireland = 44,
    /// 瑞典
    Sweden = 45,
    /// 瑞士
    Switzerland = 46,
    /// 芬兰
    Finland = 47,
    /// 苏联
    SovietUnion = 48,
    /// 荷兰
    Netherlands = 49,
    /// 越南
    Vietnam = 50,
    /// 阿根廷
    Argentina = 51,
    /// 马耳他
    Malta = 52,
    /// 古巴
    Cuba = 53,
    /// 菲律宾
    Philippines = 54,
    /// 哈萨克斯坦
    Kazakhstan = 55,
    /// 黎巴嫩
    Lebanon = 56,
    /// 塞浦路斯
    Cyprus = 57,
    /// 卡塔尔
    Qatar = 58,
    /// 阿联酋
    UnitedArabEmirates = 59,
    /// 奥地利
    Austria = 60,
    /// 西德
    WestGermany = 61,
    /// 卢森堡
    Luxembourg = 62,
    /// 罗马尼亚
    Romania = 63,
    /// 印度尼西亚
    Indonesia2 = 64,
    /// 南斯拉夫
    Yugoslavia = 65,
    /// 蒙古
    Mongolia = 66,
    /// 葡萄牙
    Portugal = 70,
}

impl BangumiArea {
    pub fn as_u32(self) -> u32 {
        self as u32
    }
}

/// 剧集类型
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum BangumiType {
    /// 番剧
    Anime = 1,
    /// 电影
    Movie = 2,
    /// 纪录片
    Documentary = 3,
    /// 国创
    ChineseAnimation = 4,
    /// 电视剧
    TVSeries = 5,
    /// 漫画
    Manga = 6,
    /// 综艺
    Variety = 7,
}

impl BangumiType {
    pub fn as_u32(self) -> u32 {
        self as u32
    }
}

/// 剧集基本信息(mdid方式)响应
pub type BangumiInfoResponse = BpiResponse<BangumiInfoResult>;

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiInfoResult {
    pub media: BangumiMedia,
    pub review: Option<BangumiReview>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiMedia {
    pub areas: Vec<BangumiAreaInfo>,
    pub cover: String,
    pub horizontal_picture: String,
    pub media_id: u64,
    pub new_ep: BangumiMediaNewEp,
    pub rating: BangumiRating,
    pub season_id: u64,
    pub share_url: String,
    pub title: String,
    pub r#type: u32,
    pub type_name: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiAreaInfo {
    pub id: u32,
    pub name: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiMediaNewEp {
    pub id: u64,
    pub index: String,
    pub index_show: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiDetailNewEp {
    pub id: u64,
    pub desc: String,
    pub is_new: u32,
    pub title: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiRating {
    pub count: u64,
    pub score: f64,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiReview {
    pub is_coin: u32,
    pub is_open: u32,
}

/// 获取剧集明细(web端)响应
pub type BangumiDetailResponse = BpiResponse<BangumiDetailResult>;

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiDetailResult {
    pub activity: Option<BangumiActivity>,
    pub actors: String,
    pub alias: String,
    pub areas: Vec<BangumiAreaInfo>,
    pub bkg_cover: String,
    pub cover: String,
    pub delivery_fragment_video: bool,
    pub enable_vt: bool,
    pub episodes: Vec<BangumiEpisode>,
    pub evaluate: String,
    pub freya: Option<BangumiFreya>,
    pub hide_ep_vv_vt_dm: u32,
    pub icon_font: Option<BangumiIconFont>,
    pub jp_title: String,
    pub link: String,
    pub media_id: u64,
    pub mode: u32,
    pub multi_view_info: Option<BangumiMultiViewInfo>,
    pub new_ep: BangumiDetailNewEp,
    pub payment: Option<BangumiPayment>,
    #[serde(rename = "payPack")]
    pub pay_pack: Option<BangumiPayPack>,
    pub play_strategy: Option<BangumiPlayStrategy>,
    pub positive: Option<BangumiPositive>,
    pub publish: BangumiPublish,
    pub rating: Option<BangumiRating>,
    pub record: String,
    pub rights: BangumiRights,
    pub season_id: u64,
    pub season_title: String,
    pub seasons: Vec<BangumiSeason>,
    pub section: Option<Vec<BangumiSection>>,
    pub section_bottom_desc: Option<String>,
    pub series: Option<BangumiSeries>,
    pub share_copy: String,
    pub share_sub_title: String,
    pub share_url: String,
    pub show: Option<BangumiShow>,
    pub show_season_type: u32,
    pub square_cover: String,
    pub staff: String,
    pub stat: BangumiStat,
    pub status: u32,
    pub styles: Vec<String>,
    pub subtitle: String,
    pub title: String,
    pub total: u32,
    pub r#type: u32,
    pub up_info: Option<BangumiUpInfo>,
    pub user_status: Option<BangumiUserStatus>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiActivity {
    pub head_bg_url: String,
    pub id: u64,
    pub title: String,
    pub link: Option<String>,
    pub pendants: Option<Vec<BangumiPendant>>,
    pub cover: Option<String>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiPendant {
    pub image: String,
    pub name: String,
    pub pid: u64,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiEpisode {
    pub aid: u64,
    pub badge: String,
    pub badge_info: Option<BangumiBadgeInfo>,
    pub badge_type: u32,
    pub bvid: String,
    pub cid: u64,
    pub cover: String,
    pub dimension: Option<BangumiDimension>,
    pub duration: u64,
    pub enable_vt: bool,
    pub ep_id: u64,
    pub from: String,
    pub id: u64,
    pub interaction: Option<BangumiInteraction>,
    pub is_view_hide: bool,
    pub link: String,
    pub long_title: String,
    pub multi_view_eps: Option<Vec<BangumiMultiViewEp>>,
    pub pub_time: u64,
    pub pv: u64,
    pub release_date: String,
    pub rights: Option<BangumiEpisodeRights>,
    pub section_type: u32,
    pub share_copy: String,
    pub share_url: String,
    pub short_link: String,
    pub show_title: String,
    #[serde(rename = "showDrmLoginDialog")]
    pub show_drm_login_dialog: bool,
    pub skip: Option<BangumiSkip>,
    pub status: u32,
    pub subtitle: String,
    pub title: String,
    pub vid: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiBadgeInfo {
    pub bg_color: String,
    pub bg_color_night: String,
    pub text: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiDimension {
    pub height: u32,
    pub rotate: u32,
    pub width: u32,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiInteraction {
    pub graph_version: u32,
    pub interaction: bool,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiMultiViewEp {
    pub ep_id: u64,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiEpisodeRights {
    pub allow_dm: u32,
    pub allow_download: u32,
    pub area_limit: u32,

    pub allow_demand: Option<u32>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiSkip {
    pub ed: Option<BangumiSkipTime>,
    pub op: Option<BangumiSkipTime>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiSkipTime {
    pub end: u32,
    pub start: u32,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiFreya {
    pub bubble_desc: String,
    pub bubble_show_cnt: u32,
    pub icon_show: u32,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiIconFont {
    pub name: String,
    pub text: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiMultiViewInfo {
    pub changing_dance: String,
    pub is_multi_view_season: bool,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiPayment {
    pub discount: u32,
    pub pay_type: BangumiPayType,
    pub price: String,
    pub promotion: String,
    pub tip: String,
    pub view_start_time: u64,
    pub vip_discount: u32,
    pub vip_first_promotion: String,
    pub vip_price: String,
    pub vip_promotion: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiPayType {
    pub allow_discount: u32,
    pub allow_pack: u32,
    pub allow_ticket: u32,
    pub allow_time_limit: u32,
    pub allow_vip_discount: u32,
    pub forbid_bb: u32,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiPayPack {
    pub id: u64,
    pub not_paid_text_for_app: String,
    pub paid_text_for_app: String,
    pub pay_pack_url: String,
    pub status: u32,
    pub title: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiPlayStrategy {
    pub strategies: Vec<serde_json::Value>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiPositive {
    pub id: u64,
    pub title: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiPublish {
    pub is_finish: u32,
    pub is_started: u32,
    pub pub_time: String,
    pub pub_time_show: String,
    pub unknow_pub_date: u32,
    pub weekday: u32,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiRights {
    pub allow_bp: u32,
    pub allow_bp_rank: u32,
    pub allow_download: u32,
    pub allow_review: u32,
    pub area_limit: u32,
    pub ban_area_show: u32,
    pub can_watch: u32,
    pub copyright: String,
    pub forbid_pre: u32,
    pub freya_white: u32,
    pub is_cover_show: u32,
    pub is_preview: u32,
    pub only_vip_download: u32,
    pub resource: String,
    pub watch_platform: u32,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiSeason {
    pub badge: String,
    pub badge_info: Option<BangumiBadgeInfo>,
    pub badge_type: u32,
    pub cover: String,
    pub enable_vt: bool,
    pub horizontal_cover_1610: String,
    pub horizontal_cover_169: String,
    pub icon_font: Option<BangumiIconFont>,
    pub media_id: u64,
    pub new_ep: Option<BangumiSeasonNewEp>,
    pub season_id: u64,
    pub season_title: String,
    pub season_type: u32,
    pub stat: Option<BangumiSeasonStat>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiSeasonNewEp {
    pub cover: String,
    pub id: u64,
    pub index_show: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiSeasonStat {
    pub favorites: u64,
    pub series_follow: u64,
    pub views: u64,
    pub vt: u64,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiSection {
    pub attr: u32,
    pub episode_id: u64,
    pub episode_ids: Vec<u64>,
    pub episodes: Vec<BangumiSectionEpisode>,
    pub id: u64,
    pub report: Option<BangumiReport>,
    pub title: String,
    pub r#type: u32,
    pub type2: u32,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiSectionEpisode {
    pub aid: u64,
    pub archive_attr: Option<u32>,
    pub badge: String,
    pub badge_info: Option<BangumiBadgeInfo>,
    pub badge_type: u32,
    pub bvid: String,
    pub cid: u64,
    pub cover: String,
    pub dimension: Option<BangumiDimension>,
    pub duration: u64,
    pub enable_vt: bool,
    pub ep_id: u64,
    pub from: String,
    pub icon_font: Option<BangumiIconFont>,
    pub id: u64,
    pub interaction: Option<BangumiInteraction>,
    pub is_view_hide: bool,
    pub link: String,
    pub link_type: String,
    pub long_title: String,
    pub pub_time: u64,
    pub pv: u64,
    pub release_date: String,
    pub report: Option<BangumiReport>,
    pub rights: Option<BangumiEpisodeRights>,
    pub section_type: u32,
    pub share_copy: String,
    pub share_url: String,
    pub short_link: String,
    pub show_title: String,
    #[serde(rename = "showDrmLoginDialog")]
    pub show_drm_login_dialog: bool,
    pub skip: Option<BangumiSkip>,
    pub stat: Option<BangumiStat>,
    pub stat_for_unity: Option<BangumiStatForUnity>,
    pub status: u32,
    pub subtitle: String,
    pub title: String,
    pub toast_title: String,
    pub up_info: Option<BangumiUpInfo>,
    pub vid: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiReport {
    pub aid: String,
    pub ep_title: String,
    pub position: String,
    pub season_id: String,
    pub season_type: String,
    pub section_id: String,
    pub section_type: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiStatForUnity {
    pub coin: u64,
    pub danmaku: Option<BangumiDanmaku>,
    pub likes: u64,
    pub reply: u64,
    pub vt: Option<BangumiVt>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiDanmaku {
    pub icon: String,
    pub pure_text: String,
    pub text: String,
    pub value: u64,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiVt {
    pub icon: String,
    pub pure_text: String,
    pub text: String,
    pub value: u64,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiStat {
    pub coins: u64,
    pub danmakus: u64,
    pub favorite: u64,
    pub favorites: u64,
    pub follow_text: String,
    pub hot: Option<u64>,
    pub likes: u64,
    pub reply: u64,
    pub share: u64,
    pub views: u64,
    pub vt: u64,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiSeries {
    pub display_type: u32,
    pub series_id: u64,
    pub series_title: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiShow {
    pub wide_screen: u32,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiUpInfo {
    pub avatar: String,
    pub avatar_subscript_url: String,
    pub follower: u64,
    pub is_follow: u32,
    pub mid: u64,
    pub nickname_color: String,
    pub pendant: Option<BangumiPendant>,
    pub theme_type: u32,
    pub uname: String,
    pub verify_type: u32,
    pub vip_label: Option<VipLabel>,
    pub vip_status: u32,
    pub vip_type: u32,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiUserStatus {
    pub area_limit: u32,
    pub ban_area_show: u32,
    pub follow: u32,
    pub follow_status: u32,
    pub login: u32,
    pub pay: u32,
    pub pay_pack_paid: u32,
    pub sponsor: u32,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiSectionResult {
    pub main_section: BangumiMainSection,
    pub section: Vec<BangumiMainSection>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiMainSection {
    pub episodes: Vec<BangumiSectionEpisodeInfo>,
    pub id: u64,
    pub r#type: u32,
    pub title: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BangumiSectionEpisodeInfo {
    pub aid: u64,
    pub badge: String,
    pub badge_info: BangumiBadgeInfo,
    pub badge_type: u32,
    pub cid: u64,
    pub cover: String,
    pub from: String,
    pub id: u64,
    pub is_premiere: u32,
    pub long_title: String,
    pub share_url: String,
    pub status: u32,
    pub title: String,
    pub vid: String,
}

impl BpiClient {
    /// 获取剧集基本信息(mdid方式)
    ///
    /// # 参数
    /// * `media_id` - 剧集mdid
    ///
    /// # 文档
    /// [剧集基本信息(mdid方式)](https://github.com/Yuelioi/bilibili-API-collect/tree/cfc5fddcc8a94b74d91970bb5b4eaeb349addc47/docs/bangumi/info.md#剧集基本信息mdid方式)
    pub async fn bangumi_info(&self, media_id: u64) -> Result<BangumiInfoResponse, BpiError> {
        let result: BangumiInfoResponse = self
            .get("https://api.bilibili.com/pgc/review/user")
            .query(&[("media_id", media_id.to_string())])
            .send_bpi("获取剧集基本信息").await?;
        Ok(result)
    }

    /// 获取剧集明细(web端)(ssid方式)
    ///
    /// # 参数
    /// * `season_id` - 番剧ssid
    ///
    /// # 文档
    /// [获取剧集明细(web端)(ssid/epid方式)](https://github.com/Yuelioi/bilibili-API-collect/tree/cfc5fddcc8a94b74d91970bb5b4eaeb349addc47/docs/bangumi/info.md#获取剧集明细web端ssidepid方式)
    pub async fn bangumi_detail_by_season_id(
        &self,
        season_id: u64
    ) -> Result<BangumiDetailResponse, BpiError> {
        let result: BangumiDetailResponse = self
            .get("https://api.bilibili.com/pgc/view/web/season")
            .query(&[("season_id", season_id.to_string())])
            .send_bpi("获取剧集明细").await?;
        Ok(result)
    }

    /// 获取剧集明细(web端)(epid方式)
    ///
    /// # 参数
    /// * `ep_id` - 剧集epid
    ///
    /// # 文档
    /// [获取剧集明细(web端)(ssid/epid方式)](https://github.com/Yuelioi/bilibili-API-collect/tree/cfc5fddcc8a94b74d91970bb5b4eaeb349addc47/docs/bangumi/info.md#获取剧集明细web端ssidepid方式)
    pub async fn bangumi_detail_by_epid(
        &self,
        ep_id: u64
    ) -> Result<BangumiDetailResponse, BpiError> {
        self
            .get("https://api.bilibili.com/pgc/view/web/season")
            .query(&[("ep_id", ep_id.to_string())])
            .send_bpi("获取剧集明细").await
    }

    /// 获取剧集分集信息
    ///
    /// # 参数
    /// * `season_id` - 剧集ssid
    ///
    /// # 文档
    /// [获取剧集明细(web端)(ssid/epid方式)](https://github.com/Yuelioi/bilibili-API-collect/tree/cfc5fddcc8a94b74d91970bb5b4eaeb349addc47/docs/bangumi/info.md#获取剧集分集信息)
    pub async fn bangumi_sections_by_season_id(
        &self,
        season_id: u64
    ) -> Result<BpiResponse<BangumiSectionResult>, BpiError> {
        self
            .get("https://api.bilibili.com/pgc/web/season/section")
            .query(&[("season_id", season_id.to_string())])
            .send_bpi("获取剧集分集信息").await
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    const TEST_SEASON_ID: u64 = 1172; // ssid
    const TEST_EP_ID: u64 = 21265; // epid
    const TEST_MEDIA_ID: u64 = 28220978; //  mdid

    #[tokio::test]
    async fn test_bangumi_info() -> Result<(), Box<BpiError>> {
        let bpi = BpiClient::new();
        let result = bpi.bangumi_info(TEST_MEDIA_ID).await?;
        let data = result.into_data()?;
        tracing::info!("{:#?}", data);

        assert_eq!(data.media.media_id, TEST_MEDIA_ID);
        assert!(!data.media.title.is_empty());
        assert!(!data.media.areas.is_empty());

        Ok(())
    }

    #[tokio::test]
    async fn test_bangumi_detail_by_season_id() -> Result<(), Box<BpiError>> {
        let bpi = BpiClient::new();
        let result = bpi.bangumi_detail_by_season_id(TEST_SEASON_ID).await?;
        let data = result.into_data()?;
        tracing::info!("{:#?}", data);

        assert_eq!(data.season_id, TEST_SEASON_ID);
        assert!(!data.title.is_empty());
        assert!(!data.episodes.is_empty());

        Ok(())
    }

    #[tokio::test]
    async fn test_bangumi_detail_by_epid() -> Result<(), Box<BpiError>> {
        let bpi = BpiClient::new();
        let result = bpi.bangumi_detail_by_epid(TEST_EP_ID).await?;
        let data = result.into_data()?;
        tracing::info!("{:#?}", data);

        assert!(!data.title.is_empty());
        assert!(!data.episodes.is_empty());

        Ok(())
    }

    #[tokio::test]
    async fn test_bangumi_section() -> Result<(), Box<BpiError>> {
        let bpi = BpiClient::new();
        let result = bpi.bangumi_sections_by_season_id(TEST_SEASON_ID).await?;
        let data = result.into_data()?;
        tracing::info!("{:#?}", data);

        assert!(!data.main_section.episodes.is_empty());

        Ok(())
    }
}