fix(upload): update upload lines (#1656)
This commit is contained in:
1 parent
adf6a1c03b
commit
3e8b55c2c4
12 files changed
+77
-46
No files matched your search
@@ -317,7 +317,7 @@ const Global: React.FC = () => {
|
||||
<Form.Select
|
||||
field="lines"
|
||||
label="上传线路(lines)"
|
||||
extraText="b站上传线路选择,默认为自动模式,可手动切换为bda, bda2, ws, qn, bldsa, tx, txa"
|
||||
extraText="b站上传线路选择,默认为自动模式,可手动切换为alia, bda2, bldsa, tx, txa, estx, akbd"
|
||||
placeholder="AUTO(自动,默认)"
|
||||
style={{ width: '100%' }}
|
||||
fieldStyle={{
|
||||
@@ -328,12 +328,12 @@ const Global: React.FC = () => {
|
||||
>
|
||||
<Form.Select.Option value="AUTO">AUTO(自动,默认)</Form.Select.Option>
|
||||
<Form.Select.Option value="alia">alia(海外-阿里云)</Form.Select.Option>
|
||||
{/* <Form.Select.Option value="bda">bda</Form.Select.Option> */}
|
||||
<Form.Select.Option value="bda2">bda2(大陆-百度云)</Form.Select.Option>
|
||||
<Form.Select.Option value="bldsa">bldsa(大陆-B站自建)</Form.Select.Option>
|
||||
<Form.Select.Option value="qn">qn(全球-七牛)</Form.Select.Option>
|
||||
<Form.Select.Option value="tx">tx(大陆-腾讯云)</Form.Select.Option>
|
||||
<Form.Select.Option value="txa">txa(海外-腾讯云)</Form.Select.Option>
|
||||
<Form.Select.Option value="estx">estx(大陆-B站自建)</Form.Select.Option>
|
||||
<Form.Select.Option value="akbd">akbd(大陆-B站自建)</Form.Select.Option>
|
||||
</Form.Select>
|
||||
<Form.InputNumber
|
||||
field="threads"
|
||||
|
||||
@@ -396,22 +396,10 @@ class BiliBili:
|
||||
"""
|
||||
preferred_upos_cdn = None
|
||||
if not self._auto_os:
|
||||
if lines == 'bda':
|
||||
self._auto_os = {"os": "upos", "query": "upcdn=bda&probe_version=20221109",
|
||||
"probe_url": "//upos-cs-upcdnbda.bilivideo.com/OK"}
|
||||
preferred_upos_cdn = 'bda'
|
||||
elif lines in {'bda2', 'cs-bda2'}:
|
||||
if lines in {'bda2', 'cs-bda2'}:
|
||||
self._auto_os = {"os": "upos", "query": "upcdn=bda2&probe_version=20221109",
|
||||
"probe_url": "//upos-cs-upcdnbda2.bilivideo.com/OK"}
|
||||
preferred_upos_cdn = 'bda2'
|
||||
elif lines == 'ws':
|
||||
self._auto_os = {"os": "upos", "query": "upcdn=ws&probe_version=20221109",
|
||||
"probe_url": "//upos-cs-upcdnws.bilivideo.com/OK"}
|
||||
preferred_upos_cdn = 'ws'
|
||||
elif lines in {'qn', 'cs-qn'}:
|
||||
self._auto_os = {"os": "upos", "query": "upcdn=qn&probe_version=20221109",
|
||||
"probe_url": "//upos-cs-upcdnqn.bilivideo.com/OK"}
|
||||
preferred_upos_cdn = 'qn'
|
||||
elif lines == 'bldsa':
|
||||
self._auto_os = {"os": "upos", "query": "upcdn=bldsa&probe_version=20221109",
|
||||
"probe_url": "//upos-cs-upcdnbldsa.bilivideo.com/OK"}
|
||||
@@ -424,6 +412,18 @@ class BiliBili:
|
||||
self._auto_os = {"os": "upos", "query": "upcdn=txa&probe_version=20221109",
|
||||
"probe_url": "//upos-cs-upcdntxa.bilivideo.com/OK"}
|
||||
preferred_upos_cdn = 'txa'
|
||||
elif lines == 'alia':
|
||||
self._auto_os = {"os": "upos", "query": "upcdn=alia&probe_version=20221109",
|
||||
"probe_url": "//upos-cs-upcdnalia.bilivideo.com/OK"}
|
||||
preferred_upos_cdn = 'alia'
|
||||
elif lines == 'estx':
|
||||
self._auto_os = {"os": "upos",
|
||||
"query": "probe_version=20250923&upcdn=estx&zone=cs",
|
||||
"probe_url": "//e17962d5cstx.esheep.com/OK"}
|
||||
elif lines == 'akbd':
|
||||
self._auto_os = {"os": "upos",
|
||||
"query": "probe_version=20250923&upcdn=akbd&zone=cs",
|
||||
"probe_url": "//bb27c891csbd.aikobo.cn/OK"}
|
||||
else:
|
||||
self._auto_os = self.probe()
|
||||
logger.info(f"线路选择 => {self._auto_os['os']}: {self._auto_os['query']}. time: {self._auto_os.get('cost')}")
|
||||
@@ -457,10 +457,10 @@ class BiliBili:
|
||||
logger.debug(f"preupload: {ret}")
|
||||
if preferred_upos_cdn:
|
||||
original_endpoint: str = ret['endpoint']
|
||||
if re.match(r'//upos-(sz|cs)-upcdn(bda2|ws|qn)\.bilivideo\.com', original_endpoint):
|
||||
if re.match(r'bda2|qn|ws', preferred_upos_cdn):
|
||||
if re.match(r'//upos-(sz|cs)-upcdnbda2\.bilivideo\.com', original_endpoint):
|
||||
if re.match(r'bda2', preferred_upos_cdn):
|
||||
logger.debug(f"Preferred UpOS CDN: {preferred_upos_cdn}")
|
||||
new_endpoint = re.sub(r'upcdn(bda2|qn|ws)', f'upcdn{preferred_upos_cdn}', original_endpoint)
|
||||
new_endpoint = re.sub(r'upcdnbda2', f'upcdn{preferred_upos_cdn}', original_endpoint)
|
||||
logger.debug(f"{original_endpoint} => {new_endpoint}")
|
||||
ret['endpoint'] = new_endpoint
|
||||
else:
|
||||
|
||||
@@ -374,11 +374,25 @@ class BiliBili:
|
||||
logger.info(f"{file_name} 开始上传")
|
||||
if self.save_dir:
|
||||
self.save_path = os.path.join(self.save_dir, file_name)
|
||||
cs_upcdn = ['alia', 'bda', 'bda2', 'bldsa', 'qn', 'tx', 'txa']
|
||||
cs_upcdn = ['alia', 'bda2', 'bldsa', 'tx', 'txa']
|
||||
jd_upcdn = ['jd-alia', 'jd-bd', 'jd-bldsa', 'jd-tx', 'jd-txa']
|
||||
special_upcdn = {
|
||||
'estx': {
|
||||
"os": "upos",
|
||||
"query": "probe_version=20250923&upcdn=estx&zone=cs",
|
||||
"probe_url": "//e17962d5cstx.esheep.com/OK",
|
||||
},
|
||||
'akbd': {
|
||||
"os": "upos",
|
||||
"query": "probe_version=20250923&upcdn=akbd&zone=cs",
|
||||
"probe_url": "//bb27c891csbd.aikobo.cn/OK",
|
||||
},
|
||||
}
|
||||
preferred_upos_cdn = None
|
||||
if not self._auto_os:
|
||||
if lines in cs_upcdn:
|
||||
if lines in special_upcdn:
|
||||
self._auto_os = special_upcdn[lines]
|
||||
elif lines in cs_upcdn:
|
||||
self._auto_os = {"os": "upos", "query": f"upcdn={lines}&probe_version=20221109",
|
||||
"probe_url": f"//upos-cs-upcdn{lines}.bilivideo.com/OK"}
|
||||
preferred_upos_cdn = lines
|
||||
|
||||
@@ -313,7 +313,8 @@ pub enum UploadLine {
|
||||
Cntx,
|
||||
Antx,
|
||||
Attx,
|
||||
Bda,
|
||||
Txa,
|
||||
Alia,
|
||||
Estx,
|
||||
Akbd,
|
||||
}
|
||||
@@ -130,11 +130,12 @@ async fn initialize_upload_context(
|
||||
async fn get_upload_line(client: &reqwest::Client, line: &str) -> AppResult<Line> {
|
||||
let line = match line {
|
||||
"bda2" => line::bda2(),
|
||||
"bda" => line::bda(),
|
||||
"tx" => line::tx(),
|
||||
"txa" => line::txa(),
|
||||
"bldsa" => line::bldsa(),
|
||||
"alia" => line::alia(),
|
||||
"estx" => line::estx(),
|
||||
"akbd" => line::akbd(),
|
||||
_ => Probe::probe(client).await.unwrap_or_default(),
|
||||
};
|
||||
Ok(line)
|
||||
@@ -382,9 +383,10 @@ pub async fn upload(
|
||||
Some(UploadLine::Cntx) => line::cntx(),
|
||||
Some(UploadLine::Antx) => line::antx(),
|
||||
Some(UploadLine::Attx) => line::attx(),
|
||||
// Some(UploadLine::Bda) => line::bda(),
|
||||
Some(UploadLine::Txa) => line::txa(),
|
||||
Some(UploadLine::Alia) => line::alia(),
|
||||
Some(UploadLine::Estx) => line::estx(),
|
||||
Some(UploadLine::Akbd) => line::akbd(),
|
||||
_ => Probe::probe(&client.client).await.unwrap_or_default(),
|
||||
};
|
||||
for video_path in video_paths {
|
||||
|
||||
@@ -46,7 +46,7 @@ pub struct Config {
|
||||
#[serde(default)]
|
||||
pub submit_api: Option<String>,
|
||||
|
||||
/// 上传线路:AUTO | alia | bda2 | bldsa | qn | tx | txa
|
||||
/// 上传线路:AUTO | alia | bda2 | bldsa | tx | txa | estx | akbd
|
||||
#[builder(default = default_lines())]
|
||||
#[serde(default = "default_lines")]
|
||||
pub lines: String,
|
||||
|
||||
@@ -440,9 +440,10 @@ pub async fn upload(
|
||||
Some(UploadLine::Cntx) => line::cntx(),
|
||||
Some(UploadLine::Antx) => line::antx(),
|
||||
Some(UploadLine::Attx) => line::attx(),
|
||||
// Some(UploadLine::Bda) => line::bda(),
|
||||
Some(UploadLine::Txa) => line::txa(),
|
||||
Some(UploadLine::Alia) => line::alia(),
|
||||
Some(UploadLine::Estx) => line::estx(),
|
||||
Some(UploadLine::Akbd) => line::akbd(),
|
||||
_ => Probe::probe(&client.client).await.unwrap_or_default(),
|
||||
};
|
||||
// let line = line::kodo();
|
||||
|
||||
@@ -323,16 +323,6 @@ pub fn attx() -> Line {
|
||||
}
|
||||
}
|
||||
|
||||
/// 百度云海外(Cloudflare)
|
||||
pub fn bda() -> Line {
|
||||
Line {
|
||||
os: Uploader::Upos,
|
||||
query: "zone=cs&upcdn=bda&probe_version=20221109".into(),
|
||||
probe_url: "//upos-cs-upcdnbda.bilivideo.com/OK".into(),
|
||||
cost: 0,
|
||||
}
|
||||
}
|
||||
|
||||
/// 腾讯云EO海外
|
||||
pub fn txa() -> Line {
|
||||
Line {
|
||||
@@ -352,3 +342,23 @@ pub fn alia() -> Line {
|
||||
cost: 0,
|
||||
}
|
||||
}
|
||||
|
||||
/// B站自建
|
||||
pub fn estx() -> Line {
|
||||
Line {
|
||||
os: Uploader::Upos,
|
||||
query: "probe_version=20250923&upcdn=estx&zone=cs".into(),
|
||||
probe_url: "//e17962d5cstx.esheep.com/OK".into(),
|
||||
cost: 0,
|
||||
}
|
||||
}
|
||||
|
||||
/// B站自建
|
||||
pub fn akbd() -> Line {
|
||||
Line {
|
||||
os: Uploader::Upos,
|
||||
query: "probe_version=20250923&upcdn=akbd&zone=cs".into(),
|
||||
probe_url: "//bb27c891csbd.aikobo.cn/OK".into(),
|
||||
cost: 0,
|
||||
}
|
||||
}
|
||||
@@ -25,9 +25,10 @@ pub enum UploadLine {
|
||||
Cntx,
|
||||
Antx,
|
||||
Attx,
|
||||
Bda,
|
||||
Txa,
|
||||
Alia,
|
||||
Estx,
|
||||
Akbd,
|
||||
}
|
||||
|
||||
impl From<UploadLine> for biliup_cli::UploadLine {
|
||||
@@ -47,9 +48,10 @@ impl From<UploadLine> for biliup_cli::UploadLine {
|
||||
P::Cntx => C::Cntx,
|
||||
P::Antx => C::Antx,
|
||||
P::Attx => C::Attx,
|
||||
P::Bda => C::Bda,
|
||||
P::Txa => C::Txa,
|
||||
P::Alia => C::Alia,
|
||||
P::Estx => C::Estx,
|
||||
P::Akbd => C::Akbd,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,12 +116,6 @@ class UploadLine(Enum):
|
||||
Bda2 = 1
|
||||
"""百度云"""
|
||||
|
||||
Qn = 2
|
||||
"""七牛"""
|
||||
|
||||
Bda = 3
|
||||
"""百度云海外"""
|
||||
|
||||
Tx = 4
|
||||
"""腾讯云EO"""
|
||||
|
||||
@@ -134,6 +128,13 @@ class UploadLine(Enum):
|
||||
Alia = 7
|
||||
"""阿里云海外"""
|
||||
|
||||
Estx = 8
|
||||
"""B站自建"""
|
||||
|
||||
Akbd = 9
|
||||
"""B站自建"""
|
||||
|
||||
|
||||
|
||||
def upload(video_path: List[str],
|
||||
cookie_file: str,
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ filtering_threshold = 20
|
||||
#submit_api = "client"
|
||||
### 选择全局默认上传插件,Noop为不上传,但会执行后处理,可选bili_web,biliup-rs(默认值)
|
||||
#uploader = "Noop"
|
||||
### b站上传线路选择,默认自动选择最优线路。目前可手动切换为alia(海外), bda2(大陆), bldsa(大陆), qn(全球), tx(大陆), txa(海外)
|
||||
### b站上传线路选择,默认自动选择最优线路。目前可手动切换为alia(海外), bda2(大陆), bldsa(大陆), tx(大陆), txa(海外), estx(大陆), akbd(大陆)
|
||||
lines = "AUTO"
|
||||
### 单文件并发上传数,未达到带宽上限时,增大此值可提高上传速度(不要设置过大,部分线路限制为8,如速度不佳优先调整上传线路)
|
||||
threads = 3
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ filtering_threshold: 20
|
||||
#uploader: Noop
|
||||
### b站提交接口,默认自动选择,可选web,client
|
||||
#submit_api: client
|
||||
### b站上传线路选择,默认自动选择最优线路。目前可手动切换为alia(海外), bda2(大陆), bldsa(大陆), qn(全球), tx(大陆), txa(海外)
|
||||
### b站上传线路选择,默认自动选择最优线路。目前可手动切换为alia(海外), bda2(大陆), bldsa(大陆), tx(大陆), txa(海外), estx(大陆), akbd(大陆)
|
||||
lines: AUTO
|
||||
### 单文件并发上传数,未达到带宽上限时,增大此值可提高上传速度(不要设置过大,部分线路限制为8,如速度不佳优先调整上传线路)
|
||||
threads: 3
|
||||
|
||||
Reference in new issue
Block a user