UI adjustment, add json proxy
This commit is contained in:
@@ -118,10 +118,10 @@ namespace Pixiview.Utils
|
||||
{
|
||||
headers.Referrer = new Uri(referer);
|
||||
}
|
||||
headers.Add("user-agent", Configs.UserAgent);
|
||||
headers.Add("accept", Configs.AcceptJson);
|
||||
headers.Add("cookie", Configs.Cookie);
|
||||
headers.Add("x-user-id", Configs.UserId);
|
||||
headers.Add("User-Agent", Configs.UserAgent);
|
||||
headers.Add("Accept", Configs.AcceptJson);
|
||||
headers.Add("Cookie", Configs.Cookie);
|
||||
headers.Add("X-User-Id", Configs.UserId);
|
||||
});
|
||||
if (response == null)
|
||||
{
|
||||
@@ -393,8 +393,8 @@ namespace Pixiview.Utils
|
||||
var response = Download(url, headers =>
|
||||
{
|
||||
headers.Referrer = new Uri(Configs.Referer);
|
||||
headers.Add("user-agent", Configs.UserAgent);
|
||||
headers.Add("accept", Configs.AcceptImage);
|
||||
headers.Add("User-Agent", Configs.UserAgent);
|
||||
headers.Add("Accept", Configs.AcceptImage);
|
||||
});
|
||||
if (response == null)
|
||||
{
|
||||
@@ -444,7 +444,8 @@ namespace Pixiview.Utils
|
||||
var proxy = Configs.Proxy;
|
||||
var handler = new HttpClientHandler
|
||||
{
|
||||
AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
|
||||
AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate,
|
||||
UseCookies = false
|
||||
};
|
||||
if (proxy != null)
|
||||
{
|
||||
@@ -460,13 +461,14 @@ namespace Pixiview.Utils
|
||||
{
|
||||
using (var request = new HttpRequestMessage(HttpMethod.Get, uri.PathAndQuery)
|
||||
{
|
||||
Version = new Version(2, 0),
|
||||
Version = new Version(2, 0)
|
||||
})
|
||||
{
|
||||
var headers = request.Headers;
|
||||
headerAction(headers);
|
||||
headers.Add("accept-language", Configs.AcceptLanguage);
|
||||
headers.Add("accept-encoding", Configs.AcceptEncoding);
|
||||
headers.Add("x-reverse", "yes");
|
||||
headers.Add("Accept-Language", Configs.AcceptLanguage);
|
||||
//headers.Add("Accept-Encoding", Configs.AcceptEncoding);
|
||||
return client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead).Result;
|
||||
}
|
||||
});
|
||||
@@ -479,34 +481,48 @@ namespace Pixiview.Utils
|
||||
public const string HostKey = "host";
|
||||
public const string PortKey = "port";
|
||||
|
||||
public static WebProxy Proxy;
|
||||
|
||||
public const int MaxThreads = 3;
|
||||
public const string Referer = "https://www.pixiv.net/";
|
||||
public const string UrlIllustList = "https://www.pixiv.net/ajax/top/illust?mode=all&lang=zh";
|
||||
public const string UrlIllust = "https://www.pixiv.net/artworks/{0}";
|
||||
|
||||
public static WebProxy Proxy;
|
||||
private static string Prefix => Proxy == null ?
|
||||
"https://hk.tsanie.us/reverse/" :
|
||||
"https://www.pixiv.net/";
|
||||
|
||||
public const string SuffixPreload = " id=\"meta-preload-data\" content='";
|
||||
public const int SuffixPreloadLength = 33; // SuffixPreload.Length
|
||||
public const string UrlIllustUserAll = "https://www.pixiv.net/ajax/user/{0}/profile/all?lang=zh";
|
||||
public const string UrlIllustUserArtworks = "https://www.pixiv.net/ajax/user/{0}/profile/illusts?{1}work_category=illustManga&is_first_page={2}&lang=zh";
|
||||
public const string UrlIllustUser = "https://www.pixiv.net/users/{0}/artworks";
|
||||
public const string UrlIllustPage = "https://www.pixiv.net/ajax/illust/{0}/pages?lang=zh";
|
||||
public static string UrlIllustList => Prefix + "ajax/top/illust?mode=all&lang=zh";
|
||||
public static string UrlIllust = Prefix + "artworks/{0}";
|
||||
public static string UrlIllustUserAll = Prefix + "ajax/user/{0}/profile/all?lang=zh";
|
||||
public static string UrlIllustUserArtworks = Prefix + "ajax/user/{0}/profile/illusts?{1}work_category=illustManga&is_first_page={2}&lang=zh";
|
||||
public static string UrlIllustUser = Prefix + "users/{0}/artworks";
|
||||
public static string UrlIllustPage = Prefix + "ajax/illust/{0}/pages?lang=zh";
|
||||
public const string UserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36";
|
||||
public const string AcceptImage = "image/png,image/svg+xml,image/*;q=0.8,video/*;q=0.8,*/*;q=0.5";
|
||||
public const string AcceptJson = "application/json";
|
||||
public const string AcceptEncoding = "gzip, deflate";
|
||||
//public const string AcceptEncoding = "gzip, deflate";
|
||||
public const string AcceptLanguage = "zh-cn";
|
||||
|
||||
public const string UserId = "2603358";
|
||||
//public const string UserId = "2603358";
|
||||
//public const string Cookie =
|
||||
// "PHPSESSID=2603358_VHyGPeRaz7LpeoFkRsHvjXIpApCMb56a; " +
|
||||
// "a_type=0; b_type=1; c_type=31; d_type=2; " +
|
||||
// "p_ab_id=2; p_ab_id_2=6; p_ab_d_id=1155161977; " +
|
||||
// "privacy_policy_agreement=2; " +
|
||||
// "login_ever=yes; " +
|
||||
// "__cfduid=d9fa2d4d1ddd30db85ebb519f9855d2561587806747; " +
|
||||
// "first_visit_datetime_pc=2019-10-29+22%3A05%3A30; " +
|
||||
// "yuid_b=NgcXQWQ";
|
||||
public const string UserId = "53887721";
|
||||
public const string Cookie =
|
||||
"PHPSESSID=2603358_VHyGPeRaz7LpeoFkRsHvjXIpApCMb56a; " +
|
||||
"a_type=0; b_type=1; c_type=31; d_type=2; " +
|
||||
"p_ab_id=2; p_ab_id_2=6; p_ab_d_id=1155161977; " +
|
||||
"PHPSESSID=5sn8n049j5c18l0tlj91qrjhesgddhjv; " +
|
||||
"a_type=0; b_type=1; c_type=29; d_type=2; " +
|
||||
"p_ab_d_id=1021624041; p_ab_id=2; p_ab_id_2=0; " +
|
||||
"privacy_policy_agreement=2; " +
|
||||
"login_ever=yes; " +
|
||||
"__cfduid=d9fa2d4d1ddd30db85ebb519f9855d2561587806747; " +
|
||||
"first_visit_datetime_pc=2019-10-29+22%3A05%3A30; " +
|
||||
"yuid_b=NgcXQWQ";
|
||||
"__cfduid=d84153bf70ae67315a8bc297299d39eb61588856027; " +
|
||||
"first_visit_datetime_pc=2020-05-07+21%3A53%3A47; " +
|
||||
"yuid_b=MYkIJXc";
|
||||
|
||||
public static string GetThumbnailUrl(string url)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user