准备工作

安装Redis:

apt-get install redis -y

源码部署

cd /opt #切换目录
apt-get install git cargo screen -y #安装环境
git clone https://github.com/pchpub/BiliRoaming-Rust-Server && cd BiliRoaming-Rust-Server
cargo build --profile=fast
cp -Rf ./target/fast/biliroaming_rust_server /opt/BiliRoaming-Rust-Server
chmod +x /opt/BiliRoaming-Rust-Server/biliroaming_rust_server

从Action下载

Action下载最新版,并且解压zip压缩包
移动到/opt/BiliRoaming-Rust-Server目录下并给予执行权限

配置文件

下面是一个配置模板

{
  "config_version": 4,
  "redis": "redis://127.0.0.1:6379", //Redis地址
  "worker_num": 8, //线程
  "http_port": 2662,  //http运行端口
  "https_port": 2663, //https运行端口
  "https_support": false, // https开关
  "http2https_support": false, // http2开关
  "limit_biliroaming_version_open": false, //限制哔哩漫游版本
  "limit_biliroaming_version_min": 64, //最小版本
  "limit_biliroaming_version_max": 80, //最大版本
  "rate_limit_per_second": 999, //每秒速率限制
  "rate_limit_burst": 999, //速率限制突发
  "cn_app_playurl_api": "https://api.bilibili.com/pgc/player/api/playurl",
  "tw_app_playurl_api": "https://api.bilibili.com/pgc/player/api/playurl",
  "hk_app_playurl_api": "https://api.bilibili.com/pgc/player/api/playurl",
  "th_app_playurl_api": "https://app.biliintl.com/intl/gateway/v2/ogv/playurl",
  "cn_web_playurl_api": "https://api.bilibili.com/pgc/player/web/playurl",
  "tw_web_playurl_api": "https://api.bilibili.com/pgc/player/web/playurl",
  "hk_web_playurl_api": "https://api.bilibili.com/pgc/player/web/playurl",
  "th_web_playurl_api": "https://app.biliintl.com/intl/gateway/v2/ogv/playurl",
  "cn_app_search_api": "https://app.bilibili.com/x/v2/search/type",
  "tw_app_search_api": "https://app.bilibili.com/x/v2/search/type",
  "hk_app_search_api": "https://app.bilibili.com/x/v2/search/type",
  "th_app_search_api": "https://app.biliintl.com/intl/gateway/v2/app/search/type",
  "cn_web_search_api": "https://api.bilibili.com/x/web-interface/search/type",
  "tw_web_search_api": "https://api.bilibili.com/x/web-interface/search/type",
  "hk_web_search_api": "https://api.bilibili.com/x/web-interface/search/type",
  "th_web_search_api": "https://app.biliintl.com/intl/gateway/v2/app/search/type",
  "th_app_season_api": "https://app.biliintl.com/intl/gateway/v2/ogv/view/app/season",
  "th_app_season_sub_api": "https://示例.永雏塔菲.我爱你/?season_id=", //东南亚区字幕组api
  "th_app_season_sub_name": "示例永雏塔菲字幕组", //字幕组名字
  "th_app_season_sub_open": false, //开关自定义字幕组
  "cn_proxy_playurl_url": "127.0.0.1:50003", //大陆视频请求代理
  "hk_proxy_playurl_url": "127.0.0.1:50000", //港澳台视频请求代理
  "tw_proxy_playurl_url": "127.0.0.1:50001", //台湾视频请求代理
  "th_proxy_playurl_url": "127.0.0.1:50002", //东南亚视频请求代理
  "cn_proxy_playurl_open": true, //视频请求代理开关
  "hk_proxy_playurl_open": true,
  "tw_proxy_playurl_open": true,
  "th_proxy_playurl_open": true,
  "cn_proxy_search_url": "127.0.0.1:50003", //大陆搜索代理
  "hk_proxy_search_url": "127.0.0.1:50000", //港澳台搜索代理
  "tw_proxy_search_url": "127.0.0.1:50001", //台湾搜索代理
  "th_proxy_search_url": "127.0.0.1:50002", //东南亚搜索代理
  "cn_proxy_search_open": true, //搜索代理开关
  "hk_proxy_search_open": true,
  "tw_proxy_search_open": true,
  "th_proxy_search_open": true,
  "cn_proxy_token_url": "127.0.0.1:50003", //大陆token代理
  "th_proxy_token_url": "127.0.0.1:50002", //东南亚token代理
  "cn_proxy_token_open": true,  //大陆token开关
  "th_proxy_token_open": true,  //东南亚的
  "cn_proxy_accesskey_url": "",  //大陆accesskey替换
  "cn_proxy_accesskey_open": false,
  "th_proxy_subtitle_url": "127.0.0.1:50002", //东南亚字幕代理
  "th_proxy_subtitle_open": true, //开关
  "general_api_bilibili_com_proxy_api": "api.bilibili.com",
  "general_app_bilibili_com_proxy_api": "app.bilibili.com",
  "aid": 127001, //东南亚视频评论区替换aid
  "aid_replace_open": true,  //开关
  "resign_pub": {
    "1": false,
    "4": false,
    "2": false,
    "3": false
  },
  "resign_open": {
    "2": false,
    "3": false,
    "1": false,
    "4": false
  },
  "resign_from_existed_key": false,
  "resign_from_api_open": {
    "4": false,
    "2": false,
    "1": false,
    "3": false
  },
  "resign_api": {
    "3": "",
    "2": "",
    "4": "",
    "1": ""
  },
  "resign_api_sign": {
    "2": "",
    "1": "",
    "4": "",
    "3": ""
  },
  "cache": { //缓存
    "0": 6480,
    "-404": 1380,
    "thsub": 14400,
    "-412": 1380,
    "-10403": 6480,
    "other": 1380
  },
  "local_wblist": { //本地白名单
    "114514": [
      false,
      false
    ]
  },
  "blacklist_config": {  //黑名单
    "MixedBlackList": {
      "api": "https://black.qimo.ink/api/users/",
      "api_version": 2
    }
  },
  "appsearch_remake": { //app内搜索自定义添加
    "api.mihoyo.buzz": "{\"title\":\"服务器提供者:\\u003cem class\\u003d\\\"keyword\\\"\\u003e黑弩\\u003c/em\\u003e\",\"cover\":\"https://i0.hdslb.com/bfs/face/046974d6dde4af386f7eb4f231b84ec08bad693b.jpg\",\"uri\":\"https://heinu.cc\",\"param\":\"1\",\"goto\":\"bangumi\",\"ptime\":1500000000,\"season_id\":1,\"season_type\":1,\"season_type_name\":\"番剧\",\"media_type\":1,\"style\":\"切勿宣扬哔哩漫游,发现拉黑!\",\"styles_v2\":\"切勿宣扬解析服务器,发现拉黑!\",\"cv\":\"\",\"rating\":114.514,\"vote\":1919.810,\"area\":\"漫游\",\"staff\":\"无\",\"is_selection\":1,\"badge\":\"公告\",\"episodes\":[{\"position\":1,\"uri\":\"https://www.bilibili.com/video/av928861104\",\"param\":\"1\",\"index\":\"1\"}],\"label\":\"勿谓言之不预也\",\"watch_button\":{\"title\":\"博客\",\"link\":\"https://heinu.cc/\"},\"follow_button\":{\"icon\":\"http://i0.hdslb.com/bfs/bangumi/154b6898d2b2c20c21ccef9e41fcf809b518ebb4.png\",\"texts\":{\"0\":\"别点\",\"1\":\"你好闲啊\"},\"status_report\":\"bangumi\"},\"selection_style\":\"horizontal\",\"episodes_new\":[{\"title\":\"教程\",\"uri\":\"https://github.com/yujincheng08/BiliRoaming/wiki#使用方法\"},{\"title\":\"联系方式\",\"uri\":\"https://t.me/wtdnwbzda\",\"badges\":[{\"text\":\"tg\",\"text_color\":\"#FFFFFF\",\"text_color_night\":\"#E5E5E5\",\"bg_color\":\"#58DCF9\",\"bg_color_night\":\"#58DCF9\",\"border_color\":\"#58DCF9\",\"border_color_night\":\"#58DCF9\",\"bg_style\":1}]},{\"title\":\"投喂\",\"uri\":\"https://afdian.net/a/heinu\",\"badges\":[{\"text\":\"爱发电\",\"text_color\":\"#FFFFFF\",\"text_color_night\":\"#E5E5E5\",\"bg_color\":\"#B85DFF\",\"bg_color_night\":\"#A634FF\",\"border_color\":\"#B85DFF\",\"border_color_night\":\"#A634FF\",\"bg_style\":1}]},{\"title\":\"赞助机场\",\"uri\":\"https://wcnmdmht.lol/sb\",\"badges\":[{\"text\":\"aff:TzXmpiyw\",\"text_color\":\"#FFFFFF\",\"text_color_night\":\"#E5E5E5\",\"bg_color\":\"#FB7299\",\"bg_color_night\":\"#BB5B76\",\"border_color\":\"#FB7299\",\"border_color_night\":\"#BB5B76\",\"bg_style\":1}]}],\"badges_v2\":[{\"text\":\"萨日朗\",\"text_color\":\"#FFFFFF\",\"text_color_night\":\"#E5E5E5\",\"bg_color\":\"#00C0FF\",\"bg_color_night\":\"#0B91BE\",\"bg_style\":1}]}"
  },
  "websearch_remake": {//web内搜索自定义添加
    "api.mihoyo.buzz": "{\"type\":\"media_bangumi\",\"media_id\":1,\"title\":\"服务器提供者:\",\"org_title\":\"\",\"media_type\":4,\"cv\":\"黑弩\\n\",\"staff\":\"请勿宣扬解析服务器\\n否则拉黑\\n勿谓言之不预也\\n三思而后行\",\"season_id\":1,\"is_avid\":false,\"hit_columns\":[],\"hit_epids\":\"1\",\"season_type\":4,\"season_type_name\":\"解析服务器\",\"selection_style\":\"horizontal\",\"ep_size\":2,\"url\":\"https://afdian.net/a/heinu\",\"button_text\":\"捐赠\",\"is_follow\":0,\"is_selection\":1,\"eps\":[{\"id\":1,\"cover\":\"https://示例.永雏塔菲.我爱你/src/fuck_search.jpg\",\"title\":\"\\u003cem class=\\\"keyword\\\"\\u003e示例\\u003c/em\\u003e示例\",\"url\":\"https://www.bilibili.com/video/av928861104\",\"release_date\":\"\",\"badges\":null,\"index_title\":\"1\",\"long_title\":\"你好喵\"}],\"badges\":null,\"cover\":\"http://i0.hdslb.com/bfs/bangumi/image/4ddd37596d205978c9f97881b7a56100e85fe2e1.png\",\"areas\":\"示例内容areas\",\"styles\":\"示例内容styles\",\"goto_url\":\"https://www.bilibili.com/video/av928861104\",\"desc\":\"示例内容desc\",\"pubtime\":1609341000,\"media_mode\":2,\"fix_pubtime_str\":\"\",\"media_score\":{\"score\":99.9,\"user_count\":114514},\"display_info\":null,\"pgc_season_id\":1,\"corner\":2,\"index_show\":\"示例内容index_show\"}"
  },
  "donate_url": "https://www.hein.cc/donate", //捐赠url
  "api_sign": "JS4i59Cj", //签名 越唱越好 [0-Z].数字+大小写英文混合
  "api_assesskey_open": {
    "4": false,
    "3": false,
    "2": false,
    "1": false
  },
  "report_open": true,  //报告开关
  "report_config": {
    "TgBot": {
      "tg_bot_token": "",
      "tg_chat_id": "",
      "tg_proxy_api_open": false,
      "tg_proxy_url": ""
    }
  },
  "area_cache_open": true //状态缓存
}

1.自行复制到biliroaming_rust_server同目录下config.json文件
2.如要自定义index.html,在biliroaming_rust_server同目录下创建一个web目录 自定义index.html

配置nginx反代

location ^~ /
{
    proxy_pass http://127.0.0.1:2662;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header REMOTE-HOST $remote_addr;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
    proxy_http_version 1.1;
    # proxy_hide_header Upgrade;

}

温馨提示

  • config中code为0时的缓存设置已无效,缓存时间由播放链接deadline决定
  • 非常不建议将缓存时间设为0(永久缓存),可能会导致后续错误无法自动恢复
  • 目前服务端只是小范围测试,有已知但未修复的严重bug,可能会导致您的机子更容易-412

API列表

  • /pgc/player/api/playurl
  • /pgc/player/web/playurl
  • /intl/gateway/v2/ogv/playurl
  • /intl/gateway/v2/app/search/type
  • /x/v2/search/type
  • /x/web-interface/search/type
  • /intl/gateway/v2/ogv/view/app/season
  • /x/intl/passport-login/oauth2/refresh_token
  • /intl/gateway/v2/app/subtitle
  • /api/accesskey
最后修改:2023 年 12 月 10 日
如果觉得我的文章对你有用,请随意赞赏