feature: user illusts page
This commit is contained in:
@@ -341,29 +341,33 @@ namespace Pixiview.Utils
|
||||
return result;
|
||||
}
|
||||
|
||||
public static IllustUserData LoadIllustUserData(string userId, bool force = false)
|
||||
public static IllustUserListData LoadIllustUserInitData(string userId)
|
||||
{
|
||||
var list = HttpUtility.LoadObject<IllustUserListData>(
|
||||
null,
|
||||
string.Format(Configs.UrlIllustUserAll, userId),
|
||||
string.Format(Configs.RefererIllustUser, userId),
|
||||
force: force);
|
||||
string.Format(Configs.RefererIllustUser, userId));
|
||||
if (list == null || list.error)
|
||||
{
|
||||
App.DebugPrint($"error when load user data: {list?.message}, force({force})");
|
||||
App.DebugPrint($"error when load user data: {list?.message}");
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
// TODO
|
||||
var ids = string.Join("", list.body.illusts.Keys.Take(20).Select(id => $"ids%5B%5D={id}&"));
|
||||
|
||||
public static IllustUserData LoadIllustUserData(string userId, string[] ids, bool firstPage)
|
||||
{
|
||||
if (ids == null || ids.Length == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var ps = string.Concat(ids.Select(i => $"ids%5B%5D={i}&"));
|
||||
var result = HttpUtility.LoadObject<IllustUserData>(
|
||||
null,
|
||||
string.Format(Configs.UrlIllustUserArtworks, userId, ids, 1),
|
||||
string.Format(Configs.RefererIllustUser, userId),
|
||||
force: force);
|
||||
string.Format(Configs.UrlIllustUserArtworks, userId, ps, firstPage ? 1 : 0),
|
||||
string.Format(Configs.RefererIllustUser, userId));
|
||||
if (result == null || result.error)
|
||||
{
|
||||
App.DebugPrint($"error when load user illust data: {result?.message}, force({force})");
|
||||
App.DebugPrint($"error when load user illust data: {result?.message}");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -449,7 +453,7 @@ namespace Pixiview.Utils
|
||||
public const string Referer = "https://www.pixiv.net/";
|
||||
public const string RefererIllust = "https://www.pixiv.net/artworks/{0}";
|
||||
public const string RefererIllustRanking = "https://www.pixiv.net/ranking.php?{0}";
|
||||
public const string RefererIllustUser = "https://www.pixiv.net/users/{0}/artworks";
|
||||
public const string RefererIllustUser = "https://www.pixiv.net/users/{0}/illustrations";
|
||||
|
||||
public static WebProxy Proxy;
|
||||
private static string Prefix => Proxy == null ?
|
||||
@@ -496,18 +500,29 @@ namespace Pixiview.Utils
|
||||
"first_visit_datetime_pc=2019-10-29+22%3A05%3A30; " +
|
||||
"yuid_b=NgcXQWQ";
|
||||
#endif
|
||||
private const string URL_PREVIEW = "https://i.pximg.net/c/360x360_70";
|
||||
|
||||
public static string GetThumbnailUrl(string url)
|
||||
{
|
||||
url = url.Replace("/custom-thumb/", "/img-master/");
|
||||
if (url == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
url = url.ToLower().Replace("/custom-thumb/", "/img-master/");
|
||||
var index = url.LastIndexOf("_square1200.jpg");
|
||||
if (index < 0)
|
||||
{
|
||||
index = url.LastIndexOf("_custom1200.jpg");
|
||||
}
|
||||
if (index >= 0)
|
||||
if (index > 0)
|
||||
{
|
||||
return url.Substring(0, index) + "_master1200.jpg";
|
||||
url = url.Substring(0, index) + "_master1200.jpg";
|
||||
|
||||
var start = url.IndexOf("/img-master/");
|
||||
if (start > 0)
|
||||
{
|
||||
url = URL_PREVIEW + url.Substring(start);
|
||||
}
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user