26 lines
838 B
C#
26 lines
838 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace dy.image
|
|
{
|
|
|
|
public class DownloadHelper
|
|
{
|
|
private readonly HttpClient _httpClient;
|
|
|
|
public DownloadHelper(HttpClient httpClient)
|
|
{
|
|
_httpClient = httpClient;
|
|
_httpClient.Timeout = TimeSpan.FromSeconds(60); // 下载超时60秒
|
|
_httpClient.DefaultRequestHeaders.Add("Accept-Language", "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2");
|
|
_httpClient.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36");
|
|
_httpClient.DefaultRequestHeaders.Add("Referer", "https://www.douyin.com");
|
|
}
|
|
|
|
|
|
}
|
|
}
|