支持设置BaseURL
This commit is contained in:
parent
3c17a20447
commit
4859c288ed
|
@ -24,6 +24,7 @@ namespace N_m3u8DL_RE.Common.Resource
|
|||
public static string cmd_delAfterDone { get => GetText("cmd_delAfterDone"); }
|
||||
public static string cmd_ffmpegBinaryPath { get => GetText("cmd_ffmpegBinaryPath"); }
|
||||
public static string cmd_mkvmergeBinaryPath { get => GetText("cmd_mkvmergeBinaryPath"); }
|
||||
public static string cmd_baseUrl { get => GetText("cmd_baseUrl"); }
|
||||
public static string cmd_header { get => GetText("cmd_header"); }
|
||||
public static string cmd_Input { get => GetText("cmd_Input"); }
|
||||
public static string cmd_keys { get => GetText("cmd_keys"); }
|
||||
|
|
|
@ -52,6 +52,12 @@ namespace N_m3u8DL_RE.Common.Resource
|
|||
zhTW: "驗證最後一個分片有效性",
|
||||
enUS: "Verifying the validity of the last segment"
|
||||
),
|
||||
["cmd_baseUrl"] = new TextContainer
|
||||
(
|
||||
zhCN: "设置BaseURL",
|
||||
zhTW: "設置BaseURL",
|
||||
enUS: "Set BaseURL"
|
||||
),
|
||||
["cmd_appendUrlParams"] = new TextContainer
|
||||
(
|
||||
zhCN: "将输入Url的Params添加至分片, 对某些网站很有用, 例如 kakao.com",
|
||||
|
|
|
@ -31,6 +31,8 @@ namespace N_m3u8DL_RE.Parser.Extractor
|
|||
this.MpdUrl = parserConfig.Url ?? string.Empty;
|
||||
if (!string.IsNullOrEmpty(parserConfig.BaseUrl))
|
||||
this.BaseUrl = parserConfig.BaseUrl;
|
||||
else
|
||||
this.BaseUrl = this.MpdUrl;
|
||||
}
|
||||
|
||||
private string ExtendBaseUrl(XElement element, string oriBaseUrl)
|
||||
|
@ -92,10 +94,6 @@ namespace N_m3u8DL_RE.Parser.Extractor
|
|||
if (baseUrl.Contains("kkbox.com.tw/")) baseUrl = baseUrl.Replace("//https:%2F%2F", "//");
|
||||
this.BaseUrl = ParserUtil.CombineURL(this.MpdUrl, baseUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.BaseUrl = this.MpdUrl;
|
||||
}
|
||||
|
||||
//全部Period
|
||||
var periods = mpdElement.Elements().Where(e => e.Name.LocalName == "Period");
|
||||
|
|
|
@ -41,6 +41,7 @@ namespace N_m3u8DL_RE.CommandLine
|
|||
private readonly static Option<string?> DecryptionBinaryPath = new(new string[] { "--decryption-binary-path" }, description: ResString.cmd_decryptionBinaryPath);
|
||||
private readonly static Option<string?> FFmpegBinaryPath = new(new string[] { "--ffmpeg-binary-path" }, description: ResString.cmd_ffmpegBinaryPath);
|
||||
private readonly static Option<string?> MkvmergeBinaryPath = new(new string[] { "--mkvmerge-binary-path" }, description: ResString.cmd_mkvmergeBinaryPath);
|
||||
private readonly static Option<string?> BaseUrl = new(new string[] { "--base-url" }, description: ResString.cmd_baseUrl);
|
||||
|
||||
class MyOptionBinder : BinderBase<MyOption>
|
||||
{
|
||||
|
@ -78,6 +79,7 @@ namespace N_m3u8DL_RE.CommandLine
|
|||
DownloadRetryCount = bindingContext.ParseResult.GetValueForOption(DownloadRetryCount),
|
||||
MuxAfterDone = bindingContext.ParseResult.GetValueForOption(MuxAfterDone),
|
||||
UseMkvmerge = bindingContext.ParseResult.GetValueForOption(UseMkvmerge),
|
||||
BaseUrl = bindingContext.ParseResult.GetValueForOption(BaseUrl),
|
||||
};
|
||||
|
||||
|
||||
|
@ -96,9 +98,9 @@ namespace N_m3u8DL_RE.CommandLine
|
|||
|
||||
public static async Task<int> InvokeArgs(string[] args, Func<MyOption, Task> action)
|
||||
{
|
||||
var rootCommand = new RootCommand("N_m3u8DL-RE (Beta version) 20220821")
|
||||
var rootCommand = new RootCommand("N_m3u8DL-RE (Beta version) 20220822")
|
||||
{
|
||||
Input, TmpDir, SaveDir, SaveName, ThreadCount, DownloadRetryCount, AutoSelect, SkipMerge, SkipDownload, CheckSegmentsCount,
|
||||
Input, TmpDir, SaveDir, SaveName, BaseUrl, ThreadCount, DownloadRetryCount, AutoSelect, SkipMerge, SkipDownload, CheckSegmentsCount,
|
||||
BinaryMerge, DelAfterDone, WriteMetaJson, MuxAfterDone, AppendUrlParams, Headers, /**SavePattern,**/ SubOnly, SubtitleFormat, AutoSubtitleFix,
|
||||
FFmpegBinaryPath, MkvmergeBinaryPath,
|
||||
LogLevel, UILanguage, UrlProcessorArgs, Keys, KeyTextFile, DecryptionBinaryPath, UseShakaPackager, UseMkvmerge, MP4RealTimeDecryption
|
||||
|
|
|
@ -18,6 +18,10 @@ namespace N_m3u8DL_RE.CommandLine
|
|||
/// </summary>
|
||||
public string[]? Keys { get; set; }
|
||||
/// <summary>
|
||||
/// See: <see cref="CommandInvoker.BaseUrl"/>.
|
||||
/// </summary>
|
||||
public string? BaseUrl { get; set; }
|
||||
/// <summary>
|
||||
/// See: <see cref="CommandInvoker.KeyTextFile"/>.
|
||||
/// </summary>
|
||||
public string? KeyTextFile { get; set; }
|
||||
|
|
|
@ -98,6 +98,7 @@ namespace N_m3u8DL_RE
|
|||
{
|
||||
AppendUrlParams = option.AppendUrlParams,
|
||||
UrlProcessorArgs = option.UrlProcessorArgs,
|
||||
BaseUrl = option.BaseUrl!
|
||||
};
|
||||
|
||||
//设置Headers
|
||||
|
|
Loading…
Reference in New Issue