1、去重
2、分享 3、视频播放 4、批量删除,重新下载 5、自定义标题(仅博主视频) 6、授权页面去掉博主添加,新增关注列表 7、图文视频合成优化 8、其他优化
This commit is contained in:
+268
-154
@@ -1,18 +1,95 @@
|
||||
using System.Threading.Channels;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace dy.net.utils
|
||||
{
|
||||
public class DouyinBaseParamDics
|
||||
/// <summary>
|
||||
/// 抖音网页端请求参数字典管理类
|
||||
/// 提供各类接口的标准化参数字典,对外暴露的属性名称和返回类型保持不变
|
||||
/// </summary>
|
||||
public static class DouyinBaseParamDics
|
||||
{
|
||||
public static Dictionary<string, string> CollectParams { get; } = InitializeUserCollecParams();
|
||||
/// <summary>
|
||||
/// 收藏列表参数(用户收藏的内容)
|
||||
/// </summary>
|
||||
public static Dictionary<string, string> CollectParams { get; } = InitializeUserCollectParams();
|
||||
|
||||
/// <summary>
|
||||
/// 用户收藏参数(与 CollectParams 功能区分,保留原始定义)
|
||||
/// </summary>
|
||||
public static Dictionary<string, string> FavoriteParams { get; } = InitializeUserFavoriteParams();
|
||||
|
||||
/// <summary>
|
||||
/// 博主发布作品参数
|
||||
/// </summary>
|
||||
public static Dictionary<string, string> UpderPostParams { get; } = InitializeUpderPostParams();
|
||||
|
||||
private static Dictionary<string, string> InitializeUserCollecParams()
|
||||
{
|
||||
var parameters = GetDyBaseParameters();
|
||||
/// <summary>
|
||||
/// 我关注的博主列表参数
|
||||
/// </summary>
|
||||
public static Dictionary<string, string> MyFollowParams { get; } = InitializeMyFollowParams();
|
||||
|
||||
// 覆盖与基础字段不同的值
|
||||
/// <summary>
|
||||
/// 视频详情
|
||||
/// </summary>
|
||||
public static Dictionary<string, string> ViedoDetailParam { get; } = InitializeViedoDetailParam();
|
||||
|
||||
/// <summary>
|
||||
/// 抖音作品列表请求参数(适配接口:https://www.douyin.com/aweme/v1/web/aweme/post/)
|
||||
/// </summary>
|
||||
public static Dictionary<string, string> InitializeDouyinPostParams()
|
||||
{
|
||||
// 基于基础参数扩展,减少冗余
|
||||
var parameters = GetBaseParameters();
|
||||
|
||||
// 覆盖基础参数中不同的值
|
||||
parameters["version_code"] = "290100";
|
||||
parameters["version_name"] = "29.1.0";
|
||||
parameters["screen_width"] = "1707";
|
||||
parameters["screen_height"] = "1067";
|
||||
parameters["browser_name"] = "Chrome";
|
||||
parameters["browser_version"] = "142.0.0.0";
|
||||
parameters["engine_version"] = "142.0.0.0";
|
||||
parameters["cpu_core_num"] = "32";
|
||||
parameters["support_h265"] = "1";
|
||||
parameters["support_dash"] = "1";
|
||||
|
||||
// 添加特有参数
|
||||
parameters.AddRange(new Dictionary<string, string>
|
||||
{
|
||||
{"sec_user_id", ""},
|
||||
{"max_cursor", "0"},
|
||||
{"locate_item_id", "7576282367263807451"},
|
||||
{"locate_query", "false"},
|
||||
{"count", "18"},
|
||||
{"show_live_replay_strategy", "1"},
|
||||
{"need_time_list", "1"},
|
||||
{"time_list_query", "0"},
|
||||
{"publish_video_strategy_type", "2"},
|
||||
{"from_user_page", "1"},
|
||||
{"webid", "7574080345697584675"},
|
||||
{"uifid", ""},
|
||||
{"msToken", ""},
|
||||
{"a_bogus", ""},
|
||||
{"verifyFp", ""},
|
||||
{"fp", ""},
|
||||
{"x-secsdk-web-expire", ""},
|
||||
{"x-secsdk-web-signature", ""},
|
||||
{"cut_version", "1"}
|
||||
});
|
||||
|
||||
return parameters;
|
||||
}
|
||||
|
||||
#region 私有初始化方法
|
||||
|
||||
/// <summary>
|
||||
/// 初始化收藏列表参数
|
||||
/// </summary>
|
||||
private static Dictionary<string, string> InitializeUserCollectParams()
|
||||
{
|
||||
var parameters = GetBaseParameters();
|
||||
|
||||
// 覆盖基础参数
|
||||
parameters["version_code"] = "290100";
|
||||
parameters["version_name"] = "29.1.0";
|
||||
parameters["screen_width"] = "1920";
|
||||
@@ -21,22 +98,27 @@ namespace dy.net.utils
|
||||
parameters["engine_version"] = "130.0.0.0";
|
||||
parameters["cpu_core_num"] = "12";
|
||||
|
||||
// 添加当前字段特有的键值对
|
||||
parameters["from_user_page"] = "1";
|
||||
parameters["locate_query"] = "false";
|
||||
parameters["need_time_list"] = "1";
|
||||
parameters["show_live_replay_strategy"] = "1";
|
||||
parameters["time_list_query"] = "0";
|
||||
// 添加特有参数
|
||||
parameters.AddRange(new Dictionary<string, string>
|
||||
{
|
||||
{"from_user_page", "1"},
|
||||
{"locate_query", "false"},
|
||||
{"need_time_list", "1"},
|
||||
{"show_live_replay_strategy", "1"},
|
||||
{"time_list_query", "0"}
|
||||
});
|
||||
|
||||
return parameters;
|
||||
}
|
||||
|
||||
// 初始化用户收藏参数
|
||||
/// <summary>
|
||||
/// 初始化用户收藏参数
|
||||
/// </summary>
|
||||
private static Dictionary<string, string> InitializeUserFavoriteParams()
|
||||
{
|
||||
var parameters = GetDyBaseParameters();
|
||||
var parameters = GetBaseParameters();
|
||||
|
||||
// 覆盖与基础字段不同的值
|
||||
// 覆盖基础参数
|
||||
parameters["version_code"] = "170400";
|
||||
parameters["version_name"] = "17.4.0";
|
||||
parameters["screen_width"] = "1536";
|
||||
@@ -44,154 +126,121 @@ namespace dy.net.utils
|
||||
parameters["browser_version"] = "140.0.0.0";
|
||||
parameters["engine_version"] = "140.0.0.0";
|
||||
parameters["cpu_core_num"] = "20";
|
||||
|
||||
// 添加当前字段特有的键值对
|
||||
parameters["min_cursor"] = "0";
|
||||
parameters["cut_version"] = "1";
|
||||
parameters["count"] = "18";
|
||||
parameters["support_h265"] = "1";
|
||||
parameters["support_dash"] = "1";
|
||||
|
||||
// 添加特有参数
|
||||
parameters.AddRange(new Dictionary<string, string>
|
||||
{
|
||||
{"min_cursor", "0"},
|
||||
{"cut_version", "1"},
|
||||
{"count", "18"}
|
||||
});
|
||||
|
||||
return parameters;
|
||||
}
|
||||
|
||||
// 初始化抖音博主发布作品参数
|
||||
private static Dictionary<string,string> InitializeUpderPostParams()
|
||||
{
|
||||
var parameters = new Dictionary<string, string>
|
||||
{
|
||||
{ "WebIdLastTime", "1714385892" },
|
||||
{ "aid", "1988" },
|
||||
{ "app_language", "zh-Hans" },
|
||||
{ "app_name", "tiktok_web" },
|
||||
{ "browser_language", "zh-CN" },
|
||||
{ "browser_name", "Mozilla" },
|
||||
{ "browser_online", "true" },
|
||||
{ "browser_platform", "Win32" },
|
||||
{ "browser_version", "5.0%20%28Windows%29" },
|
||||
{ "cookie_enabled", "true" },
|
||||
{ "count", "18" },
|
||||
{ "coverFormat", "2" },
|
||||
{ "cursor", "0" },
|
||||
{ "data_collection_enabled", "true" },
|
||||
{ "device_id", "7380187414842836523" },
|
||||
{ "device_platform", "webapp" },
|
||||
{ "channel", "channel_pc_web" },
|
||||
{ "focus_state", "true" },
|
||||
{ "from_page", "user" },
|
||||
{ "history_len", "3" },
|
||||
{ "is_fullscreen", "false" },
|
||||
{ "is_page_visible", "true" },
|
||||
{ "language", "zh-Hans" },
|
||||
{ "locate_item_id", "" },
|
||||
{ "needPinnedItemIds", "true" },
|
||||
{ "odinId", "7404669909585003563" },
|
||||
{ "os", "windows" },
|
||||
{ "post_item_list_request_type", "0" },
|
||||
{ "priority_region", "US" },
|
||||
{ "referer", "" },
|
||||
{ "region", "US" },
|
||||
{ "screen_height", "827" },
|
||||
{ "screen_width", "1323" },
|
||||
{ "secUid", "" },
|
||||
{ "tz_name", "America%2FLos_Angeles" },
|
||||
{ "user_is_login", "true" },
|
||||
{ "webcast_language", "zh-Hans" },
|
||||
{ "msToken", "" },
|
||||
{ "_signature", "_02B4Z6wo000017oyWOQAAIDD9xNhTSnfaDu6MFxAAIlj23" },
|
||||
{"sec_user_id",""}
|
||||
};
|
||||
return parameters;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 初始化抖音网页端用户作品列表请求参数(参数来源于目标URL)
|
||||
/// 适配接口:https://www.douyin.com/aweme/v1/web/aweme/post/
|
||||
/// 初始化博主发布作品参数
|
||||
/// </summary>
|
||||
/// <returns>抖音作品列表请求参数字典</returns>
|
||||
public static Dictionary<string, string> InitializeDouyinPostParams()
|
||||
private static Dictionary<string, string> InitializeUpderPostParams()
|
||||
{
|
||||
var parameters = new Dictionary<string, string>
|
||||
// 该接口参数差异较大,单独初始化(保留原始参数完整)
|
||||
return new Dictionary<string, string>
|
||||
{
|
||||
{"WebIdLastTime", "1714385892"},
|
||||
{"aid", "1988"},
|
||||
{"app_language", "zh-Hans"},
|
||||
{"app_name", "tiktok_web"},
|
||||
{"browser_language", "zh-CN"},
|
||||
{"browser_name", "Mozilla"},
|
||||
{"browser_online", "true"},
|
||||
{"browser_platform", "Win32"},
|
||||
{"browser_version", "5.0%20%28Windows%29"},
|
||||
{"cookie_enabled", "true"},
|
||||
{"count", "18"},
|
||||
{"coverFormat", "2"},
|
||||
{"cursor", "0"},
|
||||
{"data_collection_enabled", "true"},
|
||||
{"device_id", "7380187414842836523"},
|
||||
{"device_platform", "webapp"},
|
||||
{"channel", "channel_pc_web"},
|
||||
{"focus_state", "true"},
|
||||
{"from_page", "user"},
|
||||
{"history_len", "3"},
|
||||
{"is_fullscreen", "false"},
|
||||
{"is_page_visible", "true"},
|
||||
{"language", "zh-Hans"},
|
||||
{"locate_item_id", ""},
|
||||
{"needPinnedItemIds", "true"},
|
||||
{"odinId", "7404669909585003563"},
|
||||
{"os", "windows"},
|
||||
{"post_item_list_request_type", "0"},
|
||||
{"priority_region", "US"},
|
||||
{"referer", ""},
|
||||
{"region", "US"},
|
||||
{"screen_height", "827"},
|
||||
{"screen_width", "1323"},
|
||||
{"secUid", ""},
|
||||
{"sec_user_id", ""},
|
||||
{"tz_name", "America%2FLos_Angeles"},
|
||||
{"user_is_login", "true"},
|
||||
{"webcast_language", "zh-Hans"},
|
||||
{"msToken", ""}
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 初始化我关注的博主列表参数
|
||||
/// </summary>
|
||||
private static Dictionary<string, string> InitializeMyFollowParams()
|
||||
{
|
||||
// 基础设备与渠道参数
|
||||
{ "device_platform", "webapp" },
|
||||
{ "aid", "6383" },
|
||||
{ "channel", "channel_pc_web" },
|
||||
|
||||
// 用户标识参数
|
||||
{ "sec_user_id", "" },
|
||||
|
||||
// 分页与内容定位参数
|
||||
{ "max_cursor", "0" },
|
||||
{ "locate_item_id", "7576282367263807451" },
|
||||
{ "locate_query", "false" },
|
||||
{ "count", "18" },
|
||||
|
||||
// 视频相关配置参数
|
||||
{ "show_live_replay_strategy", "1" },
|
||||
{ "need_time_list", "1" },
|
||||
{ "time_list_query", "0" },
|
||||
{ "publish_video_strategy_type", "2" },
|
||||
{ "support_h265", "1" },
|
||||
{ "support_dash", "1" },
|
||||
|
||||
// 版本与更新参数
|
||||
{ "from_user_page", "1" },
|
||||
{ "update_version_code", "170400" },
|
||||
{ "version_code", "290100" },
|
||||
{ "version_name", "29.1.0" },
|
||||
|
||||
// PC端特有参数
|
||||
{ "pc_client_type", "1" },
|
||||
{ "pc_libra_divert", "Windows" },
|
||||
{ "cpu_core_num", "32" },
|
||||
|
||||
// 浏览器环境参数
|
||||
{ "browser_language", "zh-CN" },
|
||||
{ "browser_platform", "Win32" },
|
||||
{ "browser_name", "Chrome" },
|
||||
{ "browser_version", "142.0.0.0" },
|
||||
{ "browser_online", "true" },
|
||||
{ "engine_name", "Blink" },
|
||||
{ "engine_version", "142.0.0.0" },
|
||||
|
||||
// 系统环境参数
|
||||
{ "os_name", "Windows" },
|
||||
{ "os_version", "10" },
|
||||
{ "device_memory", "8" },
|
||||
{ "platform", "PC" },
|
||||
{ "cookie_enabled", "true" },
|
||||
|
||||
// 屏幕与网络参数
|
||||
{ "screen_width", "1707" },
|
||||
{ "screen_height", "1067" },
|
||||
{ "downlink", "10" },
|
||||
{ "effective_type", "4g" },
|
||||
{ "round_trip_time", "0" },
|
||||
|
||||
// 用户唯一标识参数
|
||||
{ "webid", "7574080345697584675" },
|
||||
{ "uifid", "" },
|
||||
|
||||
// 安全验证与签名参数
|
||||
{ "msToken", "" },
|
||||
{ "a_bogus", "" },
|
||||
{ "verifyFp", "" },
|
||||
{ "fp", "" },
|
||||
{ "x-secsdk-web-expire", "" },
|
||||
{ "x-secsdk-web-signature", "" },
|
||||
|
||||
// 其他辅助参数
|
||||
{ "whale_cut_token", "" },
|
||||
{ "cut_version", "1" }
|
||||
};
|
||||
var parameters = GetBaseParameters();
|
||||
|
||||
// 覆盖基础参数
|
||||
parameters["version_code"] = "170400";
|
||||
parameters["version_name"] = "17.4.0";
|
||||
parameters["screen_width"] = "1707";
|
||||
parameters["screen_height"] = "1067";
|
||||
parameters["browser_name"] = "Edge";
|
||||
parameters["browser_version"] = "141.0.0.0";
|
||||
parameters["engine_version"] = "141.0.0.0";
|
||||
parameters["cpu_core_num"] = "32";
|
||||
parameters["support_h265"] = "1";
|
||||
parameters["support_dash"] = "1";
|
||||
|
||||
// 添加特有参数
|
||||
parameters.AddRange(new Dictionary<string, string>
|
||||
{
|
||||
{"user_id", "1218695735550247"},
|
||||
{"sec_user_id", ""},
|
||||
{"offset", "40"},
|
||||
{"min_time", "0"},
|
||||
{"max_time", "0"},
|
||||
{"count", "20"},
|
||||
{"source_type", "4"},
|
||||
{"gps_access", "0"},
|
||||
{"address_book_access", "0"},
|
||||
{"is_top", "1"},
|
||||
{"webid", "7577203855940994560"},
|
||||
{"uifid", ""},
|
||||
{"msToken", ""},
|
||||
{"a_bogus", ""},
|
||||
{"verifyFp", ""},
|
||||
{"fp", ""}
|
||||
});
|
||||
|
||||
return parameters;
|
||||
}
|
||||
|
||||
// 静态基础参数(供内部初始化使用)
|
||||
private static Dictionary<string, string> GetDyBaseParameters()
|
||||
#endregion
|
||||
|
||||
#region 基础参数与扩展方法
|
||||
|
||||
/// <summary>
|
||||
/// 获取抖音网页端基础参数字典(所有接口的公共参数)
|
||||
/// </summary>
|
||||
private static Dictionary<string, string> GetBaseParameters()
|
||||
{
|
||||
return new Dictionary<string, string>
|
||||
{
|
||||
@@ -199,6 +248,7 @@ namespace dy.net.utils
|
||||
{"aid", "6383"},
|
||||
{"channel", "channel_pc_web"},
|
||||
{"pc_client_type", "1"},
|
||||
{"pc_libra_divert", "Windows"},
|
||||
{"cookie_enabled", "true"},
|
||||
{"browser_language", "zh-CN"},
|
||||
{"browser_platform", "Win32"},
|
||||
@@ -211,13 +261,77 @@ namespace dy.net.utils
|
||||
{"platform", "PC"},
|
||||
{"downlink", "10"},
|
||||
{"effective_type", "4g"},
|
||||
{"pc_libra_divert", "Windows"},
|
||||
{"publish_video_strategy_type", "2"},
|
||||
{"round_trip_time", "0"},
|
||||
{"whale_cut_token", ""},
|
||||
{"update_version_code", "170400"}
|
||||
{"update_version_code", "170400"},
|
||||
{"whale_cut_token", ""}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
private static Dictionary<string, string> InitializeViedoDetailParam()
|
||||
{
|
||||
|
||||
Dictionary<string, string> requestParams = new Dictionary<string, string>
|
||||
{
|
||||
{ "device_platform", "webapp" },
|
||||
{ "aid", "6383" },
|
||||
{ "channel", "channel_pc_web" },
|
||||
{ "aweme_id", "" },
|
||||
{ "request_source", "600" },
|
||||
{ "origin_type", "video_page" },
|
||||
{ "update_version_code", "170400" },
|
||||
{ "pc_client_type", "1" },
|
||||
{ "pc_libra_divert", "Windows" },
|
||||
{ "support_h265", "1" },
|
||||
{ "support_dash", "1" },
|
||||
{ "cpu_core_num", "32" },
|
||||
{ "version_code", "190500" },
|
||||
{ "version_name", "19.5.0" },
|
||||
{ "cookie_enabled", "true" },
|
||||
{ "screen_width", "1707" },
|
||||
{ "screen_height", "1067" },
|
||||
{ "browser_language", "zh-CN" },
|
||||
{ "browser_platform", "Win32" },
|
||||
{ "browser_name", "Edge" },
|
||||
{ "browser_version", "141.0.0.0" },
|
||||
{ "browser_online", "true" },
|
||||
{ "engine_name", "Blink" },
|
||||
{ "engine_version", "141.0.0.0" },
|
||||
{ "os_name", "Windows" },
|
||||
{ "os_version", "10" },
|
||||
{ "device_memory", "8" },
|
||||
{ "platform", "PC" },
|
||||
{ "downlink", "10" },
|
||||
{ "effective_type", "4g" },
|
||||
{ "round_trip_time", "0" },
|
||||
{ "webid", "7577203855940994560" },
|
||||
{ "uifid", "0e81ba593d64ebaca259bdbe302de8d7e55ac2e982f7412f10fbc5c77c64bb8b8830ffed112ea8b3bc54f3b6e2af3856daafa4efaafef18953612820da493aeaebdeac0537b99b8e68f343c2476cf6347f7751a87d92952128116470f147215cf46b949f43f31aedcb660fd3c5c7eb2145183cc93d1b4202205b4af7d7c69ab55e860f96e315899a2ee74a262273694ec973ba682bb6fdc351e0e66250b21cf9aef3ccaa3e0c28b085fd095e947d92a5336b9e65706d649a7b79541feab3487f" },
|
||||
{ "verifyFp", "verify_migsr5je_BJ1YiVbY_uR2U_4VXu_8Uje_GgwhVf7Y6hb8" },
|
||||
{ "fp", "verify_migsr5je_BJ1YiVbY_uR2U_4VXu_8Uje_GgwhVf7Y6hb8" },
|
||||
//{ "msToken", "zVKqVOb-uBF-Opse1B5y9u0hw7SlRa49w8HB56cVSY0Uymjqs17JJ9qOUXv7IK0j3de1ErBjSVAm0JSd5SH1sYg7jeriVvGNJoDUM3dKwVCrqlapZgU9g2aYAeHs5oHddTGtZ3Pri9MIRltXVRdirZWMewfH8MlqmIVaCiTuGzRcZ6va9aWe0CyR" },
|
||||
//{ "a_bogus", "dy45kFWjOxRfOdFtmOnc9WxlY8L%2FNTuy6Pi2SYAP9PKGcwFcaWNpBNCfrxLuRUd%2FzuBzhe3HqdlMYDnc0zX0ZenkKmkkupv6Bt%2FC9L0LZZHvbBJZ7rgiemSxzk4O8KsOmAIbiM75AsBEIxo5VrCwAdlCu%2F-xBbmD%2Fp3vVATCE2ysUAujwn%2FVa-JDNw7qaf%3D%3D" },
|
||||
//{ "x-secsdk-web-expire", "1764378577130" },
|
||||
//{ "x-secsdk-web-signature", "3b8aa32e9457ebe3b65afdae11e2fe86" }
|
||||
};
|
||||
return requestParams;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 字典扩展方法:批量添加键值对(避免重复 Add 调用)
|
||||
/// </summary>
|
||||
private static void AddRange(this Dictionary<string, string> target, Dictionary<string, string> source)
|
||||
{
|
||||
foreach (var item in source)
|
||||
{
|
||||
// 避免键重复(如果有重复以源字典为准)
|
||||
if (target.ContainsKey(item.Key))
|
||||
target[item.Key] = item.Value;
|
||||
else
|
||||
target.Add(item.Key, item.Value);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user