summaryrefslogtreecommitdiff
path: root/src/extractors/bilibili.h
blob: 2a2170757b2f52e7e7049de23f0262c4fc619f92 (plain)
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
#ifndef BILIBILI_H_
#define BILIBILI_H_

#include <stddef.h>

#include "../utils/types.h"
#include "extractor.h"

#define BILIBILI_API "https://api.bilibili.com/x/player/playurl?"
#define BILIBILI_BANGUMI_API "https://api.bilibili.com/pgc/player/web/playurl?"
#define BILIBILI_TOKEN_API "https://api.bilibili.com/x/player/playurl/token?"

typedef struct video_pages_data {
  int cid;
  char *part;
  int page;
} Video_pages_data;

typedef struct multipage_video_data {
  char *title;
  generic_array_t pages;
} Multipage_video_data;

typedef struct episode {
  int aid;
  char *bvid;
  int cid;
  char *title;
} Episode;

typedef struct multi_episode_data {
  int season_id;
  generic_array_t episodes;
} Multi_episode_data;

typedef struct multipage {
  int aid;
  char *bvid;
  generic_array_t sections;
  Multipage_video_data videoData;
  cJSON *json;
} Multipage;

typedef struct bilibili_options {
  char *url;
  char *html;
  char *api;
  char *cookie;
  bool is_bangumi;
  bool is_page;
  int aid;
  int cid;
  char *bvid;
  int page;
  char *title;
} Bilibili_options;

typedef struct durl {
  char *url;
  size_t size;
} Durl;

typedef struct dash_stream {
  int id;
  char *baseUrl;
  int bandwidth;
  char *mimeType;
  int codecid;
  char *codecs;
} Dash_stream;

typedef struct dash_streams {
  generic_array_t video;
  generic_array_t audio;
} Dash_streams;

typedef struct dash_info {
  int quality;
  str_array_t accept_description;
  generic_array_t accept_quality;
  Dash_streams dash;
  char *format;
  generic_array_t durl;
} Dash_info;

typedef struct dash {
  int code;
  char *message;
  Dash_info dashinfo;
  cJSON *json;
} Dash;

void bilibili_extract(struct options *);

#endif