mirror of
https://github.com/lanyeeee/bilibili-video-downloader.git
synced 2026-09-08 17:16:52 +08:00
Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1254c6bf2a | ||
|
|
2ab8a91ef4 | ||
|
|
28c81795b8 | ||
|
|
7d065797fb | ||
|
|
9fe5cf0a45 | ||
|
|
b4b35f6055 | ||
|
|
f0e79b584f |
@@ -57,7 +57,7 @@ https://github.com/user-attachments/assets/adf84b93-684f-43f3-9948-6ba527213812
|
||||
我能想到的解决办法只有:
|
||||
|
||||
1. 根据下面的**如何构建(build)**,自行编译
|
||||
2. 希望你相信我的承诺,我承诺你在[Release页面](https://github.com/lanyeeee/bilibili-video-downloader/releases)下载到的所有东西都是安全的
|
||||
2. 希望你相信我的承诺,我承诺你在[Release页面](https://github.com/lanyeeee/bilibili-video-downloader/releases)下载到的所有东西都是安全的。切勿轻信他人分享的文件,请**仅**在[Release页面](https://github.com/lanyeeee/bilibili-video-downloader/releases)下载。任何不是从该页面下载的版本均可能**已被篡改**并**真的包含病毒**(而非误报),包括但不限于`网盘`、`通过邮箱或社交软件分享`、`issue或discussion里的文件`、`其他fork(仓库)`、`其他网站`
|
||||
|
||||
## 🛠️如何构建(build)
|
||||
|
||||
|
||||
@@ -120,6 +120,15 @@ impl BiliClient {
|
||||
let http_resp = request.send().await?;
|
||||
// 检查http响应状态码
|
||||
let status = http_resp.status();
|
||||
// 尝试从headers中拿SESSDATA
|
||||
let sessdata = http_resp
|
||||
.headers()
|
||||
.get_all("set-cookie")
|
||||
.iter()
|
||||
.filter_map(|header| header.to_str().ok())
|
||||
.filter_map(|header| header.split(';').next())
|
||||
.filter_map(|cookie| cookie.split_once('='))
|
||||
.find_map(|(key, value)| (key.trim() == "SESSDATA").then(|| value.to_owned()));
|
||||
let body = http_resp.text().await?;
|
||||
if status != StatusCode::OK {
|
||||
return Err(eyre!("预料之外的状态码({status}): {body}"));
|
||||
@@ -137,11 +146,14 @@ impl BiliClient {
|
||||
};
|
||||
// 尝试将data解析为二维码状态
|
||||
let data_str = data.to_string();
|
||||
let qrcode_status: QrcodeStatus = serde_json::from_str(&data_str)
|
||||
let mut qrcode_status: QrcodeStatus = serde_json::from_str(&data_str)
|
||||
.wrap_err(format!("将data解析为QrcodeStatus失败: {data_str}"))?;
|
||||
if ![0, 86101, 86090, 86038].contains(&qrcode_status.code) {
|
||||
return Err(eyre!("预料之外的二维码code: {qrcode_status:?}"));
|
||||
}
|
||||
if qrcode_status.code == 0 {
|
||||
qrcode_status.sessdata = sessdata.ok_or_eyre("扫码成功,但没有解析到SESSDATA")?;
|
||||
}
|
||||
Ok(qrcode_status)
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ impl ChapterSegments {
|
||||
// 遍历完所有现有片段并处理完所有重叠后,将新的片段添加到结果列表中
|
||||
processed_segments.push(new_segment);
|
||||
|
||||
processed_segments.sort_by(|a, b| a.start.cmp(&b.start));
|
||||
processed_segments.sort_by_key(|a| a.start);
|
||||
|
||||
self.segments = processed_segments;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ use specta::Type;
|
||||
#[serde(default)]
|
||||
pub struct QrcodeStatus {
|
||||
pub url: String,
|
||||
pub sessdata: String,
|
||||
pub refresh_token: String,
|
||||
pub timestamp: i64,
|
||||
pub code: i64,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "bilibili-video-downloader",
|
||||
"version": "0.2.0",
|
||||
"version": "0.2.1",
|
||||
"identifier": "com.lanyeeee.bilibili-video-downloader",
|
||||
"build": {
|
||||
"beforeDevCommand": "pnpm dev",
|
||||
|
||||
+1
-1
@@ -424,7 +424,7 @@ export type PurchaseFormatNote = { content_list: ContentList[]; link: string; ti
|
||||
export type PurchaseNote = { content: string; link: string; title: string }
|
||||
export type PurchaseProtocol = { link: string; title: string }
|
||||
export type QrcodeData = { url: string; qrcode_key: string }
|
||||
export type QrcodeStatus = { url: string; refresh_token: string; timestamp: number; code: number; message: string }
|
||||
export type QrcodeStatus = { url: string; sessdata: string; refresh_token: string; timestamp: number; code: number; message: string }
|
||||
export type RatingInBangumi = { count: number; score: number }
|
||||
export type RatingInBangumiFollow = { score: number; count: number }
|
||||
export type RecommendSeason = { cover: string; ep_count: string; id: number; season_url: string; subtitle: string; title: string; view: number }
|
||||
|
||||
@@ -93,8 +93,7 @@ function handleQrcodeStatus() {
|
||||
}
|
||||
|
||||
if (qrcodeStatus.value.code === 0) {
|
||||
const sessdata = qrcodeStatus.value.url.split('SESSDATA=')[1].split('&')[0]
|
||||
store.config.sessdata = encodeURIComponent(sessdata)
|
||||
store.config.sessdata = qrcodeStatus.value.sessdata
|
||||
showing.value = false
|
||||
message.success('登录成功')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user