diff --git a/src/N_m3u8DL-RE/CommandLine/CommandInvoker.cs b/src/N_m3u8DL-RE/CommandLine/CommandInvoker.cs
index 079525c..5aa3ff5 100644
--- a/src/N_m3u8DL-RE/CommandLine/CommandInvoker.cs
+++ b/src/N_m3u8DL-RE/CommandLine/CommandInvoker.cs
@@ -56,18 +56,8 @@ namespace N_m3u8DL_RE.CommandLine
///
private static Dictionary ParseHeaders(ArgumentResult result)
{
- //默认的Headers
- var headers = new Dictionary()
- {
- ["user-agent"] = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36"
- };
var array = result.Tokens.Select(t => t.Value).ToArray();
- var otherHeaders = ConvertUtil.SplitHeaderArrayToDic(array);
- foreach (var h in otherHeaders)
- {
- headers[h.Key] = h.Value;
- }
- return headers;
+ return ConvertUtil.SplitHeaderArrayToDic(array);
}
///
diff --git a/src/N_m3u8DL-RE/CommandLine/MyOption.cs b/src/N_m3u8DL-RE/CommandLine/MyOption.cs
index 1403f3b..1672f23 100644
--- a/src/N_m3u8DL-RE/CommandLine/MyOption.cs
+++ b/src/N_m3u8DL-RE/CommandLine/MyOption.cs
@@ -13,7 +13,7 @@ namespace N_m3u8DL_RE.CommandLine
///
/// See: .
///
- public Dictionary Headers { get; set; } = new Dictionary();
+ public Dictionary Headers { get; set; } = new Dictionary();
///
/// See: .
///
diff --git a/src/N_m3u8DL-RE/Program.cs b/src/N_m3u8DL-RE/Program.cs
index 75ce3d7..b7403ad 100644
--- a/src/N_m3u8DL-RE/Program.cs
+++ b/src/N_m3u8DL-RE/Program.cs
@@ -13,7 +13,6 @@ using N_m3u8DL_RE.Config;
using N_m3u8DL_RE.Util;
using N_m3u8DL_RE.DownloadManager;
using N_m3u8DL_RE.CommandLine;
-using N_m3u8DL_RE.Entity;
namespace N_m3u8DL_RE
{
@@ -103,12 +102,23 @@ namespace N_m3u8DL_RE
}
}
+ //默认的headers
+ var headers = new Dictionary()
+ {
+ ["user-agent"] = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36"
+ };
+ //添加或替换用户输入的headers
+ foreach (var item in option.Headers)
+ {
+ headers[item.Key] = item.Value;
+ }
+
var parserConfig = new ParserConfig()
{
AppendUrlParams = option.AppendUrlParams,
UrlProcessorArgs = option.UrlProcessorArgs,
BaseUrl = option.BaseUrl!,
- Headers = option.Headers
+ Headers = headers
};
//demo1