mirror of
https://github.com/bolucat/Archive.git
synced 2025-12-24 13:28:37 +08:00
Update On Fri Aug 2 20:31:39 CEST 2024
This commit is contained in:
3
bbdown/.github/workflows/build_latest.yml
vendored
3
bbdown/.github/workflows/build_latest.yml
vendored
@@ -4,6 +4,7 @@ on: [push,workflow_dispatch]
|
||||
|
||||
env:
|
||||
DOTNET_SDK_VERSION: '8.0.*'
|
||||
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
|
||||
|
||||
jobs:
|
||||
|
||||
@@ -105,4 +106,4 @@ jobs:
|
||||
uses: actions/upload-artifact@v3.1.3
|
||||
with:
|
||||
name: BBDown_osx-arm64
|
||||
path: artifact-arm64/BBDown
|
||||
path: artifact-arm64/BBDown
|
||||
|
||||
@@ -40,5 +40,10 @@ namespace BBDown.Core.Entity
|
||||
/// 视频分P信息
|
||||
/// </summary>
|
||||
public required List<Page> PagesInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否为互动视频
|
||||
/// </summary>
|
||||
public bool IsSteinGate { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using BBDown.Core.Entity;
|
||||
using System.Text.Json;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Xml;
|
||||
using static BBDown.Core.Entity.Entity;
|
||||
using static BBDown.Core.Util.HTTPUtil;
|
||||
|
||||
@@ -22,9 +23,15 @@ namespace BBDown.Core.Fetcher
|
||||
string ownerName = owner.GetProperty("name").ToString();
|
||||
long pubTime = data.GetProperty("pubdate").GetInt64();
|
||||
bool bangumi = false;
|
||||
var bvid = data.GetProperty("bvid").ToString();
|
||||
var cid = data.GetProperty("cid").GetInt64();
|
||||
|
||||
var pages = data.GetProperty("pages").EnumerateArray().ToList();
|
||||
// 互动视频 1:是 0:否
|
||||
var isSteinGate = data.GetProperty("rights").GetProperty("is_stein_gate").GetInt16();
|
||||
|
||||
// 分p信息
|
||||
List<Page> pagesInfo = new();
|
||||
var pages = data.GetProperty("pages").EnumerateArray().ToList();
|
||||
foreach (var page in pages)
|
||||
{
|
||||
Page p = new(page.GetProperty("page").GetInt32(),
|
||||
@@ -39,10 +46,57 @@ namespace BBDown.Core.Fetcher
|
||||
"",
|
||||
ownerName,
|
||||
ownerMid
|
||||
);
|
||||
);
|
||||
pagesInfo.Add(p);
|
||||
}
|
||||
|
||||
if (isSteinGate == 1) // 互动视频获取分P信息
|
||||
{
|
||||
var playerSoApi = $"https://api.bilibili.com/x/player.so?bvid={bvid}&id=cid:{cid}";
|
||||
var playerSoText = await GetWebSourceAsync(playerSoApi);
|
||||
var playerSoXml = new XmlDocument();
|
||||
playerSoXml.LoadXml($"<root>{playerSoText}</root>");
|
||||
|
||||
var interactionNode = playerSoXml.SelectSingleNode("//interaction");
|
||||
|
||||
if (interactionNode is { InnerText.Length: > 0 })
|
||||
{
|
||||
var graphVersion = JsonDocument.Parse(interactionNode.InnerText).RootElement
|
||||
.GetProperty("graph_version").GetInt64();
|
||||
var edgeInfoApi = $"https://api.bilibili.com/x/stein/edgeinfo_v2?graph_version={graphVersion}&bvid={bvid}";
|
||||
var edgeInfoJson = await GetWebSourceAsync(edgeInfoApi);
|
||||
var edgeInfoData = JsonDocument.Parse(edgeInfoJson).RootElement.GetProperty("data");
|
||||
var questions = edgeInfoData.GetProperty("edges").GetProperty("questions").EnumerateArray()
|
||||
.ToList();
|
||||
var index = 2; // 互动视频分P索引从2开始
|
||||
foreach (var question in questions)
|
||||
{
|
||||
var choices = question.GetProperty("choices").EnumerateArray().ToList();
|
||||
foreach (var page in choices)
|
||||
{
|
||||
Page p = new(index++,
|
||||
id,
|
||||
page.GetProperty("cid").ToString(),
|
||||
"", //epid
|
||||
page.GetProperty("option").ToString().Trim(),
|
||||
0,
|
||||
"",
|
||||
pubTime, //分p视频没有发布时间
|
||||
"",
|
||||
"",
|
||||
ownerName,
|
||||
ownerMid
|
||||
);
|
||||
pagesInfo.Add(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("互动视频获取分P信息失败");
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (data.GetProperty("redirect_url").ToString().Contains("bangumi"))
|
||||
@@ -65,7 +119,8 @@ namespace BBDown.Core.Fetcher
|
||||
Pic = pic,
|
||||
PubTime = pubTime,
|
||||
PagesInfo = pagesInfo,
|
||||
IsBangumi = bangumi
|
||||
IsBangumi = bangumi,
|
||||
IsSteinGate = isSteinGate == 1
|
||||
};
|
||||
|
||||
return info;
|
||||
|
||||
@@ -264,6 +264,12 @@ namespace BBDown
|
||||
{
|
||||
Log($"UP主页: https://space.bilibili.com/{mid}");
|
||||
}
|
||||
|
||||
if (vInfo.IsSteinGate && myOption.UseTvApi)
|
||||
{
|
||||
Log("视频为互动视频,暂时不支持tv下载,修改为默认下载");
|
||||
myOption.UseTvApi = false;
|
||||
}
|
||||
string apiType = myOption.UseTvApi ? "TV" : (myOption.UseAppApi ? "APP" : (myOption.UseIntlApi ? "INTL" : "WEB"));
|
||||
|
||||
//打印分P信息
|
||||
|
||||
Reference in New Issue
Block a user